Skip to main content

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        Self { client: fidl::client::sync::Client::new(channel) }
797    }
798
799    pub fn into_channel(self) -> fidl::Channel {
800        self.client.into_channel()
801    }
802
803    /// Waits until an event arrives and returns it. It is safe for other
804    /// threads to make concurrent requests while waiting for an event.
805    pub fn wait_for_event(
806        &self,
807        deadline: zx::MonotonicInstant,
808    ) -> Result<ContextEvent, fidl::Error> {
809        ContextEvent::decode(self.client.wait_for_event::<ContextMarker>(deadline)?)
810    }
811
812    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
813    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
814    /// component but cannot be shared across multiple components.
815    ///
816    /// - `frame`: An interface request that will be bound to the created [`Frame`].
817    pub fn r#create_frame(
818        &self,
819        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
820    ) -> Result<(), fidl::Error> {
821        self.client.send::<ContextCreateFrameRequest>(
822            (frame,),
823            0x5440a38db7cd7d8f,
824            fidl::encoding::DynamicFlags::empty(),
825        )
826    }
827
828    /// Similar to [`Context.CreateFrame`], with extra parameters.
829    ///
830    /// - `params`: The configuration used to create the [`Frame`].
831    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
832    /// - `frame`: An interface request that will be bound to the created [`Frame`].
833    pub fn r#create_frame_with_params(
834        &self,
835        mut params: CreateFrameParams,
836        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
837    ) -> Result<(), fidl::Error> {
838        self.client.send::<ContextCreateFrameWithParamsRequest>(
839            (&mut params, frame),
840            0x2c968a330787be96,
841            fidl::encoding::DynamicFlags::empty(),
842        )
843    }
844
845    /// Used to observe cookies for sites hosted under this Context.
846    pub fn r#get_cookie_manager(
847        &self,
848        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
849    ) -> Result<(), fidl::Error> {
850        self.client.send::<ContextGetCookieManagerRequest>(
851            (manager,),
852            0x7396cda568e3fca,
853            fidl::encoding::DynamicFlags::empty(),
854        )
855    }
856
857    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
858    /// number. Multiple calls may be queued to received the port number.
859    ///
860    /// If an error occurred, the [`ContextError`] will be set to this value:
861    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
862    ///   [`CreateContextParams`] or the remote debugging service failed to start.
863    pub fn r#get_remote_debugging_port(
864        &self,
865        ___deadline: zx::MonotonicInstant,
866    ) -> Result<ContextGetRemoteDebuggingPortResult, fidl::Error> {
867        let _response =
868            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
869                ContextGetRemoteDebuggingPortResponse,
870                ContextError,
871            >, ContextMarker>(
872                (),
873                0x4ac6a26fe972f29,
874                fidl::encoding::DynamicFlags::empty(),
875                ___deadline,
876            )?;
877        Ok(_response.map(|x| x.port))
878    }
879}
880
881#[cfg(target_os = "fuchsia")]
882impl From<ContextSynchronousProxy> for zx::NullableHandle {
883    fn from(value: ContextSynchronousProxy) -> Self {
884        value.into_channel().into()
885    }
886}
887
888#[cfg(target_os = "fuchsia")]
889impl From<fidl::Channel> for ContextSynchronousProxy {
890    fn from(value: fidl::Channel) -> Self {
891        Self::new(value)
892    }
893}
894
895#[cfg(target_os = "fuchsia")]
896impl fidl::endpoints::FromClient for ContextSynchronousProxy {
897    type Protocol = ContextMarker;
898
899    fn from_client(value: fidl::endpoints::ClientEnd<ContextMarker>) -> Self {
900        Self::new(value.into_channel())
901    }
902}
903
904#[derive(Debug, Clone)]
905pub struct ContextProxy {
906    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
907}
908
909impl fidl::endpoints::Proxy for ContextProxy {
910    type Protocol = ContextMarker;
911
912    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
913        Self::new(inner)
914    }
915
916    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
917        self.client.into_channel().map_err(|client| Self { client })
918    }
919
920    fn as_channel(&self) -> &::fidl::AsyncChannel {
921        self.client.as_channel()
922    }
923}
924
925impl ContextProxy {
926    /// Create a new Proxy for fuchsia.web/Context.
927    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
928        let protocol_name = <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
929        Self { client: fidl::client::Client::new(channel, protocol_name) }
930    }
931
932    /// Get a Stream of events from the remote end of the protocol.
933    ///
934    /// # Panics
935    ///
936    /// Panics if the event stream was already taken.
937    pub fn take_event_stream(&self) -> ContextEventStream {
938        ContextEventStream { event_receiver: self.client.take_event_receiver() }
939    }
940
941    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
942    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
943    /// component but cannot be shared across multiple components.
944    ///
945    /// - `frame`: An interface request that will be bound to the created [`Frame`].
946    pub fn r#create_frame(
947        &self,
948        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
949    ) -> Result<(), fidl::Error> {
950        ContextProxyInterface::r#create_frame(self, frame)
951    }
952
953    /// Similar to [`Context.CreateFrame`], with extra parameters.
954    ///
955    /// - `params`: The configuration used to create the [`Frame`].
956    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
957    /// - `frame`: An interface request that will be bound to the created [`Frame`].
958    pub fn r#create_frame_with_params(
959        &self,
960        mut params: CreateFrameParams,
961        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
962    ) -> Result<(), fidl::Error> {
963        ContextProxyInterface::r#create_frame_with_params(self, params, frame)
964    }
965
966    /// Used to observe cookies for sites hosted under this Context.
967    pub fn r#get_cookie_manager(
968        &self,
969        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
970    ) -> Result<(), fidl::Error> {
971        ContextProxyInterface::r#get_cookie_manager(self, manager)
972    }
973
974    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
975    /// number. Multiple calls may be queued to received the port number.
976    ///
977    /// If an error occurred, the [`ContextError`] will be set to this value:
978    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
979    ///   [`CreateContextParams`] or the remote debugging service failed to start.
980    pub fn r#get_remote_debugging_port(
981        &self,
982    ) -> fidl::client::QueryResponseFut<
983        ContextGetRemoteDebuggingPortResult,
984        fidl::encoding::DefaultFuchsiaResourceDialect,
985    > {
986        ContextProxyInterface::r#get_remote_debugging_port(self)
987    }
988}
989
990impl ContextProxyInterface for ContextProxy {
991    fn r#create_frame(
992        &self,
993        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
994    ) -> Result<(), fidl::Error> {
995        self.client.send::<ContextCreateFrameRequest>(
996            (frame,),
997            0x5440a38db7cd7d8f,
998            fidl::encoding::DynamicFlags::empty(),
999        )
1000    }
1001
1002    fn r#create_frame_with_params(
1003        &self,
1004        mut params: CreateFrameParams,
1005        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
1006    ) -> Result<(), fidl::Error> {
1007        self.client.send::<ContextCreateFrameWithParamsRequest>(
1008            (&mut params, frame),
1009            0x2c968a330787be96,
1010            fidl::encoding::DynamicFlags::empty(),
1011        )
1012    }
1013
1014    fn r#get_cookie_manager(
1015        &self,
1016        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
1017    ) -> Result<(), fidl::Error> {
1018        self.client.send::<ContextGetCookieManagerRequest>(
1019            (manager,),
1020            0x7396cda568e3fca,
1021            fidl::encoding::DynamicFlags::empty(),
1022        )
1023    }
1024
1025    type GetRemoteDebuggingPortResponseFut = fidl::client::QueryResponseFut<
1026        ContextGetRemoteDebuggingPortResult,
1027        fidl::encoding::DefaultFuchsiaResourceDialect,
1028    >;
1029    fn r#get_remote_debugging_port(&self) -> Self::GetRemoteDebuggingPortResponseFut {
1030        fn _decode(
1031            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1032        ) -> Result<ContextGetRemoteDebuggingPortResult, fidl::Error> {
1033            let _response = fidl::client::decode_transaction_body::<
1034                fidl::encoding::ResultType<ContextGetRemoteDebuggingPortResponse, ContextError>,
1035                fidl::encoding::DefaultFuchsiaResourceDialect,
1036                0x4ac6a26fe972f29,
1037            >(_buf?)?;
1038            Ok(_response.map(|x| x.port))
1039        }
1040        self.client.send_query_and_decode::<
1041            fidl::encoding::EmptyPayload,
1042            ContextGetRemoteDebuggingPortResult,
1043        >(
1044            (),
1045            0x4ac6a26fe972f29,
1046            fidl::encoding::DynamicFlags::empty(),
1047            _decode,
1048        )
1049    }
1050}
1051
1052pub struct ContextEventStream {
1053    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1054}
1055
1056impl std::marker::Unpin for ContextEventStream {}
1057
1058impl futures::stream::FusedStream for ContextEventStream {
1059    fn is_terminated(&self) -> bool {
1060        self.event_receiver.is_terminated()
1061    }
1062}
1063
1064impl futures::Stream for ContextEventStream {
1065    type Item = Result<ContextEvent, fidl::Error>;
1066
1067    fn poll_next(
1068        mut self: std::pin::Pin<&mut Self>,
1069        cx: &mut std::task::Context<'_>,
1070    ) -> std::task::Poll<Option<Self::Item>> {
1071        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1072            &mut self.event_receiver,
1073            cx
1074        )?) {
1075            Some(buf) => std::task::Poll::Ready(Some(ContextEvent::decode(buf))),
1076            None => std::task::Poll::Ready(None),
1077        }
1078    }
1079}
1080
1081#[derive(Debug)]
1082pub enum ContextEvent {}
1083
1084impl ContextEvent {
1085    /// Decodes a message buffer as a [`ContextEvent`].
1086    fn decode(
1087        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1088    ) -> Result<ContextEvent, fidl::Error> {
1089        let (bytes, _handles) = buf.split_mut();
1090        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1091        debug_assert_eq!(tx_header.tx_id, 0);
1092        match tx_header.ordinal {
1093            _ => Err(fidl::Error::UnknownOrdinal {
1094                ordinal: tx_header.ordinal,
1095                protocol_name: <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1096            }),
1097        }
1098    }
1099}
1100
1101/// A Stream of incoming requests for fuchsia.web/Context.
1102pub struct ContextRequestStream {
1103    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1104    is_terminated: bool,
1105}
1106
1107impl std::marker::Unpin for ContextRequestStream {}
1108
1109impl futures::stream::FusedStream for ContextRequestStream {
1110    fn is_terminated(&self) -> bool {
1111        self.is_terminated
1112    }
1113}
1114
1115impl fidl::endpoints::RequestStream for ContextRequestStream {
1116    type Protocol = ContextMarker;
1117    type ControlHandle = ContextControlHandle;
1118
1119    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1120        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1121    }
1122
1123    fn control_handle(&self) -> Self::ControlHandle {
1124        ContextControlHandle { inner: self.inner.clone() }
1125    }
1126
1127    fn into_inner(
1128        self,
1129    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1130    {
1131        (self.inner, self.is_terminated)
1132    }
1133
1134    fn from_inner(
1135        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1136        is_terminated: bool,
1137    ) -> Self {
1138        Self { inner, is_terminated }
1139    }
1140}
1141
1142impl futures::Stream for ContextRequestStream {
1143    type Item = Result<ContextRequest, fidl::Error>;
1144
1145    fn poll_next(
1146        mut self: std::pin::Pin<&mut Self>,
1147        cx: &mut std::task::Context<'_>,
1148    ) -> std::task::Poll<Option<Self::Item>> {
1149        let this = &mut *self;
1150        if this.inner.check_shutdown(cx) {
1151            this.is_terminated = true;
1152            return std::task::Poll::Ready(None);
1153        }
1154        if this.is_terminated {
1155            panic!("polled ContextRequestStream after completion");
1156        }
1157        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1158            |bytes, handles| {
1159                match this.inner.channel().read_etc(cx, bytes, handles) {
1160                    std::task::Poll::Ready(Ok(())) => {}
1161                    std::task::Poll::Pending => return std::task::Poll::Pending,
1162                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1163                        this.is_terminated = true;
1164                        return std::task::Poll::Ready(None);
1165                    }
1166                    std::task::Poll::Ready(Err(e)) => {
1167                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1168                            e.into(),
1169                        ))));
1170                    }
1171                }
1172
1173                // A message has been received from the channel
1174                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1175
1176                std::task::Poll::Ready(Some(match header.ordinal {
1177                    0x5440a38db7cd7d8f => {
1178                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1179                        let mut req = fidl::new_empty!(
1180                            ContextCreateFrameRequest,
1181                            fidl::encoding::DefaultFuchsiaResourceDialect
1182                        );
1183                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextCreateFrameRequest>(&header, _body_bytes, handles, &mut req)?;
1184                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1185                        Ok(ContextRequest::CreateFrame { frame: req.frame, control_handle })
1186                    }
1187                    0x2c968a330787be96 => {
1188                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1189                        let mut req = fidl::new_empty!(
1190                            ContextCreateFrameWithParamsRequest,
1191                            fidl::encoding::DefaultFuchsiaResourceDialect
1192                        );
1193                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextCreateFrameWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
1194                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1195                        Ok(ContextRequest::CreateFrameWithParams {
1196                            params: req.params,
1197                            frame: req.frame,
1198
1199                            control_handle,
1200                        })
1201                    }
1202                    0x7396cda568e3fca => {
1203                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1204                        let mut req = fidl::new_empty!(
1205                            ContextGetCookieManagerRequest,
1206                            fidl::encoding::DefaultFuchsiaResourceDialect
1207                        );
1208                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextGetCookieManagerRequest>(&header, _body_bytes, handles, &mut req)?;
1209                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1210                        Ok(ContextRequest::GetCookieManager {
1211                            manager: req.manager,
1212
1213                            control_handle,
1214                        })
1215                    }
1216                    0x4ac6a26fe972f29 => {
1217                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1218                        let mut req = fidl::new_empty!(
1219                            fidl::encoding::EmptyPayload,
1220                            fidl::encoding::DefaultFuchsiaResourceDialect
1221                        );
1222                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1223                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1224                        Ok(ContextRequest::GetRemoteDebuggingPort {
1225                            responder: ContextGetRemoteDebuggingPortResponder {
1226                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1227                                tx_id: header.tx_id,
1228                            },
1229                        })
1230                    }
1231                    _ => Err(fidl::Error::UnknownOrdinal {
1232                        ordinal: header.ordinal,
1233                        protocol_name:
1234                            <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1235                    }),
1236                }))
1237            },
1238        )
1239    }
1240}
1241
1242/// Manages browsing state (e.g. LocalStorage, cookies, etc) associated with a set of [`Frame`].
1243#[derive(Debug)]
1244pub enum ContextRequest {
1245    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
1246    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
1247    /// component but cannot be shared across multiple components.
1248    ///
1249    /// - `frame`: An interface request that will be bound to the created [`Frame`].
1250    CreateFrame {
1251        frame: fidl::endpoints::ServerEnd<FrameMarker>,
1252        control_handle: ContextControlHandle,
1253    },
1254    /// Similar to [`Context.CreateFrame`], with extra parameters.
1255    ///
1256    /// - `params`: The configuration used to create the [`Frame`].
1257    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
1258    /// - `frame`: An interface request that will be bound to the created [`Frame`].
1259    CreateFrameWithParams {
1260        params: CreateFrameParams,
1261        frame: fidl::endpoints::ServerEnd<FrameMarker>,
1262        control_handle: ContextControlHandle,
1263    },
1264    /// Used to observe cookies for sites hosted under this Context.
1265    GetCookieManager {
1266        manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
1267        control_handle: ContextControlHandle,
1268    },
1269    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
1270    /// number. Multiple calls may be queued to received the port number.
1271    ///
1272    /// If an error occurred, the [`ContextError`] will be set to this value:
1273    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
1274    ///   [`CreateContextParams`] or the remote debugging service failed to start.
1275    GetRemoteDebuggingPort { responder: ContextGetRemoteDebuggingPortResponder },
1276}
1277
1278impl ContextRequest {
1279    #[allow(irrefutable_let_patterns)]
1280    pub fn into_create_frame(
1281        self,
1282    ) -> Option<(fidl::endpoints::ServerEnd<FrameMarker>, ContextControlHandle)> {
1283        if let ContextRequest::CreateFrame { frame, control_handle } = self {
1284            Some((frame, control_handle))
1285        } else {
1286            None
1287        }
1288    }
1289
1290    #[allow(irrefutable_let_patterns)]
1291    pub fn into_create_frame_with_params(
1292        self,
1293    ) -> Option<(CreateFrameParams, fidl::endpoints::ServerEnd<FrameMarker>, ContextControlHandle)>
1294    {
1295        if let ContextRequest::CreateFrameWithParams { params, frame, control_handle } = self {
1296            Some((params, frame, control_handle))
1297        } else {
1298            None
1299        }
1300    }
1301
1302    #[allow(irrefutable_let_patterns)]
1303    pub fn into_get_cookie_manager(
1304        self,
1305    ) -> Option<(fidl::endpoints::ServerEnd<CookieManagerMarker>, ContextControlHandle)> {
1306        if let ContextRequest::GetCookieManager { manager, control_handle } = self {
1307            Some((manager, control_handle))
1308        } else {
1309            None
1310        }
1311    }
1312
1313    #[allow(irrefutable_let_patterns)]
1314    pub fn into_get_remote_debugging_port(
1315        self,
1316    ) -> Option<(ContextGetRemoteDebuggingPortResponder)> {
1317        if let ContextRequest::GetRemoteDebuggingPort { responder } = self {
1318            Some((responder))
1319        } else {
1320            None
1321        }
1322    }
1323
1324    /// Name of the method defined in FIDL
1325    pub fn method_name(&self) -> &'static str {
1326        match *self {
1327            ContextRequest::CreateFrame { .. } => "create_frame",
1328            ContextRequest::CreateFrameWithParams { .. } => "create_frame_with_params",
1329            ContextRequest::GetCookieManager { .. } => "get_cookie_manager",
1330            ContextRequest::GetRemoteDebuggingPort { .. } => "get_remote_debugging_port",
1331        }
1332    }
1333}
1334
1335#[derive(Debug, Clone)]
1336pub struct ContextControlHandle {
1337    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1338}
1339
1340impl fidl::endpoints::ControlHandle for ContextControlHandle {
1341    fn shutdown(&self) {
1342        self.inner.shutdown()
1343    }
1344
1345    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1346        self.inner.shutdown_with_epitaph(status)
1347    }
1348
1349    fn is_closed(&self) -> bool {
1350        self.inner.channel().is_closed()
1351    }
1352    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1353        self.inner.channel().on_closed()
1354    }
1355
1356    #[cfg(target_os = "fuchsia")]
1357    fn signal_peer(
1358        &self,
1359        clear_mask: zx::Signals,
1360        set_mask: zx::Signals,
1361    ) -> Result<(), zx_status::Status> {
1362        use fidl::Peered;
1363        self.inner.channel().signal_peer(clear_mask, set_mask)
1364    }
1365}
1366
1367impl ContextControlHandle {}
1368
1369#[must_use = "FIDL methods require a response to be sent"]
1370#[derive(Debug)]
1371pub struct ContextGetRemoteDebuggingPortResponder {
1372    control_handle: std::mem::ManuallyDrop<ContextControlHandle>,
1373    tx_id: u32,
1374}
1375
1376/// Set the the channel to be shutdown (see [`ContextControlHandle::shutdown`])
1377/// if the responder is dropped without sending a response, so that the client
1378/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1379impl std::ops::Drop for ContextGetRemoteDebuggingPortResponder {
1380    fn drop(&mut self) {
1381        self.control_handle.shutdown();
1382        // Safety: drops once, never accessed again
1383        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1384    }
1385}
1386
1387impl fidl::endpoints::Responder for ContextGetRemoteDebuggingPortResponder {
1388    type ControlHandle = ContextControlHandle;
1389
1390    fn control_handle(&self) -> &ContextControlHandle {
1391        &self.control_handle
1392    }
1393
1394    fn drop_without_shutdown(mut self) {
1395        // Safety: drops once, never accessed again due to mem::forget
1396        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1397        // Prevent Drop from running (which would shut down the channel)
1398        std::mem::forget(self);
1399    }
1400}
1401
1402impl ContextGetRemoteDebuggingPortResponder {
1403    /// Sends a response to the FIDL transaction.
1404    ///
1405    /// Sets the channel to shutdown if an error occurs.
1406    pub fn send(self, mut result: Result<u16, ContextError>) -> Result<(), fidl::Error> {
1407        let _result = self.send_raw(result);
1408        if _result.is_err() {
1409            self.control_handle.shutdown();
1410        }
1411        self.drop_without_shutdown();
1412        _result
1413    }
1414
1415    /// Similar to "send" but does not shutdown the channel if an error occurs.
1416    pub fn send_no_shutdown_on_err(
1417        self,
1418        mut result: Result<u16, ContextError>,
1419    ) -> Result<(), fidl::Error> {
1420        let _result = self.send_raw(result);
1421        self.drop_without_shutdown();
1422        _result
1423    }
1424
1425    fn send_raw(&self, mut result: Result<u16, ContextError>) -> Result<(), fidl::Error> {
1426        self.control_handle.inner.send::<fidl::encoding::ResultType<
1427            ContextGetRemoteDebuggingPortResponse,
1428            ContextError,
1429        >>(
1430            result.map(|port| (port,)),
1431            self.tx_id,
1432            0x4ac6a26fe972f29,
1433            fidl::encoding::DynamicFlags::empty(),
1434        )
1435    }
1436}
1437
1438#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1439pub struct ContextProviderMarker;
1440
1441impl fidl::endpoints::ProtocolMarker for ContextProviderMarker {
1442    type Proxy = ContextProviderProxy;
1443    type RequestStream = ContextProviderRequestStream;
1444    #[cfg(target_os = "fuchsia")]
1445    type SynchronousProxy = ContextProviderSynchronousProxy;
1446
1447    const DEBUG_NAME: &'static str = "fuchsia.web.ContextProvider";
1448}
1449impl fidl::endpoints::DiscoverableProtocolMarker for ContextProviderMarker {}
1450
1451pub trait ContextProviderProxyInterface: Send + Sync {
1452    fn r#create(
1453        &self,
1454        params: CreateContextParams,
1455        context: fidl::endpoints::ServerEnd<ContextMarker>,
1456    ) -> Result<(), fidl::Error>;
1457}
1458#[derive(Debug)]
1459#[cfg(target_os = "fuchsia")]
1460pub struct ContextProviderSynchronousProxy {
1461    client: fidl::client::sync::Client,
1462}
1463
1464#[cfg(target_os = "fuchsia")]
1465impl fidl::endpoints::SynchronousProxy for ContextProviderSynchronousProxy {
1466    type Proxy = ContextProviderProxy;
1467    type Protocol = ContextProviderMarker;
1468
1469    fn from_channel(inner: fidl::Channel) -> Self {
1470        Self::new(inner)
1471    }
1472
1473    fn into_channel(self) -> fidl::Channel {
1474        self.client.into_channel()
1475    }
1476
1477    fn as_channel(&self) -> &fidl::Channel {
1478        self.client.as_channel()
1479    }
1480}
1481
1482#[cfg(target_os = "fuchsia")]
1483impl ContextProviderSynchronousProxy {
1484    pub fn new(channel: fidl::Channel) -> Self {
1485        Self { client: fidl::client::sync::Client::new(channel) }
1486    }
1487
1488    pub fn into_channel(self) -> fidl::Channel {
1489        self.client.into_channel()
1490    }
1491
1492    /// Waits until an event arrives and returns it. It is safe for other
1493    /// threads to make concurrent requests while waiting for an event.
1494    pub fn wait_for_event(
1495        &self,
1496        deadline: zx::MonotonicInstant,
1497    ) -> Result<ContextProviderEvent, fidl::Error> {
1498        ContextProviderEvent::decode(self.client.wait_for_event::<ContextProviderMarker>(deadline)?)
1499    }
1500
1501    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1502    /// [`Context`](`Contexts`).
1503    ///
1504    /// - `params`: The configuration used to create the [`Context`].
1505    /// - `context`: An interface request which will receive a bound [`Context`]
1506    ///   service.
1507    pub fn r#create(
1508        &self,
1509        mut params: CreateContextParams,
1510        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1511    ) -> Result<(), fidl::Error> {
1512        self.client.send::<ContextProviderCreateRequest>(
1513            (&mut params, context),
1514            0x6ee6fa35978eb98d,
1515            fidl::encoding::DynamicFlags::empty(),
1516        )
1517    }
1518}
1519
1520#[cfg(target_os = "fuchsia")]
1521impl From<ContextProviderSynchronousProxy> for zx::NullableHandle {
1522    fn from(value: ContextProviderSynchronousProxy) -> Self {
1523        value.into_channel().into()
1524    }
1525}
1526
1527#[cfg(target_os = "fuchsia")]
1528impl From<fidl::Channel> for ContextProviderSynchronousProxy {
1529    fn from(value: fidl::Channel) -> Self {
1530        Self::new(value)
1531    }
1532}
1533
1534#[cfg(target_os = "fuchsia")]
1535impl fidl::endpoints::FromClient for ContextProviderSynchronousProxy {
1536    type Protocol = ContextProviderMarker;
1537
1538    fn from_client(value: fidl::endpoints::ClientEnd<ContextProviderMarker>) -> Self {
1539        Self::new(value.into_channel())
1540    }
1541}
1542
1543#[derive(Debug, Clone)]
1544pub struct ContextProviderProxy {
1545    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1546}
1547
1548impl fidl::endpoints::Proxy for ContextProviderProxy {
1549    type Protocol = ContextProviderMarker;
1550
1551    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1552        Self::new(inner)
1553    }
1554
1555    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1556        self.client.into_channel().map_err(|client| Self { client })
1557    }
1558
1559    fn as_channel(&self) -> &::fidl::AsyncChannel {
1560        self.client.as_channel()
1561    }
1562}
1563
1564impl ContextProviderProxy {
1565    /// Create a new Proxy for fuchsia.web/ContextProvider.
1566    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1567        let protocol_name = <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1568        Self { client: fidl::client::Client::new(channel, protocol_name) }
1569    }
1570
1571    /// Get a Stream of events from the remote end of the protocol.
1572    ///
1573    /// # Panics
1574    ///
1575    /// Panics if the event stream was already taken.
1576    pub fn take_event_stream(&self) -> ContextProviderEventStream {
1577        ContextProviderEventStream { event_receiver: self.client.take_event_receiver() }
1578    }
1579
1580    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1581    /// [`Context`](`Contexts`).
1582    ///
1583    /// - `params`: The configuration used to create the [`Context`].
1584    /// - `context`: An interface request which will receive a bound [`Context`]
1585    ///   service.
1586    pub fn r#create(
1587        &self,
1588        mut params: CreateContextParams,
1589        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1590    ) -> Result<(), fidl::Error> {
1591        ContextProviderProxyInterface::r#create(self, params, context)
1592    }
1593}
1594
1595impl ContextProviderProxyInterface for ContextProviderProxy {
1596    fn r#create(
1597        &self,
1598        mut params: CreateContextParams,
1599        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1600    ) -> Result<(), fidl::Error> {
1601        self.client.send::<ContextProviderCreateRequest>(
1602            (&mut params, context),
1603            0x6ee6fa35978eb98d,
1604            fidl::encoding::DynamicFlags::empty(),
1605        )
1606    }
1607}
1608
1609pub struct ContextProviderEventStream {
1610    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1611}
1612
1613impl std::marker::Unpin for ContextProviderEventStream {}
1614
1615impl futures::stream::FusedStream for ContextProviderEventStream {
1616    fn is_terminated(&self) -> bool {
1617        self.event_receiver.is_terminated()
1618    }
1619}
1620
1621impl futures::Stream for ContextProviderEventStream {
1622    type Item = Result<ContextProviderEvent, fidl::Error>;
1623
1624    fn poll_next(
1625        mut self: std::pin::Pin<&mut Self>,
1626        cx: &mut std::task::Context<'_>,
1627    ) -> std::task::Poll<Option<Self::Item>> {
1628        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1629            &mut self.event_receiver,
1630            cx
1631        )?) {
1632            Some(buf) => std::task::Poll::Ready(Some(ContextProviderEvent::decode(buf))),
1633            None => std::task::Poll::Ready(None),
1634        }
1635    }
1636}
1637
1638#[derive(Debug)]
1639pub enum ContextProviderEvent {}
1640
1641impl ContextProviderEvent {
1642    /// Decodes a message buffer as a [`ContextProviderEvent`].
1643    fn decode(
1644        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1645    ) -> Result<ContextProviderEvent, fidl::Error> {
1646        let (bytes, _handles) = buf.split_mut();
1647        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1648        debug_assert_eq!(tx_header.tx_id, 0);
1649        match tx_header.ordinal {
1650            _ => Err(fidl::Error::UnknownOrdinal {
1651                ordinal: tx_header.ordinal,
1652                protocol_name:
1653                    <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1654            }),
1655        }
1656    }
1657}
1658
1659/// A Stream of incoming requests for fuchsia.web/ContextProvider.
1660pub struct ContextProviderRequestStream {
1661    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1662    is_terminated: bool,
1663}
1664
1665impl std::marker::Unpin for ContextProviderRequestStream {}
1666
1667impl futures::stream::FusedStream for ContextProviderRequestStream {
1668    fn is_terminated(&self) -> bool {
1669        self.is_terminated
1670    }
1671}
1672
1673impl fidl::endpoints::RequestStream for ContextProviderRequestStream {
1674    type Protocol = ContextProviderMarker;
1675    type ControlHandle = ContextProviderControlHandle;
1676
1677    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1678        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1679    }
1680
1681    fn control_handle(&self) -> Self::ControlHandle {
1682        ContextProviderControlHandle { inner: self.inner.clone() }
1683    }
1684
1685    fn into_inner(
1686        self,
1687    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1688    {
1689        (self.inner, self.is_terminated)
1690    }
1691
1692    fn from_inner(
1693        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1694        is_terminated: bool,
1695    ) -> Self {
1696        Self { inner, is_terminated }
1697    }
1698}
1699
1700impl futures::Stream for ContextProviderRequestStream {
1701    type Item = Result<ContextProviderRequest, fidl::Error>;
1702
1703    fn poll_next(
1704        mut self: std::pin::Pin<&mut Self>,
1705        cx: &mut std::task::Context<'_>,
1706    ) -> std::task::Poll<Option<Self::Item>> {
1707        let this = &mut *self;
1708        if this.inner.check_shutdown(cx) {
1709            this.is_terminated = true;
1710            return std::task::Poll::Ready(None);
1711        }
1712        if this.is_terminated {
1713            panic!("polled ContextProviderRequestStream after completion");
1714        }
1715        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1716            |bytes, handles| {
1717                match this.inner.channel().read_etc(cx, bytes, handles) {
1718                    std::task::Poll::Ready(Ok(())) => {}
1719                    std::task::Poll::Pending => return std::task::Poll::Pending,
1720                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1721                        this.is_terminated = true;
1722                        return std::task::Poll::Ready(None);
1723                    }
1724                    std::task::Poll::Ready(Err(e)) => {
1725                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1726                            e.into(),
1727                        ))));
1728                    }
1729                }
1730
1731                // A message has been received from the channel
1732                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1733
1734                std::task::Poll::Ready(Some(match header.ordinal {
1735                    0x6ee6fa35978eb98d => {
1736                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1737                        let mut req = fidl::new_empty!(
1738                            ContextProviderCreateRequest,
1739                            fidl::encoding::DefaultFuchsiaResourceDialect
1740                        );
1741                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextProviderCreateRequest>(&header, _body_bytes, handles, &mut req)?;
1742                        let control_handle =
1743                            ContextProviderControlHandle { inner: this.inner.clone() };
1744                        Ok(ContextProviderRequest::Create {
1745                            params: req.params,
1746                            context: req.context,
1747
1748                            control_handle,
1749                        })
1750                    }
1751                    _ => Err(fidl::Error::UnknownOrdinal {
1752                        ordinal: header.ordinal,
1753                        protocol_name:
1754                            <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1755                    }),
1756                }))
1757            },
1758        )
1759    }
1760}
1761
1762/// The top-level service interface which allows for the creation of Context resources.
1763#[derive(Debug)]
1764pub enum ContextProviderRequest {
1765    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1766    /// [`Context`](`Contexts`).
1767    ///
1768    /// - `params`: The configuration used to create the [`Context`].
1769    /// - `context`: An interface request which will receive a bound [`Context`]
1770    ///   service.
1771    Create {
1772        params: CreateContextParams,
1773        context: fidl::endpoints::ServerEnd<ContextMarker>,
1774        control_handle: ContextProviderControlHandle,
1775    },
1776}
1777
1778impl ContextProviderRequest {
1779    #[allow(irrefutable_let_patterns)]
1780    pub fn into_create(
1781        self,
1782    ) -> Option<(
1783        CreateContextParams,
1784        fidl::endpoints::ServerEnd<ContextMarker>,
1785        ContextProviderControlHandle,
1786    )> {
1787        if let ContextProviderRequest::Create { params, context, control_handle } = self {
1788            Some((params, context, control_handle))
1789        } else {
1790            None
1791        }
1792    }
1793
1794    /// Name of the method defined in FIDL
1795    pub fn method_name(&self) -> &'static str {
1796        match *self {
1797            ContextProviderRequest::Create { .. } => "create",
1798        }
1799    }
1800}
1801
1802#[derive(Debug, Clone)]
1803pub struct ContextProviderControlHandle {
1804    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1805}
1806
1807impl fidl::endpoints::ControlHandle for ContextProviderControlHandle {
1808    fn shutdown(&self) {
1809        self.inner.shutdown()
1810    }
1811
1812    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1813        self.inner.shutdown_with_epitaph(status)
1814    }
1815
1816    fn is_closed(&self) -> bool {
1817        self.inner.channel().is_closed()
1818    }
1819    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1820        self.inner.channel().on_closed()
1821    }
1822
1823    #[cfg(target_os = "fuchsia")]
1824    fn signal_peer(
1825        &self,
1826        clear_mask: zx::Signals,
1827        set_mask: zx::Signals,
1828    ) -> Result<(), zx_status::Status> {
1829        use fidl::Peered;
1830        self.inner.channel().signal_peer(clear_mask, set_mask)
1831    }
1832}
1833
1834impl ContextProviderControlHandle {}
1835
1836#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1837pub struct CookieManagerMarker;
1838
1839impl fidl::endpoints::ProtocolMarker for CookieManagerMarker {
1840    type Proxy = CookieManagerProxy;
1841    type RequestStream = CookieManagerRequestStream;
1842    #[cfg(target_os = "fuchsia")]
1843    type SynchronousProxy = CookieManagerSynchronousProxy;
1844
1845    const DEBUG_NAME: &'static str = "(anonymous) CookieManager";
1846}
1847
1848pub trait CookieManagerProxyInterface: Send + Sync {
1849    fn r#observe_cookie_changes(
1850        &self,
1851        url: Option<&str>,
1852        name: Option<&str>,
1853        changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1854    ) -> Result<(), fidl::Error>;
1855    fn r#get_cookie_list(
1856        &self,
1857        url: Option<&str>,
1858        name: Option<&str>,
1859        cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1860    ) -> Result<(), fidl::Error>;
1861}
1862#[derive(Debug)]
1863#[cfg(target_os = "fuchsia")]
1864pub struct CookieManagerSynchronousProxy {
1865    client: fidl::client::sync::Client,
1866}
1867
1868#[cfg(target_os = "fuchsia")]
1869impl fidl::endpoints::SynchronousProxy for CookieManagerSynchronousProxy {
1870    type Proxy = CookieManagerProxy;
1871    type Protocol = CookieManagerMarker;
1872
1873    fn from_channel(inner: fidl::Channel) -> Self {
1874        Self::new(inner)
1875    }
1876
1877    fn into_channel(self) -> fidl::Channel {
1878        self.client.into_channel()
1879    }
1880
1881    fn as_channel(&self) -> &fidl::Channel {
1882        self.client.as_channel()
1883    }
1884}
1885
1886#[cfg(target_os = "fuchsia")]
1887impl CookieManagerSynchronousProxy {
1888    pub fn new(channel: fidl::Channel) -> Self {
1889        Self { client: fidl::client::sync::Client::new(channel) }
1890    }
1891
1892    pub fn into_channel(self) -> fidl::Channel {
1893        self.client.into_channel()
1894    }
1895
1896    /// Waits until an event arrives and returns it. It is safe for other
1897    /// threads to make concurrent requests while waiting for an event.
1898    pub fn wait_for_event(
1899        &self,
1900        deadline: zx::MonotonicInstant,
1901    ) -> Result<CookieManagerEvent, fidl::Error> {
1902        CookieManagerEvent::decode(self.client.wait_for_event::<CookieManagerMarker>(deadline)?)
1903    }
1904
1905    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
1906    ///
1907    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
1908    /// then all cookies for that URL are observed. If both are set then only cookies matching both
1909    /// fields are observed.
1910    ///
1911    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
1912    /// complete cookies, while deletions are expressed as cookies with no `value` set.
1913    pub fn r#observe_cookie_changes(
1914        &self,
1915        mut url: Option<&str>,
1916        mut name: Option<&str>,
1917        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1918    ) -> Result<(), fidl::Error> {
1919        self.client.send::<CookieManagerObserveCookieChangesRequest>(
1920            (url, name, changes),
1921            0x49d8259726088b2,
1922            fidl::encoding::DynamicFlags::empty(),
1923        )
1924    }
1925
1926    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
1927    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
1928    pub fn r#get_cookie_list(
1929        &self,
1930        mut url: Option<&str>,
1931        mut name: Option<&str>,
1932        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1933    ) -> Result<(), fidl::Error> {
1934        self.client.send::<CookieManagerGetCookieListRequest>(
1935            (url, name, cookies),
1936            0x391d79f54044f334,
1937            fidl::encoding::DynamicFlags::empty(),
1938        )
1939    }
1940}
1941
1942#[cfg(target_os = "fuchsia")]
1943impl From<CookieManagerSynchronousProxy> for zx::NullableHandle {
1944    fn from(value: CookieManagerSynchronousProxy) -> Self {
1945        value.into_channel().into()
1946    }
1947}
1948
1949#[cfg(target_os = "fuchsia")]
1950impl From<fidl::Channel> for CookieManagerSynchronousProxy {
1951    fn from(value: fidl::Channel) -> Self {
1952        Self::new(value)
1953    }
1954}
1955
1956#[cfg(target_os = "fuchsia")]
1957impl fidl::endpoints::FromClient for CookieManagerSynchronousProxy {
1958    type Protocol = CookieManagerMarker;
1959
1960    fn from_client(value: fidl::endpoints::ClientEnd<CookieManagerMarker>) -> Self {
1961        Self::new(value.into_channel())
1962    }
1963}
1964
1965#[derive(Debug, Clone)]
1966pub struct CookieManagerProxy {
1967    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1968}
1969
1970impl fidl::endpoints::Proxy for CookieManagerProxy {
1971    type Protocol = CookieManagerMarker;
1972
1973    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1974        Self::new(inner)
1975    }
1976
1977    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1978        self.client.into_channel().map_err(|client| Self { client })
1979    }
1980
1981    fn as_channel(&self) -> &::fidl::AsyncChannel {
1982        self.client.as_channel()
1983    }
1984}
1985
1986impl CookieManagerProxy {
1987    /// Create a new Proxy for fuchsia.web/CookieManager.
1988    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1989        let protocol_name = <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1990        Self { client: fidl::client::Client::new(channel, protocol_name) }
1991    }
1992
1993    /// Get a Stream of events from the remote end of the protocol.
1994    ///
1995    /// # Panics
1996    ///
1997    /// Panics if the event stream was already taken.
1998    pub fn take_event_stream(&self) -> CookieManagerEventStream {
1999        CookieManagerEventStream { event_receiver: self.client.take_event_receiver() }
2000    }
2001
2002    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
2003    ///
2004    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
2005    /// then all cookies for that URL are observed. If both are set then only cookies matching both
2006    /// fields are observed.
2007    ///
2008    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
2009    /// complete cookies, while deletions are expressed as cookies with no `value` set.
2010    pub fn r#observe_cookie_changes(
2011        &self,
2012        mut url: Option<&str>,
2013        mut name: Option<&str>,
2014        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2015    ) -> Result<(), fidl::Error> {
2016        CookieManagerProxyInterface::r#observe_cookie_changes(self, url, name, changes)
2017    }
2018
2019    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
2020    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
2021    pub fn r#get_cookie_list(
2022        &self,
2023        mut url: Option<&str>,
2024        mut name: Option<&str>,
2025        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2026    ) -> Result<(), fidl::Error> {
2027        CookieManagerProxyInterface::r#get_cookie_list(self, url, name, cookies)
2028    }
2029}
2030
2031impl CookieManagerProxyInterface for CookieManagerProxy {
2032    fn r#observe_cookie_changes(
2033        &self,
2034        mut url: Option<&str>,
2035        mut name: Option<&str>,
2036        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2037    ) -> Result<(), fidl::Error> {
2038        self.client.send::<CookieManagerObserveCookieChangesRequest>(
2039            (url, name, changes),
2040            0x49d8259726088b2,
2041            fidl::encoding::DynamicFlags::empty(),
2042        )
2043    }
2044
2045    fn r#get_cookie_list(
2046        &self,
2047        mut url: Option<&str>,
2048        mut name: Option<&str>,
2049        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2050    ) -> Result<(), fidl::Error> {
2051        self.client.send::<CookieManagerGetCookieListRequest>(
2052            (url, name, cookies),
2053            0x391d79f54044f334,
2054            fidl::encoding::DynamicFlags::empty(),
2055        )
2056    }
2057}
2058
2059pub struct CookieManagerEventStream {
2060    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2061}
2062
2063impl std::marker::Unpin for CookieManagerEventStream {}
2064
2065impl futures::stream::FusedStream for CookieManagerEventStream {
2066    fn is_terminated(&self) -> bool {
2067        self.event_receiver.is_terminated()
2068    }
2069}
2070
2071impl futures::Stream for CookieManagerEventStream {
2072    type Item = Result<CookieManagerEvent, fidl::Error>;
2073
2074    fn poll_next(
2075        mut self: std::pin::Pin<&mut Self>,
2076        cx: &mut std::task::Context<'_>,
2077    ) -> std::task::Poll<Option<Self::Item>> {
2078        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2079            &mut self.event_receiver,
2080            cx
2081        )?) {
2082            Some(buf) => std::task::Poll::Ready(Some(CookieManagerEvent::decode(buf))),
2083            None => std::task::Poll::Ready(None),
2084        }
2085    }
2086}
2087
2088#[derive(Debug)]
2089pub enum CookieManagerEvent {}
2090
2091impl CookieManagerEvent {
2092    /// Decodes a message buffer as a [`CookieManagerEvent`].
2093    fn decode(
2094        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2095    ) -> Result<CookieManagerEvent, fidl::Error> {
2096        let (bytes, _handles) = buf.split_mut();
2097        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2098        debug_assert_eq!(tx_header.tx_id, 0);
2099        match tx_header.ordinal {
2100            _ => Err(fidl::Error::UnknownOrdinal {
2101                ordinal: tx_header.ordinal,
2102                protocol_name: <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2103            }),
2104        }
2105    }
2106}
2107
2108/// A Stream of incoming requests for fuchsia.web/CookieManager.
2109pub struct CookieManagerRequestStream {
2110    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2111    is_terminated: bool,
2112}
2113
2114impl std::marker::Unpin for CookieManagerRequestStream {}
2115
2116impl futures::stream::FusedStream for CookieManagerRequestStream {
2117    fn is_terminated(&self) -> bool {
2118        self.is_terminated
2119    }
2120}
2121
2122impl fidl::endpoints::RequestStream for CookieManagerRequestStream {
2123    type Protocol = CookieManagerMarker;
2124    type ControlHandle = CookieManagerControlHandle;
2125
2126    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2127        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2128    }
2129
2130    fn control_handle(&self) -> Self::ControlHandle {
2131        CookieManagerControlHandle { inner: self.inner.clone() }
2132    }
2133
2134    fn into_inner(
2135        self,
2136    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2137    {
2138        (self.inner, self.is_terminated)
2139    }
2140
2141    fn from_inner(
2142        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2143        is_terminated: bool,
2144    ) -> Self {
2145        Self { inner, is_terminated }
2146    }
2147}
2148
2149impl futures::Stream for CookieManagerRequestStream {
2150    type Item = Result<CookieManagerRequest, fidl::Error>;
2151
2152    fn poll_next(
2153        mut self: std::pin::Pin<&mut Self>,
2154        cx: &mut std::task::Context<'_>,
2155    ) -> std::task::Poll<Option<Self::Item>> {
2156        let this = &mut *self;
2157        if this.inner.check_shutdown(cx) {
2158            this.is_terminated = true;
2159            return std::task::Poll::Ready(None);
2160        }
2161        if this.is_terminated {
2162            panic!("polled CookieManagerRequestStream after completion");
2163        }
2164        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2165            |bytes, handles| {
2166                match this.inner.channel().read_etc(cx, bytes, handles) {
2167                    std::task::Poll::Ready(Ok(())) => {}
2168                    std::task::Poll::Pending => return std::task::Poll::Pending,
2169                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2170                        this.is_terminated = true;
2171                        return std::task::Poll::Ready(None);
2172                    }
2173                    std::task::Poll::Ready(Err(e)) => {
2174                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2175                            e.into(),
2176                        ))));
2177                    }
2178                }
2179
2180                // A message has been received from the channel
2181                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2182
2183                std::task::Poll::Ready(Some(match header.ordinal {
2184                    0x49d8259726088b2 => {
2185                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2186                        let mut req = fidl::new_empty!(
2187                            CookieManagerObserveCookieChangesRequest,
2188                            fidl::encoding::DefaultFuchsiaResourceDialect
2189                        );
2190                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CookieManagerObserveCookieChangesRequest>(&header, _body_bytes, handles, &mut req)?;
2191                        let control_handle =
2192                            CookieManagerControlHandle { inner: this.inner.clone() };
2193                        Ok(CookieManagerRequest::ObserveCookieChanges {
2194                            url: req.url,
2195                            name: req.name,
2196                            changes: req.changes,
2197
2198                            control_handle,
2199                        })
2200                    }
2201                    0x391d79f54044f334 => {
2202                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2203                        let mut req = fidl::new_empty!(
2204                            CookieManagerGetCookieListRequest,
2205                            fidl::encoding::DefaultFuchsiaResourceDialect
2206                        );
2207                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CookieManagerGetCookieListRequest>(&header, _body_bytes, handles, &mut req)?;
2208                        let control_handle =
2209                            CookieManagerControlHandle { inner: this.inner.clone() };
2210                        Ok(CookieManagerRequest::GetCookieList {
2211                            url: req.url,
2212                            name: req.name,
2213                            cookies: req.cookies,
2214
2215                            control_handle,
2216                        })
2217                    }
2218                    _ => Err(fidl::Error::UnknownOrdinal {
2219                        ordinal: header.ordinal,
2220                        protocol_name:
2221                            <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2222                    }),
2223                }))
2224            },
2225        )
2226    }
2227}
2228
2229/// Provides methods for monitoring and accessing browser cookie state.
2230#[derive(Debug)]
2231pub enum CookieManagerRequest {
2232    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
2233    ///
2234    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
2235    /// then all cookies for that URL are observed. If both are set then only cookies matching both
2236    /// fields are observed.
2237    ///
2238    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
2239    /// complete cookies, while deletions are expressed as cookies with no `value` set.
2240    ObserveCookieChanges {
2241        url: Option<String>,
2242        name: Option<String>,
2243        changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2244        control_handle: CookieManagerControlHandle,
2245    },
2246    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
2247    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
2248    GetCookieList {
2249        url: Option<String>,
2250        name: Option<String>,
2251        cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2252        control_handle: CookieManagerControlHandle,
2253    },
2254}
2255
2256impl CookieManagerRequest {
2257    #[allow(irrefutable_let_patterns)]
2258    pub fn into_observe_cookie_changes(
2259        self,
2260    ) -> Option<(
2261        Option<String>,
2262        Option<String>,
2263        fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2264        CookieManagerControlHandle,
2265    )> {
2266        if let CookieManagerRequest::ObserveCookieChanges { url, name, changes, control_handle } =
2267            self
2268        {
2269            Some((url, name, changes, control_handle))
2270        } else {
2271            None
2272        }
2273    }
2274
2275    #[allow(irrefutable_let_patterns)]
2276    pub fn into_get_cookie_list(
2277        self,
2278    ) -> Option<(
2279        Option<String>,
2280        Option<String>,
2281        fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2282        CookieManagerControlHandle,
2283    )> {
2284        if let CookieManagerRequest::GetCookieList { url, name, cookies, control_handle } = self {
2285            Some((url, name, cookies, control_handle))
2286        } else {
2287            None
2288        }
2289    }
2290
2291    /// Name of the method defined in FIDL
2292    pub fn method_name(&self) -> &'static str {
2293        match *self {
2294            CookieManagerRequest::ObserveCookieChanges { .. } => "observe_cookie_changes",
2295            CookieManagerRequest::GetCookieList { .. } => "get_cookie_list",
2296        }
2297    }
2298}
2299
2300#[derive(Debug, Clone)]
2301pub struct CookieManagerControlHandle {
2302    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2303}
2304
2305impl fidl::endpoints::ControlHandle for CookieManagerControlHandle {
2306    fn shutdown(&self) {
2307        self.inner.shutdown()
2308    }
2309
2310    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2311        self.inner.shutdown_with_epitaph(status)
2312    }
2313
2314    fn is_closed(&self) -> bool {
2315        self.inner.channel().is_closed()
2316    }
2317    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2318        self.inner.channel().on_closed()
2319    }
2320
2321    #[cfg(target_os = "fuchsia")]
2322    fn signal_peer(
2323        &self,
2324        clear_mask: zx::Signals,
2325        set_mask: zx::Signals,
2326    ) -> Result<(), zx_status::Status> {
2327        use fidl::Peered;
2328        self.inner.channel().signal_peer(clear_mask, set_mask)
2329    }
2330}
2331
2332impl CookieManagerControlHandle {}
2333
2334#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2335pub struct CookiesIteratorMarker;
2336
2337impl fidl::endpoints::ProtocolMarker for CookiesIteratorMarker {
2338    type Proxy = CookiesIteratorProxy;
2339    type RequestStream = CookiesIteratorRequestStream;
2340    #[cfg(target_os = "fuchsia")]
2341    type SynchronousProxy = CookiesIteratorSynchronousProxy;
2342
2343    const DEBUG_NAME: &'static str = "(anonymous) CookiesIterator";
2344}
2345
2346pub trait CookiesIteratorProxyInterface: Send + Sync {
2347    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Cookie>, fidl::Error>> + Send;
2348    fn r#get_next(&self) -> Self::GetNextResponseFut;
2349}
2350#[derive(Debug)]
2351#[cfg(target_os = "fuchsia")]
2352pub struct CookiesIteratorSynchronousProxy {
2353    client: fidl::client::sync::Client,
2354}
2355
2356#[cfg(target_os = "fuchsia")]
2357impl fidl::endpoints::SynchronousProxy for CookiesIteratorSynchronousProxy {
2358    type Proxy = CookiesIteratorProxy;
2359    type Protocol = CookiesIteratorMarker;
2360
2361    fn from_channel(inner: fidl::Channel) -> Self {
2362        Self::new(inner)
2363    }
2364
2365    fn into_channel(self) -> fidl::Channel {
2366        self.client.into_channel()
2367    }
2368
2369    fn as_channel(&self) -> &fidl::Channel {
2370        self.client.as_channel()
2371    }
2372}
2373
2374#[cfg(target_os = "fuchsia")]
2375impl CookiesIteratorSynchronousProxy {
2376    pub fn new(channel: fidl::Channel) -> Self {
2377        Self { client: fidl::client::sync::Client::new(channel) }
2378    }
2379
2380    pub fn into_channel(self) -> fidl::Channel {
2381        self.client.into_channel()
2382    }
2383
2384    /// Waits until an event arrives and returns it. It is safe for other
2385    /// threads to make concurrent requests while waiting for an event.
2386    pub fn wait_for_event(
2387        &self,
2388        deadline: zx::MonotonicInstant,
2389    ) -> Result<CookiesIteratorEvent, fidl::Error> {
2390        CookiesIteratorEvent::decode(self.client.wait_for_event::<CookiesIteratorMarker>(deadline)?)
2391    }
2392
2393    /// Fetches the next batch of cookies, or of changes to cookies.
2394    /// RFC6265 does not specify an upper-bound on the number of cookies which
2395    /// may be stored.
2396    pub fn r#get_next(
2397        &self,
2398        ___deadline: zx::MonotonicInstant,
2399    ) -> Result<Vec<Cookie>, fidl::Error> {
2400        let _response = self.client.send_query::<
2401            fidl::encoding::EmptyPayload,
2402            CookiesIteratorGetNextResponse,
2403            CookiesIteratorMarker,
2404        >(
2405            (),
2406            0x61b55ebf67ec457d,
2407            fidl::encoding::DynamicFlags::empty(),
2408            ___deadline,
2409        )?;
2410        Ok(_response.changed_cookies)
2411    }
2412}
2413
2414#[cfg(target_os = "fuchsia")]
2415impl From<CookiesIteratorSynchronousProxy> for zx::NullableHandle {
2416    fn from(value: CookiesIteratorSynchronousProxy) -> Self {
2417        value.into_channel().into()
2418    }
2419}
2420
2421#[cfg(target_os = "fuchsia")]
2422impl From<fidl::Channel> for CookiesIteratorSynchronousProxy {
2423    fn from(value: fidl::Channel) -> Self {
2424        Self::new(value)
2425    }
2426}
2427
2428#[cfg(target_os = "fuchsia")]
2429impl fidl::endpoints::FromClient for CookiesIteratorSynchronousProxy {
2430    type Protocol = CookiesIteratorMarker;
2431
2432    fn from_client(value: fidl::endpoints::ClientEnd<CookiesIteratorMarker>) -> Self {
2433        Self::new(value.into_channel())
2434    }
2435}
2436
2437#[derive(Debug, Clone)]
2438pub struct CookiesIteratorProxy {
2439    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2440}
2441
2442impl fidl::endpoints::Proxy for CookiesIteratorProxy {
2443    type Protocol = CookiesIteratorMarker;
2444
2445    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2446        Self::new(inner)
2447    }
2448
2449    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2450        self.client.into_channel().map_err(|client| Self { client })
2451    }
2452
2453    fn as_channel(&self) -> &::fidl::AsyncChannel {
2454        self.client.as_channel()
2455    }
2456}
2457
2458impl CookiesIteratorProxy {
2459    /// Create a new Proxy for fuchsia.web/CookiesIterator.
2460    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2461        let protocol_name = <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2462        Self { client: fidl::client::Client::new(channel, protocol_name) }
2463    }
2464
2465    /// Get a Stream of events from the remote end of the protocol.
2466    ///
2467    /// # Panics
2468    ///
2469    /// Panics if the event stream was already taken.
2470    pub fn take_event_stream(&self) -> CookiesIteratorEventStream {
2471        CookiesIteratorEventStream { event_receiver: self.client.take_event_receiver() }
2472    }
2473
2474    /// Fetches the next batch of cookies, or of changes to cookies.
2475    /// RFC6265 does not specify an upper-bound on the number of cookies which
2476    /// may be stored.
2477    pub fn r#get_next(
2478        &self,
2479    ) -> fidl::client::QueryResponseFut<Vec<Cookie>, fidl::encoding::DefaultFuchsiaResourceDialect>
2480    {
2481        CookiesIteratorProxyInterface::r#get_next(self)
2482    }
2483}
2484
2485impl CookiesIteratorProxyInterface for CookiesIteratorProxy {
2486    type GetNextResponseFut =
2487        fidl::client::QueryResponseFut<Vec<Cookie>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2488    fn r#get_next(&self) -> Self::GetNextResponseFut {
2489        fn _decode(
2490            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2491        ) -> Result<Vec<Cookie>, fidl::Error> {
2492            let _response = fidl::client::decode_transaction_body::<
2493                CookiesIteratorGetNextResponse,
2494                fidl::encoding::DefaultFuchsiaResourceDialect,
2495                0x61b55ebf67ec457d,
2496            >(_buf?)?;
2497            Ok(_response.changed_cookies)
2498        }
2499        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Cookie>>(
2500            (),
2501            0x61b55ebf67ec457d,
2502            fidl::encoding::DynamicFlags::empty(),
2503            _decode,
2504        )
2505    }
2506}
2507
2508pub struct CookiesIteratorEventStream {
2509    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2510}
2511
2512impl std::marker::Unpin for CookiesIteratorEventStream {}
2513
2514impl futures::stream::FusedStream for CookiesIteratorEventStream {
2515    fn is_terminated(&self) -> bool {
2516        self.event_receiver.is_terminated()
2517    }
2518}
2519
2520impl futures::Stream for CookiesIteratorEventStream {
2521    type Item = Result<CookiesIteratorEvent, fidl::Error>;
2522
2523    fn poll_next(
2524        mut self: std::pin::Pin<&mut Self>,
2525        cx: &mut std::task::Context<'_>,
2526    ) -> std::task::Poll<Option<Self::Item>> {
2527        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2528            &mut self.event_receiver,
2529            cx
2530        )?) {
2531            Some(buf) => std::task::Poll::Ready(Some(CookiesIteratorEvent::decode(buf))),
2532            None => std::task::Poll::Ready(None),
2533        }
2534    }
2535}
2536
2537#[derive(Debug)]
2538pub enum CookiesIteratorEvent {}
2539
2540impl CookiesIteratorEvent {
2541    /// Decodes a message buffer as a [`CookiesIteratorEvent`].
2542    fn decode(
2543        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2544    ) -> Result<CookiesIteratorEvent, fidl::Error> {
2545        let (bytes, _handles) = buf.split_mut();
2546        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2547        debug_assert_eq!(tx_header.tx_id, 0);
2548        match tx_header.ordinal {
2549            _ => Err(fidl::Error::UnknownOrdinal {
2550                ordinal: tx_header.ordinal,
2551                protocol_name:
2552                    <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2553            }),
2554        }
2555    }
2556}
2557
2558/// A Stream of incoming requests for fuchsia.web/CookiesIterator.
2559pub struct CookiesIteratorRequestStream {
2560    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2561    is_terminated: bool,
2562}
2563
2564impl std::marker::Unpin for CookiesIteratorRequestStream {}
2565
2566impl futures::stream::FusedStream for CookiesIteratorRequestStream {
2567    fn is_terminated(&self) -> bool {
2568        self.is_terminated
2569    }
2570}
2571
2572impl fidl::endpoints::RequestStream for CookiesIteratorRequestStream {
2573    type Protocol = CookiesIteratorMarker;
2574    type ControlHandle = CookiesIteratorControlHandle;
2575
2576    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2577        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2578    }
2579
2580    fn control_handle(&self) -> Self::ControlHandle {
2581        CookiesIteratorControlHandle { inner: self.inner.clone() }
2582    }
2583
2584    fn into_inner(
2585        self,
2586    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2587    {
2588        (self.inner, self.is_terminated)
2589    }
2590
2591    fn from_inner(
2592        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2593        is_terminated: bool,
2594    ) -> Self {
2595        Self { inner, is_terminated }
2596    }
2597}
2598
2599impl futures::Stream for CookiesIteratorRequestStream {
2600    type Item = Result<CookiesIteratorRequest, fidl::Error>;
2601
2602    fn poll_next(
2603        mut self: std::pin::Pin<&mut Self>,
2604        cx: &mut std::task::Context<'_>,
2605    ) -> std::task::Poll<Option<Self::Item>> {
2606        let this = &mut *self;
2607        if this.inner.check_shutdown(cx) {
2608            this.is_terminated = true;
2609            return std::task::Poll::Ready(None);
2610        }
2611        if this.is_terminated {
2612            panic!("polled CookiesIteratorRequestStream after completion");
2613        }
2614        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2615            |bytes, handles| {
2616                match this.inner.channel().read_etc(cx, bytes, handles) {
2617                    std::task::Poll::Ready(Ok(())) => {}
2618                    std::task::Poll::Pending => return std::task::Poll::Pending,
2619                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2620                        this.is_terminated = true;
2621                        return std::task::Poll::Ready(None);
2622                    }
2623                    std::task::Poll::Ready(Err(e)) => {
2624                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2625                            e.into(),
2626                        ))));
2627                    }
2628                }
2629
2630                // A message has been received from the channel
2631                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2632
2633                std::task::Poll::Ready(Some(match header.ordinal {
2634                    0x61b55ebf67ec457d => {
2635                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2636                        let mut req = fidl::new_empty!(
2637                            fidl::encoding::EmptyPayload,
2638                            fidl::encoding::DefaultFuchsiaResourceDialect
2639                        );
2640                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2641                        let control_handle =
2642                            CookiesIteratorControlHandle { inner: this.inner.clone() };
2643                        Ok(CookiesIteratorRequest::GetNext {
2644                            responder: CookiesIteratorGetNextResponder {
2645                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2646                                tx_id: header.tx_id,
2647                            },
2648                        })
2649                    }
2650                    _ => Err(fidl::Error::UnknownOrdinal {
2651                        ordinal: header.ordinal,
2652                        protocol_name:
2653                            <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2654                    }),
2655                }))
2656            },
2657        )
2658    }
2659}
2660
2661/// Used to iterator over a set of cookies, or a stream of changes to cookies.
2662#[derive(Debug)]
2663pub enum CookiesIteratorRequest {
2664    /// Fetches the next batch of cookies, or of changes to cookies.
2665    /// RFC6265 does not specify an upper-bound on the number of cookies which
2666    /// may be stored.
2667    GetNext { responder: CookiesIteratorGetNextResponder },
2668}
2669
2670impl CookiesIteratorRequest {
2671    #[allow(irrefutable_let_patterns)]
2672    pub fn into_get_next(self) -> Option<(CookiesIteratorGetNextResponder)> {
2673        if let CookiesIteratorRequest::GetNext { responder } = self {
2674            Some((responder))
2675        } else {
2676            None
2677        }
2678    }
2679
2680    /// Name of the method defined in FIDL
2681    pub fn method_name(&self) -> &'static str {
2682        match *self {
2683            CookiesIteratorRequest::GetNext { .. } => "get_next",
2684        }
2685    }
2686}
2687
2688#[derive(Debug, Clone)]
2689pub struct CookiesIteratorControlHandle {
2690    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2691}
2692
2693impl fidl::endpoints::ControlHandle for CookiesIteratorControlHandle {
2694    fn shutdown(&self) {
2695        self.inner.shutdown()
2696    }
2697
2698    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2699        self.inner.shutdown_with_epitaph(status)
2700    }
2701
2702    fn is_closed(&self) -> bool {
2703        self.inner.channel().is_closed()
2704    }
2705    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2706        self.inner.channel().on_closed()
2707    }
2708
2709    #[cfg(target_os = "fuchsia")]
2710    fn signal_peer(
2711        &self,
2712        clear_mask: zx::Signals,
2713        set_mask: zx::Signals,
2714    ) -> Result<(), zx_status::Status> {
2715        use fidl::Peered;
2716        self.inner.channel().signal_peer(clear_mask, set_mask)
2717    }
2718}
2719
2720impl CookiesIteratorControlHandle {}
2721
2722#[must_use = "FIDL methods require a response to be sent"]
2723#[derive(Debug)]
2724pub struct CookiesIteratorGetNextResponder {
2725    control_handle: std::mem::ManuallyDrop<CookiesIteratorControlHandle>,
2726    tx_id: u32,
2727}
2728
2729/// Set the the channel to be shutdown (see [`CookiesIteratorControlHandle::shutdown`])
2730/// if the responder is dropped without sending a response, so that the client
2731/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2732impl std::ops::Drop for CookiesIteratorGetNextResponder {
2733    fn drop(&mut self) {
2734        self.control_handle.shutdown();
2735        // Safety: drops once, never accessed again
2736        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2737    }
2738}
2739
2740impl fidl::endpoints::Responder for CookiesIteratorGetNextResponder {
2741    type ControlHandle = CookiesIteratorControlHandle;
2742
2743    fn control_handle(&self) -> &CookiesIteratorControlHandle {
2744        &self.control_handle
2745    }
2746
2747    fn drop_without_shutdown(mut self) {
2748        // Safety: drops once, never accessed again due to mem::forget
2749        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2750        // Prevent Drop from running (which would shut down the channel)
2751        std::mem::forget(self);
2752    }
2753}
2754
2755impl CookiesIteratorGetNextResponder {
2756    /// Sends a response to the FIDL transaction.
2757    ///
2758    /// Sets the channel to shutdown if an error occurs.
2759    pub fn send(self, mut changed_cookies: Vec<Cookie>) -> Result<(), fidl::Error> {
2760        let _result = self.send_raw(changed_cookies);
2761        if _result.is_err() {
2762            self.control_handle.shutdown();
2763        }
2764        self.drop_without_shutdown();
2765        _result
2766    }
2767
2768    /// Similar to "send" but does not shutdown the channel if an error occurs.
2769    pub fn send_no_shutdown_on_err(
2770        self,
2771        mut changed_cookies: Vec<Cookie>,
2772    ) -> Result<(), fidl::Error> {
2773        let _result = self.send_raw(changed_cookies);
2774        self.drop_without_shutdown();
2775        _result
2776    }
2777
2778    fn send_raw(&self, mut changed_cookies: Vec<Cookie>) -> Result<(), fidl::Error> {
2779        self.control_handle.inner.send::<CookiesIteratorGetNextResponse>(
2780            (changed_cookies.as_mut(),),
2781            self.tx_id,
2782            0x61b55ebf67ec457d,
2783            fidl::encoding::DynamicFlags::empty(),
2784        )
2785    }
2786}
2787
2788#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2789pub struct DebugMarker;
2790
2791impl fidl::endpoints::ProtocolMarker for DebugMarker {
2792    type Proxy = DebugProxy;
2793    type RequestStream = DebugRequestStream;
2794    #[cfg(target_os = "fuchsia")]
2795    type SynchronousProxy = DebugSynchronousProxy;
2796
2797    const DEBUG_NAME: &'static str = "fuchsia.web.Debug";
2798}
2799impl fidl::endpoints::DiscoverableProtocolMarker for DebugMarker {}
2800
2801pub trait DebugProxyInterface: Send + Sync {
2802    type EnableDevToolsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2803    fn r#enable_dev_tools(
2804        &self,
2805        listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2806    ) -> Self::EnableDevToolsResponseFut;
2807}
2808#[derive(Debug)]
2809#[cfg(target_os = "fuchsia")]
2810pub struct DebugSynchronousProxy {
2811    client: fidl::client::sync::Client,
2812}
2813
2814#[cfg(target_os = "fuchsia")]
2815impl fidl::endpoints::SynchronousProxy for DebugSynchronousProxy {
2816    type Proxy = DebugProxy;
2817    type Protocol = DebugMarker;
2818
2819    fn from_channel(inner: fidl::Channel) -> Self {
2820        Self::new(inner)
2821    }
2822
2823    fn into_channel(self) -> fidl::Channel {
2824        self.client.into_channel()
2825    }
2826
2827    fn as_channel(&self) -> &fidl::Channel {
2828        self.client.as_channel()
2829    }
2830}
2831
2832#[cfg(target_os = "fuchsia")]
2833impl DebugSynchronousProxy {
2834    pub fn new(channel: fidl::Channel) -> Self {
2835        Self { client: fidl::client::sync::Client::new(channel) }
2836    }
2837
2838    pub fn into_channel(self) -> fidl::Channel {
2839        self.client.into_channel()
2840    }
2841
2842    /// Waits until an event arrives and returns it. It is safe for other
2843    /// threads to make concurrent requests while waiting for an event.
2844    pub fn wait_for_event(
2845        &self,
2846        deadline: zx::MonotonicInstant,
2847    ) -> Result<DebugEvent, fidl::Error> {
2848        DebugEvent::decode(self.client.wait_for_event::<DebugMarker>(deadline)?)
2849    }
2850
2851    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
2852    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
2853    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
2854    /// this method.
2855    ///
2856    /// Because DevTools debugging is exposed using TCP as its transport, only
2857    /// [`Context`]s created with access to network capabilities will report
2858    /// themselves as available for debugging.
2859    pub fn r#enable_dev_tools(
2860        &self,
2861        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2862        ___deadline: zx::MonotonicInstant,
2863    ) -> Result<(), fidl::Error> {
2864        let _response = self
2865            .client
2866            .send_query::<DebugEnableDevToolsRequest, fidl::encoding::EmptyPayload, DebugMarker>(
2867                (listener,),
2868                0x44b5e1f4e4c548e4,
2869                fidl::encoding::DynamicFlags::empty(),
2870                ___deadline,
2871            )?;
2872        Ok(_response)
2873    }
2874}
2875
2876#[cfg(target_os = "fuchsia")]
2877impl From<DebugSynchronousProxy> for zx::NullableHandle {
2878    fn from(value: DebugSynchronousProxy) -> Self {
2879        value.into_channel().into()
2880    }
2881}
2882
2883#[cfg(target_os = "fuchsia")]
2884impl From<fidl::Channel> for DebugSynchronousProxy {
2885    fn from(value: fidl::Channel) -> Self {
2886        Self::new(value)
2887    }
2888}
2889
2890#[cfg(target_os = "fuchsia")]
2891impl fidl::endpoints::FromClient for DebugSynchronousProxy {
2892    type Protocol = DebugMarker;
2893
2894    fn from_client(value: fidl::endpoints::ClientEnd<DebugMarker>) -> Self {
2895        Self::new(value.into_channel())
2896    }
2897}
2898
2899#[derive(Debug, Clone)]
2900pub struct DebugProxy {
2901    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2902}
2903
2904impl fidl::endpoints::Proxy for DebugProxy {
2905    type Protocol = DebugMarker;
2906
2907    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2908        Self::new(inner)
2909    }
2910
2911    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2912        self.client.into_channel().map_err(|client| Self { client })
2913    }
2914
2915    fn as_channel(&self) -> &::fidl::AsyncChannel {
2916        self.client.as_channel()
2917    }
2918}
2919
2920impl DebugProxy {
2921    /// Create a new Proxy for fuchsia.web/Debug.
2922    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2923        let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2924        Self { client: fidl::client::Client::new(channel, protocol_name) }
2925    }
2926
2927    /// Get a Stream of events from the remote end of the protocol.
2928    ///
2929    /// # Panics
2930    ///
2931    /// Panics if the event stream was already taken.
2932    pub fn take_event_stream(&self) -> DebugEventStream {
2933        DebugEventStream { event_receiver: self.client.take_event_receiver() }
2934    }
2935
2936    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
2937    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
2938    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
2939    /// this method.
2940    ///
2941    /// Because DevTools debugging is exposed using TCP as its transport, only
2942    /// [`Context`]s created with access to network capabilities will report
2943    /// themselves as available for debugging.
2944    pub fn r#enable_dev_tools(
2945        &self,
2946        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2947    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2948        DebugProxyInterface::r#enable_dev_tools(self, listener)
2949    }
2950}
2951
2952impl DebugProxyInterface for DebugProxy {
2953    type EnableDevToolsResponseFut =
2954        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2955    fn r#enable_dev_tools(
2956        &self,
2957        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2958    ) -> Self::EnableDevToolsResponseFut {
2959        fn _decode(
2960            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2961        ) -> Result<(), fidl::Error> {
2962            let _response = fidl::client::decode_transaction_body::<
2963                fidl::encoding::EmptyPayload,
2964                fidl::encoding::DefaultFuchsiaResourceDialect,
2965                0x44b5e1f4e4c548e4,
2966            >(_buf?)?;
2967            Ok(_response)
2968        }
2969        self.client.send_query_and_decode::<DebugEnableDevToolsRequest, ()>(
2970            (listener,),
2971            0x44b5e1f4e4c548e4,
2972            fidl::encoding::DynamicFlags::empty(),
2973            _decode,
2974        )
2975    }
2976}
2977
2978pub struct DebugEventStream {
2979    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2980}
2981
2982impl std::marker::Unpin for DebugEventStream {}
2983
2984impl futures::stream::FusedStream for DebugEventStream {
2985    fn is_terminated(&self) -> bool {
2986        self.event_receiver.is_terminated()
2987    }
2988}
2989
2990impl futures::Stream for DebugEventStream {
2991    type Item = Result<DebugEvent, fidl::Error>;
2992
2993    fn poll_next(
2994        mut self: std::pin::Pin<&mut Self>,
2995        cx: &mut std::task::Context<'_>,
2996    ) -> std::task::Poll<Option<Self::Item>> {
2997        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2998            &mut self.event_receiver,
2999            cx
3000        )?) {
3001            Some(buf) => std::task::Poll::Ready(Some(DebugEvent::decode(buf))),
3002            None => std::task::Poll::Ready(None),
3003        }
3004    }
3005}
3006
3007#[derive(Debug)]
3008pub enum DebugEvent {}
3009
3010impl DebugEvent {
3011    /// Decodes a message buffer as a [`DebugEvent`].
3012    fn decode(
3013        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3014    ) -> Result<DebugEvent, fidl::Error> {
3015        let (bytes, _handles) = buf.split_mut();
3016        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3017        debug_assert_eq!(tx_header.tx_id, 0);
3018        match tx_header.ordinal {
3019            _ => Err(fidl::Error::UnknownOrdinal {
3020                ordinal: tx_header.ordinal,
3021                protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3022            }),
3023        }
3024    }
3025}
3026
3027/// A Stream of incoming requests for fuchsia.web/Debug.
3028pub struct DebugRequestStream {
3029    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3030    is_terminated: bool,
3031}
3032
3033impl std::marker::Unpin for DebugRequestStream {}
3034
3035impl futures::stream::FusedStream for DebugRequestStream {
3036    fn is_terminated(&self) -> bool {
3037        self.is_terminated
3038    }
3039}
3040
3041impl fidl::endpoints::RequestStream for DebugRequestStream {
3042    type Protocol = DebugMarker;
3043    type ControlHandle = DebugControlHandle;
3044
3045    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3046        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3047    }
3048
3049    fn control_handle(&self) -> Self::ControlHandle {
3050        DebugControlHandle { inner: self.inner.clone() }
3051    }
3052
3053    fn into_inner(
3054        self,
3055    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3056    {
3057        (self.inner, self.is_terminated)
3058    }
3059
3060    fn from_inner(
3061        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3062        is_terminated: bool,
3063    ) -> Self {
3064        Self { inner, is_terminated }
3065    }
3066}
3067
3068impl futures::Stream for DebugRequestStream {
3069    type Item = Result<DebugRequest, fidl::Error>;
3070
3071    fn poll_next(
3072        mut self: std::pin::Pin<&mut Self>,
3073        cx: &mut std::task::Context<'_>,
3074    ) -> std::task::Poll<Option<Self::Item>> {
3075        let this = &mut *self;
3076        if this.inner.check_shutdown(cx) {
3077            this.is_terminated = true;
3078            return std::task::Poll::Ready(None);
3079        }
3080        if this.is_terminated {
3081            panic!("polled DebugRequestStream after completion");
3082        }
3083        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3084            |bytes, handles| {
3085                match this.inner.channel().read_etc(cx, bytes, handles) {
3086                    std::task::Poll::Ready(Ok(())) => {}
3087                    std::task::Poll::Pending => return std::task::Poll::Pending,
3088                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3089                        this.is_terminated = true;
3090                        return std::task::Poll::Ready(None);
3091                    }
3092                    std::task::Poll::Ready(Err(e)) => {
3093                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3094                            e.into(),
3095                        ))));
3096                    }
3097                }
3098
3099                // A message has been received from the channel
3100                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3101
3102                std::task::Poll::Ready(Some(match header.ordinal {
3103                    0x44b5e1f4e4c548e4 => {
3104                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3105                        let mut req = fidl::new_empty!(
3106                            DebugEnableDevToolsRequest,
3107                            fidl::encoding::DefaultFuchsiaResourceDialect
3108                        );
3109                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugEnableDevToolsRequest>(&header, _body_bytes, handles, &mut req)?;
3110                        let control_handle = DebugControlHandle { inner: this.inner.clone() };
3111                        Ok(DebugRequest::EnableDevTools {
3112                            listener: req.listener,
3113
3114                            responder: DebugEnableDevToolsResponder {
3115                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3116                                tx_id: header.tx_id,
3117                            },
3118                        })
3119                    }
3120                    _ => Err(fidl::Error::UnknownOrdinal {
3121                        ordinal: header.ordinal,
3122                        protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3123                    }),
3124                }))
3125            },
3126        )
3127    }
3128}
3129
3130/// The debug service which allows to enable the DevTools service on Contexts.
3131#[derive(Debug)]
3132pub enum DebugRequest {
3133    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
3134    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
3135    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
3136    /// this method.
3137    ///
3138    /// Because DevTools debugging is exposed using TCP as its transport, only
3139    /// [`Context`]s created with access to network capabilities will report
3140    /// themselves as available for debugging.
3141    EnableDevTools {
3142        listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
3143        responder: DebugEnableDevToolsResponder,
3144    },
3145}
3146
3147impl DebugRequest {
3148    #[allow(irrefutable_let_patterns)]
3149    pub fn into_enable_dev_tools(
3150        self,
3151    ) -> Option<(fidl::endpoints::ClientEnd<DevToolsListenerMarker>, DebugEnableDevToolsResponder)>
3152    {
3153        if let DebugRequest::EnableDevTools { listener, responder } = self {
3154            Some((listener, responder))
3155        } else {
3156            None
3157        }
3158    }
3159
3160    /// Name of the method defined in FIDL
3161    pub fn method_name(&self) -> &'static str {
3162        match *self {
3163            DebugRequest::EnableDevTools { .. } => "enable_dev_tools",
3164        }
3165    }
3166}
3167
3168#[derive(Debug, Clone)]
3169pub struct DebugControlHandle {
3170    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3171}
3172
3173impl fidl::endpoints::ControlHandle for DebugControlHandle {
3174    fn shutdown(&self) {
3175        self.inner.shutdown()
3176    }
3177
3178    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3179        self.inner.shutdown_with_epitaph(status)
3180    }
3181
3182    fn is_closed(&self) -> bool {
3183        self.inner.channel().is_closed()
3184    }
3185    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3186        self.inner.channel().on_closed()
3187    }
3188
3189    #[cfg(target_os = "fuchsia")]
3190    fn signal_peer(
3191        &self,
3192        clear_mask: zx::Signals,
3193        set_mask: zx::Signals,
3194    ) -> Result<(), zx_status::Status> {
3195        use fidl::Peered;
3196        self.inner.channel().signal_peer(clear_mask, set_mask)
3197    }
3198}
3199
3200impl DebugControlHandle {}
3201
3202#[must_use = "FIDL methods require a response to be sent"]
3203#[derive(Debug)]
3204pub struct DebugEnableDevToolsResponder {
3205    control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
3206    tx_id: u32,
3207}
3208
3209/// Set the the channel to be shutdown (see [`DebugControlHandle::shutdown`])
3210/// if the responder is dropped without sending a response, so that the client
3211/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3212impl std::ops::Drop for DebugEnableDevToolsResponder {
3213    fn drop(&mut self) {
3214        self.control_handle.shutdown();
3215        // Safety: drops once, never accessed again
3216        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3217    }
3218}
3219
3220impl fidl::endpoints::Responder for DebugEnableDevToolsResponder {
3221    type ControlHandle = DebugControlHandle;
3222
3223    fn control_handle(&self) -> &DebugControlHandle {
3224        &self.control_handle
3225    }
3226
3227    fn drop_without_shutdown(mut self) {
3228        // Safety: drops once, never accessed again due to mem::forget
3229        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3230        // Prevent Drop from running (which would shut down the channel)
3231        std::mem::forget(self);
3232    }
3233}
3234
3235impl DebugEnableDevToolsResponder {
3236    /// Sends a response to the FIDL transaction.
3237    ///
3238    /// Sets the channel to shutdown if an error occurs.
3239    pub fn send(self) -> Result<(), fidl::Error> {
3240        let _result = self.send_raw();
3241        if _result.is_err() {
3242            self.control_handle.shutdown();
3243        }
3244        self.drop_without_shutdown();
3245        _result
3246    }
3247
3248    /// Similar to "send" but does not shutdown the channel if an error occurs.
3249    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3250        let _result = self.send_raw();
3251        self.drop_without_shutdown();
3252        _result
3253    }
3254
3255    fn send_raw(&self) -> Result<(), fidl::Error> {
3256        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3257            (),
3258            self.tx_id,
3259            0x44b5e1f4e4c548e4,
3260            fidl::encoding::DynamicFlags::empty(),
3261        )
3262    }
3263}
3264
3265#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3266pub struct DevToolsListenerMarker;
3267
3268impl fidl::endpoints::ProtocolMarker for DevToolsListenerMarker {
3269    type Proxy = DevToolsListenerProxy;
3270    type RequestStream = DevToolsListenerRequestStream;
3271    #[cfg(target_os = "fuchsia")]
3272    type SynchronousProxy = DevToolsListenerSynchronousProxy;
3273
3274    const DEBUG_NAME: &'static str = "(anonymous) DevToolsListener";
3275}
3276
3277pub trait DevToolsListenerProxyInterface: Send + Sync {
3278    fn r#on_context_dev_tools_available(
3279        &self,
3280        listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3281    ) -> Result<(), fidl::Error>;
3282}
3283#[derive(Debug)]
3284#[cfg(target_os = "fuchsia")]
3285pub struct DevToolsListenerSynchronousProxy {
3286    client: fidl::client::sync::Client,
3287}
3288
3289#[cfg(target_os = "fuchsia")]
3290impl fidl::endpoints::SynchronousProxy for DevToolsListenerSynchronousProxy {
3291    type Proxy = DevToolsListenerProxy;
3292    type Protocol = DevToolsListenerMarker;
3293
3294    fn from_channel(inner: fidl::Channel) -> Self {
3295        Self::new(inner)
3296    }
3297
3298    fn into_channel(self) -> fidl::Channel {
3299        self.client.into_channel()
3300    }
3301
3302    fn as_channel(&self) -> &fidl::Channel {
3303        self.client.as_channel()
3304    }
3305}
3306
3307#[cfg(target_os = "fuchsia")]
3308impl DevToolsListenerSynchronousProxy {
3309    pub fn new(channel: fidl::Channel) -> Self {
3310        Self { client: fidl::client::sync::Client::new(channel) }
3311    }
3312
3313    pub fn into_channel(self) -> fidl::Channel {
3314        self.client.into_channel()
3315    }
3316
3317    /// Waits until an event arrives and returns it. It is safe for other
3318    /// threads to make concurrent requests while waiting for an event.
3319    pub fn wait_for_event(
3320        &self,
3321        deadline: zx::MonotonicInstant,
3322    ) -> Result<DevToolsListenerEvent, fidl::Error> {
3323        DevToolsListenerEvent::decode(
3324            self.client.wait_for_event::<DevToolsListenerMarker>(deadline)?,
3325        )
3326    }
3327
3328    /// Called when the DevTools service is available on a new [`Context`].
3329    ///
3330    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3331    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3332    pub fn r#on_context_dev_tools_available(
3333        &self,
3334        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3335    ) -> Result<(), fidl::Error> {
3336        self.client.send::<DevToolsListenerOnContextDevToolsAvailableRequest>(
3337            (listener,),
3338            0x4b259fb4d7e49e87,
3339            fidl::encoding::DynamicFlags::empty(),
3340        )
3341    }
3342}
3343
3344#[cfg(target_os = "fuchsia")]
3345impl From<DevToolsListenerSynchronousProxy> for zx::NullableHandle {
3346    fn from(value: DevToolsListenerSynchronousProxy) -> Self {
3347        value.into_channel().into()
3348    }
3349}
3350
3351#[cfg(target_os = "fuchsia")]
3352impl From<fidl::Channel> for DevToolsListenerSynchronousProxy {
3353    fn from(value: fidl::Channel) -> Self {
3354        Self::new(value)
3355    }
3356}
3357
3358#[cfg(target_os = "fuchsia")]
3359impl fidl::endpoints::FromClient for DevToolsListenerSynchronousProxy {
3360    type Protocol = DevToolsListenerMarker;
3361
3362    fn from_client(value: fidl::endpoints::ClientEnd<DevToolsListenerMarker>) -> Self {
3363        Self::new(value.into_channel())
3364    }
3365}
3366
3367#[derive(Debug, Clone)]
3368pub struct DevToolsListenerProxy {
3369    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3370}
3371
3372impl fidl::endpoints::Proxy for DevToolsListenerProxy {
3373    type Protocol = DevToolsListenerMarker;
3374
3375    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3376        Self::new(inner)
3377    }
3378
3379    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3380        self.client.into_channel().map_err(|client| Self { client })
3381    }
3382
3383    fn as_channel(&self) -> &::fidl::AsyncChannel {
3384        self.client.as_channel()
3385    }
3386}
3387
3388impl DevToolsListenerProxy {
3389    /// Create a new Proxy for fuchsia.web/DevToolsListener.
3390    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3391        let protocol_name = <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3392        Self { client: fidl::client::Client::new(channel, protocol_name) }
3393    }
3394
3395    /// Get a Stream of events from the remote end of the protocol.
3396    ///
3397    /// # Panics
3398    ///
3399    /// Panics if the event stream was already taken.
3400    pub fn take_event_stream(&self) -> DevToolsListenerEventStream {
3401        DevToolsListenerEventStream { event_receiver: self.client.take_event_receiver() }
3402    }
3403
3404    /// Called when the DevTools service is available on a new [`Context`].
3405    ///
3406    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3407    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3408    pub fn r#on_context_dev_tools_available(
3409        &self,
3410        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3411    ) -> Result<(), fidl::Error> {
3412        DevToolsListenerProxyInterface::r#on_context_dev_tools_available(self, listener)
3413    }
3414}
3415
3416impl DevToolsListenerProxyInterface for DevToolsListenerProxy {
3417    fn r#on_context_dev_tools_available(
3418        &self,
3419        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3420    ) -> Result<(), fidl::Error> {
3421        self.client.send::<DevToolsListenerOnContextDevToolsAvailableRequest>(
3422            (listener,),
3423            0x4b259fb4d7e49e87,
3424            fidl::encoding::DynamicFlags::empty(),
3425        )
3426    }
3427}
3428
3429pub struct DevToolsListenerEventStream {
3430    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3431}
3432
3433impl std::marker::Unpin for DevToolsListenerEventStream {}
3434
3435impl futures::stream::FusedStream for DevToolsListenerEventStream {
3436    fn is_terminated(&self) -> bool {
3437        self.event_receiver.is_terminated()
3438    }
3439}
3440
3441impl futures::Stream for DevToolsListenerEventStream {
3442    type Item = Result<DevToolsListenerEvent, fidl::Error>;
3443
3444    fn poll_next(
3445        mut self: std::pin::Pin<&mut Self>,
3446        cx: &mut std::task::Context<'_>,
3447    ) -> std::task::Poll<Option<Self::Item>> {
3448        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3449            &mut self.event_receiver,
3450            cx
3451        )?) {
3452            Some(buf) => std::task::Poll::Ready(Some(DevToolsListenerEvent::decode(buf))),
3453            None => std::task::Poll::Ready(None),
3454        }
3455    }
3456}
3457
3458#[derive(Debug)]
3459pub enum DevToolsListenerEvent {}
3460
3461impl DevToolsListenerEvent {
3462    /// Decodes a message buffer as a [`DevToolsListenerEvent`].
3463    fn decode(
3464        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3465    ) -> Result<DevToolsListenerEvent, fidl::Error> {
3466        let (bytes, _handles) = buf.split_mut();
3467        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3468        debug_assert_eq!(tx_header.tx_id, 0);
3469        match tx_header.ordinal {
3470            _ => Err(fidl::Error::UnknownOrdinal {
3471                ordinal: tx_header.ordinal,
3472                protocol_name:
3473                    <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3474            }),
3475        }
3476    }
3477}
3478
3479/// A Stream of incoming requests for fuchsia.web/DevToolsListener.
3480pub struct DevToolsListenerRequestStream {
3481    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3482    is_terminated: bool,
3483}
3484
3485impl std::marker::Unpin for DevToolsListenerRequestStream {}
3486
3487impl futures::stream::FusedStream for DevToolsListenerRequestStream {
3488    fn is_terminated(&self) -> bool {
3489        self.is_terminated
3490    }
3491}
3492
3493impl fidl::endpoints::RequestStream for DevToolsListenerRequestStream {
3494    type Protocol = DevToolsListenerMarker;
3495    type ControlHandle = DevToolsListenerControlHandle;
3496
3497    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3498        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3499    }
3500
3501    fn control_handle(&self) -> Self::ControlHandle {
3502        DevToolsListenerControlHandle { inner: self.inner.clone() }
3503    }
3504
3505    fn into_inner(
3506        self,
3507    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3508    {
3509        (self.inner, self.is_terminated)
3510    }
3511
3512    fn from_inner(
3513        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3514        is_terminated: bool,
3515    ) -> Self {
3516        Self { inner, is_terminated }
3517    }
3518}
3519
3520impl futures::Stream for DevToolsListenerRequestStream {
3521    type Item = Result<DevToolsListenerRequest, fidl::Error>;
3522
3523    fn poll_next(
3524        mut self: std::pin::Pin<&mut Self>,
3525        cx: &mut std::task::Context<'_>,
3526    ) -> std::task::Poll<Option<Self::Item>> {
3527        let this = &mut *self;
3528        if this.inner.check_shutdown(cx) {
3529            this.is_terminated = true;
3530            return std::task::Poll::Ready(None);
3531        }
3532        if this.is_terminated {
3533            panic!("polled DevToolsListenerRequestStream after completion");
3534        }
3535        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3536            |bytes, handles| {
3537                match this.inner.channel().read_etc(cx, bytes, handles) {
3538                    std::task::Poll::Ready(Ok(())) => {}
3539                    std::task::Poll::Pending => return std::task::Poll::Pending,
3540                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3541                        this.is_terminated = true;
3542                        return std::task::Poll::Ready(None);
3543                    }
3544                    std::task::Poll::Ready(Err(e)) => {
3545                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3546                            e.into(),
3547                        ))));
3548                    }
3549                }
3550
3551                // A message has been received from the channel
3552                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3553
3554                std::task::Poll::Ready(Some(match header.ordinal {
3555                    0x4b259fb4d7e49e87 => {
3556                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3557                        let mut req = fidl::new_empty!(
3558                            DevToolsListenerOnContextDevToolsAvailableRequest,
3559                            fidl::encoding::DefaultFuchsiaResourceDialect
3560                        );
3561                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevToolsListenerOnContextDevToolsAvailableRequest>(&header, _body_bytes, handles, &mut req)?;
3562                        let control_handle =
3563                            DevToolsListenerControlHandle { inner: this.inner.clone() };
3564                        Ok(DevToolsListenerRequest::OnContextDevToolsAvailable {
3565                            listener: req.listener,
3566
3567                            control_handle,
3568                        })
3569                    }
3570                    _ => Err(fidl::Error::UnknownOrdinal {
3571                        ordinal: header.ordinal,
3572                        protocol_name:
3573                            <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3574                    }),
3575                }))
3576            },
3577        )
3578    }
3579}
3580
3581/// Interface used to observe DevTools service availability events.
3582#[derive(Debug)]
3583pub enum DevToolsListenerRequest {
3584    /// Called when the DevTools service is available on a new [`Context`].
3585    ///
3586    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3587    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3588    OnContextDevToolsAvailable {
3589        listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3590        control_handle: DevToolsListenerControlHandle,
3591    },
3592}
3593
3594impl DevToolsListenerRequest {
3595    #[allow(irrefutable_let_patterns)]
3596    pub fn into_on_context_dev_tools_available(
3597        self,
3598    ) -> Option<(
3599        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3600        DevToolsListenerControlHandle,
3601    )> {
3602        if let DevToolsListenerRequest::OnContextDevToolsAvailable { listener, control_handle } =
3603            self
3604        {
3605            Some((listener, control_handle))
3606        } else {
3607            None
3608        }
3609    }
3610
3611    /// Name of the method defined in FIDL
3612    pub fn method_name(&self) -> &'static str {
3613        match *self {
3614            DevToolsListenerRequest::OnContextDevToolsAvailable { .. } => {
3615                "on_context_dev_tools_available"
3616            }
3617        }
3618    }
3619}
3620
3621#[derive(Debug, Clone)]
3622pub struct DevToolsListenerControlHandle {
3623    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3624}
3625
3626impl fidl::endpoints::ControlHandle for DevToolsListenerControlHandle {
3627    fn shutdown(&self) {
3628        self.inner.shutdown()
3629    }
3630
3631    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3632        self.inner.shutdown_with_epitaph(status)
3633    }
3634
3635    fn is_closed(&self) -> bool {
3636        self.inner.channel().is_closed()
3637    }
3638    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3639        self.inner.channel().on_closed()
3640    }
3641
3642    #[cfg(target_os = "fuchsia")]
3643    fn signal_peer(
3644        &self,
3645        clear_mask: zx::Signals,
3646        set_mask: zx::Signals,
3647    ) -> Result<(), zx_status::Status> {
3648        use fidl::Peered;
3649        self.inner.channel().signal_peer(clear_mask, set_mask)
3650    }
3651}
3652
3653impl DevToolsListenerControlHandle {}
3654
3655#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3656pub struct DevToolsPerContextListenerMarker;
3657
3658impl fidl::endpoints::ProtocolMarker for DevToolsPerContextListenerMarker {
3659    type Proxy = DevToolsPerContextListenerProxy;
3660    type RequestStream = DevToolsPerContextListenerRequestStream;
3661    #[cfg(target_os = "fuchsia")]
3662    type SynchronousProxy = DevToolsPerContextListenerSynchronousProxy;
3663
3664    const DEBUG_NAME: &'static str = "(anonymous) DevToolsPerContextListener";
3665}
3666
3667pub trait DevToolsPerContextListenerProxyInterface: Send + Sync {
3668    fn r#on_http_port_open(&self, port: u16) -> Result<(), fidl::Error>;
3669}
3670#[derive(Debug)]
3671#[cfg(target_os = "fuchsia")]
3672pub struct DevToolsPerContextListenerSynchronousProxy {
3673    client: fidl::client::sync::Client,
3674}
3675
3676#[cfg(target_os = "fuchsia")]
3677impl fidl::endpoints::SynchronousProxy for DevToolsPerContextListenerSynchronousProxy {
3678    type Proxy = DevToolsPerContextListenerProxy;
3679    type Protocol = DevToolsPerContextListenerMarker;
3680
3681    fn from_channel(inner: fidl::Channel) -> Self {
3682        Self::new(inner)
3683    }
3684
3685    fn into_channel(self) -> fidl::Channel {
3686        self.client.into_channel()
3687    }
3688
3689    fn as_channel(&self) -> &fidl::Channel {
3690        self.client.as_channel()
3691    }
3692}
3693
3694#[cfg(target_os = "fuchsia")]
3695impl DevToolsPerContextListenerSynchronousProxy {
3696    pub fn new(channel: fidl::Channel) -> Self {
3697        Self { client: fidl::client::sync::Client::new(channel) }
3698    }
3699
3700    pub fn into_channel(self) -> fidl::Channel {
3701        self.client.into_channel()
3702    }
3703
3704    /// Waits until an event arrives and returns it. It is safe for other
3705    /// threads to make concurrent requests while waiting for an event.
3706    pub fn wait_for_event(
3707        &self,
3708        deadline: zx::MonotonicInstant,
3709    ) -> Result<DevToolsPerContextListenerEvent, fidl::Error> {
3710        DevToolsPerContextListenerEvent::decode(
3711            self.client.wait_for_event::<DevToolsPerContextListenerMarker>(deadline)?,
3712        )
3713    }
3714
3715    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3716    /// remain open until the [`Context`] is destroyed.
3717    ///
3718    /// - `port`: The port used by the service.
3719    pub fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3720        self.client.send::<DevToolsPerContextListenerOnHttpPortOpenRequest>(
3721            (port,),
3722            0x5e330939b035553b,
3723            fidl::encoding::DynamicFlags::empty(),
3724        )
3725    }
3726}
3727
3728#[cfg(target_os = "fuchsia")]
3729impl From<DevToolsPerContextListenerSynchronousProxy> for zx::NullableHandle {
3730    fn from(value: DevToolsPerContextListenerSynchronousProxy) -> Self {
3731        value.into_channel().into()
3732    }
3733}
3734
3735#[cfg(target_os = "fuchsia")]
3736impl From<fidl::Channel> for DevToolsPerContextListenerSynchronousProxy {
3737    fn from(value: fidl::Channel) -> Self {
3738        Self::new(value)
3739    }
3740}
3741
3742#[cfg(target_os = "fuchsia")]
3743impl fidl::endpoints::FromClient for DevToolsPerContextListenerSynchronousProxy {
3744    type Protocol = DevToolsPerContextListenerMarker;
3745
3746    fn from_client(value: fidl::endpoints::ClientEnd<DevToolsPerContextListenerMarker>) -> Self {
3747        Self::new(value.into_channel())
3748    }
3749}
3750
3751#[derive(Debug, Clone)]
3752pub struct DevToolsPerContextListenerProxy {
3753    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3754}
3755
3756impl fidl::endpoints::Proxy for DevToolsPerContextListenerProxy {
3757    type Protocol = DevToolsPerContextListenerMarker;
3758
3759    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3760        Self::new(inner)
3761    }
3762
3763    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3764        self.client.into_channel().map_err(|client| Self { client })
3765    }
3766
3767    fn as_channel(&self) -> &::fidl::AsyncChannel {
3768        self.client.as_channel()
3769    }
3770}
3771
3772impl DevToolsPerContextListenerProxy {
3773    /// Create a new Proxy for fuchsia.web/DevToolsPerContextListener.
3774    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3775        let protocol_name =
3776            <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3777        Self { client: fidl::client::Client::new(channel, protocol_name) }
3778    }
3779
3780    /// Get a Stream of events from the remote end of the protocol.
3781    ///
3782    /// # Panics
3783    ///
3784    /// Panics if the event stream was already taken.
3785    pub fn take_event_stream(&self) -> DevToolsPerContextListenerEventStream {
3786        DevToolsPerContextListenerEventStream { event_receiver: self.client.take_event_receiver() }
3787    }
3788
3789    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3790    /// remain open until the [`Context`] is destroyed.
3791    ///
3792    /// - `port`: The port used by the service.
3793    pub fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3794        DevToolsPerContextListenerProxyInterface::r#on_http_port_open(self, port)
3795    }
3796}
3797
3798impl DevToolsPerContextListenerProxyInterface for DevToolsPerContextListenerProxy {
3799    fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3800        self.client.send::<DevToolsPerContextListenerOnHttpPortOpenRequest>(
3801            (port,),
3802            0x5e330939b035553b,
3803            fidl::encoding::DynamicFlags::empty(),
3804        )
3805    }
3806}
3807
3808pub struct DevToolsPerContextListenerEventStream {
3809    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3810}
3811
3812impl std::marker::Unpin for DevToolsPerContextListenerEventStream {}
3813
3814impl futures::stream::FusedStream for DevToolsPerContextListenerEventStream {
3815    fn is_terminated(&self) -> bool {
3816        self.event_receiver.is_terminated()
3817    }
3818}
3819
3820impl futures::Stream for DevToolsPerContextListenerEventStream {
3821    type Item = Result<DevToolsPerContextListenerEvent, fidl::Error>;
3822
3823    fn poll_next(
3824        mut self: std::pin::Pin<&mut Self>,
3825        cx: &mut std::task::Context<'_>,
3826    ) -> std::task::Poll<Option<Self::Item>> {
3827        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3828            &mut self.event_receiver,
3829            cx
3830        )?) {
3831            Some(buf) => std::task::Poll::Ready(Some(DevToolsPerContextListenerEvent::decode(buf))),
3832            None => std::task::Poll::Ready(None),
3833        }
3834    }
3835}
3836
3837#[derive(Debug)]
3838pub enum DevToolsPerContextListenerEvent {}
3839
3840impl DevToolsPerContextListenerEvent {
3841    /// Decodes a message buffer as a [`DevToolsPerContextListenerEvent`].
3842    fn decode(
3843        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3844    ) -> Result<DevToolsPerContextListenerEvent, fidl::Error> {
3845        let (bytes, _handles) = buf.split_mut();
3846        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3847        debug_assert_eq!(tx_header.tx_id, 0);
3848        match tx_header.ordinal {
3849            _ => Err(fidl::Error::UnknownOrdinal {
3850                ordinal: tx_header.ordinal,
3851                protocol_name: <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3852            })
3853        }
3854    }
3855}
3856
3857/// A Stream of incoming requests for fuchsia.web/DevToolsPerContextListener.
3858pub struct DevToolsPerContextListenerRequestStream {
3859    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3860    is_terminated: bool,
3861}
3862
3863impl std::marker::Unpin for DevToolsPerContextListenerRequestStream {}
3864
3865impl futures::stream::FusedStream for DevToolsPerContextListenerRequestStream {
3866    fn is_terminated(&self) -> bool {
3867        self.is_terminated
3868    }
3869}
3870
3871impl fidl::endpoints::RequestStream for DevToolsPerContextListenerRequestStream {
3872    type Protocol = DevToolsPerContextListenerMarker;
3873    type ControlHandle = DevToolsPerContextListenerControlHandle;
3874
3875    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3876        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3877    }
3878
3879    fn control_handle(&self) -> Self::ControlHandle {
3880        DevToolsPerContextListenerControlHandle { inner: self.inner.clone() }
3881    }
3882
3883    fn into_inner(
3884        self,
3885    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3886    {
3887        (self.inner, self.is_terminated)
3888    }
3889
3890    fn from_inner(
3891        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3892        is_terminated: bool,
3893    ) -> Self {
3894        Self { inner, is_terminated }
3895    }
3896}
3897
3898impl futures::Stream for DevToolsPerContextListenerRequestStream {
3899    type Item = Result<DevToolsPerContextListenerRequest, fidl::Error>;
3900
3901    fn poll_next(
3902        mut self: std::pin::Pin<&mut Self>,
3903        cx: &mut std::task::Context<'_>,
3904    ) -> std::task::Poll<Option<Self::Item>> {
3905        let this = &mut *self;
3906        if this.inner.check_shutdown(cx) {
3907            this.is_terminated = true;
3908            return std::task::Poll::Ready(None);
3909        }
3910        if this.is_terminated {
3911            panic!("polled DevToolsPerContextListenerRequestStream after completion");
3912        }
3913        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3914            |bytes, handles| {
3915                match this.inner.channel().read_etc(cx, bytes, handles) {
3916                    std::task::Poll::Ready(Ok(())) => {}
3917                    std::task::Poll::Pending => return std::task::Poll::Pending,
3918                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3919                        this.is_terminated = true;
3920                        return std::task::Poll::Ready(None);
3921                    }
3922                    std::task::Poll::Ready(Err(e)) => {
3923                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3924                            e.into(),
3925                        ))));
3926                    }
3927                }
3928
3929                // A message has been received from the channel
3930                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3931
3932                std::task::Poll::Ready(Some(match header.ordinal {
3933                0x5e330939b035553b => {
3934                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3935                    let mut req = fidl::new_empty!(DevToolsPerContextListenerOnHttpPortOpenRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3936                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevToolsPerContextListenerOnHttpPortOpenRequest>(&header, _body_bytes, handles, &mut req)?;
3937                    let control_handle = DevToolsPerContextListenerControlHandle {
3938                        inner: this.inner.clone(),
3939                    };
3940                    Ok(DevToolsPerContextListenerRequest::OnHttpPortOpen {port: req.port,
3941
3942                        control_handle,
3943                    })
3944                }
3945                _ => Err(fidl::Error::UnknownOrdinal {
3946                    ordinal: header.ordinal,
3947                    protocol_name: <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3948                }),
3949            }))
3950            },
3951        )
3952    }
3953}
3954
3955/// Interface supplied by the debugging component to observe the DevTools service opening event.
3956#[derive(Debug)]
3957pub enum DevToolsPerContextListenerRequest {
3958    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3959    /// remain open until the [`Context`] is destroyed.
3960    ///
3961    /// - `port`: The port used by the service.
3962    OnHttpPortOpen { port: u16, control_handle: DevToolsPerContextListenerControlHandle },
3963}
3964
3965impl DevToolsPerContextListenerRequest {
3966    #[allow(irrefutable_let_patterns)]
3967    pub fn into_on_http_port_open(self) -> Option<(u16, DevToolsPerContextListenerControlHandle)> {
3968        if let DevToolsPerContextListenerRequest::OnHttpPortOpen { port, control_handle } = self {
3969            Some((port, control_handle))
3970        } else {
3971            None
3972        }
3973    }
3974
3975    /// Name of the method defined in FIDL
3976    pub fn method_name(&self) -> &'static str {
3977        match *self {
3978            DevToolsPerContextListenerRequest::OnHttpPortOpen { .. } => "on_http_port_open",
3979        }
3980    }
3981}
3982
3983#[derive(Debug, Clone)]
3984pub struct DevToolsPerContextListenerControlHandle {
3985    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3986}
3987
3988impl fidl::endpoints::ControlHandle for DevToolsPerContextListenerControlHandle {
3989    fn shutdown(&self) {
3990        self.inner.shutdown()
3991    }
3992
3993    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3994        self.inner.shutdown_with_epitaph(status)
3995    }
3996
3997    fn is_closed(&self) -> bool {
3998        self.inner.channel().is_closed()
3999    }
4000    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4001        self.inner.channel().on_closed()
4002    }
4003
4004    #[cfg(target_os = "fuchsia")]
4005    fn signal_peer(
4006        &self,
4007        clear_mask: zx::Signals,
4008        set_mask: zx::Signals,
4009    ) -> Result<(), zx_status::Status> {
4010        use fidl::Peered;
4011        self.inner.channel().signal_peer(clear_mask, set_mask)
4012    }
4013}
4014
4015impl DevToolsPerContextListenerControlHandle {}
4016
4017#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4018pub struct FrameMarker;
4019
4020impl fidl::endpoints::ProtocolMarker for FrameMarker {
4021    type Proxy = FrameProxy;
4022    type RequestStream = FrameRequestStream;
4023    #[cfg(target_os = "fuchsia")]
4024    type SynchronousProxy = FrameSynchronousProxy;
4025
4026    const DEBUG_NAME: &'static str = "(anonymous) Frame";
4027}
4028pub type FrameExecuteJavaScriptResult = Result<fidl_fuchsia_mem::Buffer, FrameError>;
4029pub type FrameExecuteJavaScriptNoResultResult = Result<(), FrameError>;
4030pub type FrameAddBeforeLoadJavaScriptResult = Result<(), FrameError>;
4031pub type FramePostMessageResult = Result<(), FrameError>;
4032
4033pub trait FrameProxyInterface: Send + Sync {
4034    fn r#create_view(
4035        &self,
4036        view_token: fidl_fuchsia_ui_views::ViewToken,
4037    ) -> Result<(), fidl::Error>;
4038    fn r#create_view_with_view_ref(
4039        &self,
4040        view_token: fidl_fuchsia_ui_views::ViewToken,
4041        view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4042        view_ref: fidl_fuchsia_ui_views::ViewRef,
4043    ) -> Result<(), fidl::Error>;
4044    fn r#create_view2(&self, args: CreateView2Args) -> Result<(), fidl::Error>;
4045    fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error>;
4046    fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error>;
4047    fn r#get_media_player(
4048        &self,
4049        player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4050    ) -> Result<(), fidl::Error>;
4051    fn r#get_navigation_controller(
4052        &self,
4053        controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4054    ) -> Result<(), fidl::Error>;
4055    type ExecuteJavaScriptResponseFut: std::future::Future<Output = Result<FrameExecuteJavaScriptResult, fidl::Error>>
4056        + Send;
4057    fn r#execute_java_script(
4058        &self,
4059        origins: &[String],
4060        script: fidl_fuchsia_mem::Buffer,
4061    ) -> Self::ExecuteJavaScriptResponseFut;
4062    type ExecuteJavaScriptNoResultResponseFut: std::future::Future<Output = Result<FrameExecuteJavaScriptNoResultResult, fidl::Error>>
4063        + Send;
4064    fn r#execute_java_script_no_result(
4065        &self,
4066        origins: &[String],
4067        script: fidl_fuchsia_mem::Buffer,
4068    ) -> Self::ExecuteJavaScriptNoResultResponseFut;
4069    type AddBeforeLoadJavaScriptResponseFut: std::future::Future<Output = Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error>>
4070        + Send;
4071    fn r#add_before_load_java_script(
4072        &self,
4073        id: u64,
4074        origins: &[String],
4075        script: fidl_fuchsia_mem::Buffer,
4076    ) -> Self::AddBeforeLoadJavaScriptResponseFut;
4077    fn r#remove_before_load_java_script(&self, id: u64) -> Result<(), fidl::Error>;
4078    type PostMessageResponseFut: std::future::Future<Output = Result<FramePostMessageResult, fidl::Error>>
4079        + Send;
4080    fn r#post_message(
4081        &self,
4082        target_origin: &str,
4083        message: WebMessage,
4084    ) -> Self::PostMessageResponseFut;
4085    fn r#set_navigation_event_listener(
4086        &self,
4087        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4088    ) -> Result<(), fidl::Error>;
4089    fn r#set_navigation_event_listener2(
4090        &self,
4091        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4092        flags: NavigationEventListenerFlags,
4093    ) -> Result<(), fidl::Error>;
4094    fn r#set_java_script_log_level(&self, level: ConsoleLogLevel) -> Result<(), fidl::Error>;
4095    fn r#set_console_log_sink(
4096        &self,
4097        sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4098    ) -> Result<(), fidl::Error>;
4099    fn r#configure_input_types(
4100        &self,
4101        types: InputTypes,
4102        allow: AllowInputState,
4103    ) -> Result<(), fidl::Error>;
4104    fn r#set_popup_frame_creation_listener(
4105        &self,
4106        listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4107    ) -> Result<(), fidl::Error>;
4108    type SetUrlRequestRewriteRulesResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
4109        + Send;
4110    fn r#set_url_request_rewrite_rules(
4111        &self,
4112        rules: &[UrlRequestRewriteRule],
4113    ) -> Self::SetUrlRequestRewriteRulesResponseFut;
4114    fn r#set_media_settings(&self, settings: &FrameMediaSettings) -> Result<(), fidl::Error>;
4115    fn r#force_content_dimensions(
4116        &self,
4117        web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4118    ) -> Result<(), fidl::Error>;
4119    fn r#set_permission_state(
4120        &self,
4121        permission: &PermissionDescriptor,
4122        web_origin: &str,
4123        state: PermissionState,
4124    ) -> Result<(), fidl::Error>;
4125    fn r#set_block_media_loading(&self, blocked: bool) -> Result<(), fidl::Error>;
4126    type GetPrivateMemorySizeResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
4127        + Send;
4128    fn r#get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut;
4129    fn r#set_navigation_policy_provider(
4130        &self,
4131        params: &NavigationPolicyProviderParams,
4132        provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
4133    ) -> Result<(), fidl::Error>;
4134    fn r#set_content_area_settings(
4135        &self,
4136        settings: &ContentAreaSettings,
4137    ) -> Result<(), fidl::Error>;
4138    fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error>;
4139    fn r#close(&self, payload: &FrameCloseRequest) -> Result<(), fidl::Error>;
4140}
4141#[derive(Debug)]
4142#[cfg(target_os = "fuchsia")]
4143pub struct FrameSynchronousProxy {
4144    client: fidl::client::sync::Client,
4145}
4146
4147#[cfg(target_os = "fuchsia")]
4148impl fidl::endpoints::SynchronousProxy for FrameSynchronousProxy {
4149    type Proxy = FrameProxy;
4150    type Protocol = FrameMarker;
4151
4152    fn from_channel(inner: fidl::Channel) -> Self {
4153        Self::new(inner)
4154    }
4155
4156    fn into_channel(self) -> fidl::Channel {
4157        self.client.into_channel()
4158    }
4159
4160    fn as_channel(&self) -> &fidl::Channel {
4161        self.client.as_channel()
4162    }
4163}
4164
4165#[cfg(target_os = "fuchsia")]
4166impl FrameSynchronousProxy {
4167    pub fn new(channel: fidl::Channel) -> Self {
4168        Self { client: fidl::client::sync::Client::new(channel) }
4169    }
4170
4171    pub fn into_channel(self) -> fidl::Channel {
4172        self.client.into_channel()
4173    }
4174
4175    /// Waits until an event arrives and returns it. It is safe for other
4176    /// threads to make concurrent requests while waiting for an event.
4177    pub fn wait_for_event(
4178        &self,
4179        deadline: zx::MonotonicInstant,
4180    ) -> Result<FrameEvent, fidl::Error> {
4181        FrameEvent::decode(self.client.wait_for_event::<FrameMarker>(deadline)?)
4182    }
4183
4184    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4185    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4186    ///
4187    /// See the description of [`CreateContextParams.service_directory`] for additional services
4188    /// that must be present when using this method.
4189    pub fn r#create_view(
4190        &self,
4191        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4192    ) -> Result<(), fidl::Error> {
4193        self.client.send::<FrameCreateViewRequest>(
4194            (&mut view_token,),
4195            0x6a27859439133264,
4196            fidl::encoding::DynamicFlags::empty(),
4197        )
4198    }
4199
4200    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4201    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4202    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
4203    /// track the view.
4204    ///
4205    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
4206    /// and `view_token` will be closed.
4207    ///
4208    /// See the description of [`CreateContextParams.service_directory`] for additional services
4209    /// that must be present when using this method.
4210    pub fn r#create_view_with_view_ref(
4211        &self,
4212        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4213        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4214        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
4215    ) -> Result<(), fidl::Error> {
4216        self.client.send::<FrameCreateViewWithViewRefRequest>(
4217            (&mut view_token, &mut view_ref_control, &mut view_ref),
4218            0x1eb17ab2442326ac,
4219            fidl::encoding::DynamicFlags::empty(),
4220        )
4221    }
4222
4223    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
4224    /// Caller should pass the other end of the token to
4225    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
4226    /// graph.
4227    pub fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
4228        self.client.send::<FrameCreateView2Request>(
4229            (&mut args,),
4230            0x1be7e9512962eb37,
4231            fidl::encoding::DynamicFlags::empty(),
4232        )
4233    }
4234
4235    /// Enables headless rendering of the Frame.
4236    ///
4237    /// This is used when content depends on layout and/or animation events firing normally.
4238    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4239    pub fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
4240        self.client.send::<fidl::encoding::EmptyPayload>(
4241            (),
4242            0x72a81aaae7a80d2b,
4243            fidl::encoding::DynamicFlags::empty(),
4244        )
4245    }
4246
4247    /// Stops headless rendering of the Frame.
4248    ///
4249    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4250    pub fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
4251        self.client.send::<fidl::encoding::EmptyPayload>(
4252            (),
4253            0x5ca38a3d1f7f543a,
4254            fidl::encoding::DynamicFlags::empty(),
4255        )
4256    }
4257
4258    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
4259    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
4260    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
4261    pub fn r#get_media_player(
4262        &self,
4263        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4264    ) -> Result<(), fidl::Error> {
4265        self.client.send::<FrameGetMediaPlayerRequest>(
4266            (player,),
4267            0xaafb639fc0b9eb9,
4268            fidl::encoding::DynamicFlags::empty(),
4269        )
4270    }
4271
4272    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
4273    /// reloaded, etc.
4274    ///
4275    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
4276    ///   [`NavigationController`].
4277    pub fn r#get_navigation_controller(
4278        &self,
4279        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4280    ) -> Result<(), fidl::Error> {
4281        self.client.send::<FrameGetNavigationControllerRequest>(
4282            (controller,),
4283            0x4521cfe95217a688,
4284            fidl::encoding::DynamicFlags::empty(),
4285        )
4286    }
4287
4288    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
4289    /// which matches entries in `origins`.
4290    ///
4291    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4292    /// `origins`, then the script will be evaluated unconditionally.
4293    ///
4294    /// Returns the result of executing `script`, as a JSON-encoded string.
4295    ///
4296    /// Note that scripts share the same execution context as the document,
4297    /// meaning that document may modify variables, classes, or objects set by
4298    /// the script in arbitrary or unpredictable ways.
4299    ///
4300    /// If an error occurred, the FrameError will be set to one of these values:
4301    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4302    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
4303    ///   `origins` or `origins` is an empty vector.
4304    pub fn r#execute_java_script(
4305        &self,
4306        mut origins: &[String],
4307        mut script: fidl_fuchsia_mem::Buffer,
4308        ___deadline: zx::MonotonicInstant,
4309    ) -> Result<FrameExecuteJavaScriptResult, fidl::Error> {
4310        let _response = self.client.send_query::<
4311            FrameExecuteJavaScriptRequest,
4312            fidl::encoding::ResultType<FrameExecuteJavaScriptResponse, FrameError>,
4313            FrameMarker,
4314        >(
4315            (origins, &mut script,),
4316            0x79abdd4907000542,
4317            fidl::encoding::DynamicFlags::empty(),
4318            ___deadline,
4319        )?;
4320        Ok(_response.map(|x| x.result))
4321    }
4322
4323    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
4324    /// a result.
4325    pub fn r#execute_java_script_no_result(
4326        &self,
4327        mut origins: &[String],
4328        mut script: fidl_fuchsia_mem::Buffer,
4329        ___deadline: zx::MonotonicInstant,
4330    ) -> Result<FrameExecuteJavaScriptNoResultResult, fidl::Error> {
4331        let _response = self.client.send_query::<
4332            FrameExecuteJavaScriptNoResultRequest,
4333            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4334            FrameMarker,
4335        >(
4336            (origins, &mut script,),
4337            0x16b8491520cbcd63,
4338            fidl::encoding::DynamicFlags::empty(),
4339            ___deadline,
4340        )?;
4341        Ok(_response.map(|x| x))
4342    }
4343
4344    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
4345    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
4346    /// of the document's scripts.
4347    ///
4348    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
4349    /// using the same `id` will be replaced.
4350    ///
4351    /// The order in which multiple bindings are executed is the same as the order in which the
4352    /// bindings were added. If a script is added which clobbers an existing script of the same
4353    /// `id`, the previous script's precedence in the injection order will be preserved.
4354    ///
4355    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4356    /// `origins`, then the script will be evaluated unconditionally.
4357    ///
4358    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4359    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4360    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4361    pub fn r#add_before_load_java_script(
4362        &self,
4363        mut id: u64,
4364        mut origins: &[String],
4365        mut script: fidl_fuchsia_mem::Buffer,
4366        ___deadline: zx::MonotonicInstant,
4367    ) -> Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error> {
4368        let _response = self.client.send_query::<
4369            FrameAddBeforeLoadJavaScriptRequest,
4370            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4371            FrameMarker,
4372        >(
4373            (id, origins, &mut script,),
4374            0x540ac0da59d823e,
4375            fidl::encoding::DynamicFlags::empty(),
4376            ___deadline,
4377        )?;
4378        Ok(_response.map(|x| x))
4379    }
4380
4381    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
4382    /// is no JavaScript snippet identified by `id`.
4383    pub fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
4384        self.client.send::<FrameRemoveBeforeLoadJavaScriptRequest>(
4385            (id,),
4386            0x17d92b855b61d23a,
4387            fidl::encoding::DynamicFlags::empty(),
4388        )
4389    }
4390
4391    /// Posts a message to the frame's onMessage handler.
4392    ///
4393    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
4394    /// `"*"`, then the message will be sent to the document regardless of its origin.
4395    /// See the
4396    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
4397    /// section 9.4.3 for more details on how the target origin policy is applied.
4398    ///
4399    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4400    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
4401    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
4402    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4403    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
4404    pub fn r#post_message(
4405        &self,
4406        mut target_origin: &str,
4407        mut message: WebMessage,
4408        ___deadline: zx::MonotonicInstant,
4409    ) -> Result<FramePostMessageResult, fidl::Error> {
4410        let _response = self.client.send_query::<
4411            FramePostMessageRequest,
4412            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4413            FrameMarker,
4414        >(
4415            (target_origin, &mut message,),
4416            0x751d686eb7caa341,
4417            fidl::encoding::DynamicFlags::empty(),
4418            ___deadline,
4419        )?;
4420        Ok(_response.map(|x| x))
4421    }
4422
4423    /// Sets the listener for handling page navigation events.
4424    ///
4425    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4426    pub fn r#set_navigation_event_listener(
4427        &self,
4428        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4429    ) -> Result<(), fidl::Error> {
4430        self.client.send::<FrameSetNavigationEventListenerRequest>(
4431            (listener,),
4432            0x965ba0fa20e0a56,
4433            fidl::encoding::DynamicFlags::empty(),
4434        )
4435    }
4436
4437    /// Sets the listener for handling page navigation events. The listener will receive the
4438    /// current navigation state immediately. After that, it's notified whenever the state changes.
4439    ///
4440    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4441    /// - `flags`: Flags for optional features that should be enabled for the listener.
4442    pub fn r#set_navigation_event_listener2(
4443        &self,
4444        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4445        mut flags: NavigationEventListenerFlags,
4446    ) -> Result<(), fidl::Error> {
4447        self.client.send::<FrameSetNavigationEventListener2Request>(
4448            (listener, flags),
4449            0x5f8b40607f1f578f,
4450            fidl::encoding::DynamicFlags::empty(),
4451        )
4452    }
4453
4454    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
4455    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
4456    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
4457    /// `error()`).
4458    /// The default value is [`ConsoleLogLevel.NONE`].
4459    ///
4460    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
4461    /// in Incognito and other private browsing modes.
4462    ///
4463    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
4464    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
4465    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
4466    ///   severity.
4467    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
4468    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
4469    pub fn r#set_java_script_log_level(
4470        &self,
4471        mut level: ConsoleLogLevel,
4472    ) -> Result<(), fidl::Error> {
4473        self.client.send::<FrameSetJavaScriptLogLevelRequest>(
4474            (level,),
4475            0x74824b11a71c4b5b,
4476            fidl::encoding::DynamicFlags::empty(),
4477        )
4478    }
4479
4480    /// Specifies where to emit `console` log output to. By default log output will be routed to a
4481    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
4482    ///
4483    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
4484    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
4485    pub fn r#set_console_log_sink(
4486        &self,
4487        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4488    ) -> Result<(), fidl::Error> {
4489        self.client.send::<FrameSetConsoleLogSinkRequest>(
4490            (sink,),
4491            0x18f5cbc19fa4687b,
4492            fidl::encoding::DynamicFlags::empty(),
4493        )
4494    }
4495
4496    /// Enables or disables the processing of the specified `types` of user inputs.
4497    /// `allow` specifies whether to enable or disable the specified `types`.
4498    /// All input types are enabled by default.
4499    pub fn r#configure_input_types(
4500        &self,
4501        mut types: InputTypes,
4502        mut allow: AllowInputState,
4503    ) -> Result<(), fidl::Error> {
4504        self.client.send::<FrameConfigureInputTypesRequest>(
4505            (types, allow),
4506            0x38e08fe763c6bef6,
4507            fidl::encoding::DynamicFlags::empty(),
4508        )
4509    }
4510
4511    /// Sets the listener for handling popup frame opened by web content. If no listener is
4512    /// present, then any new popup frame will be blocked.
4513    ///
4514    /// - `listener`: The listener to use. Unregisters any existing listener if null.
4515    pub fn r#set_popup_frame_creation_listener(
4516        &self,
4517        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4518    ) -> Result<(), fidl::Error> {
4519        self.client.send::<FrameSetPopupFrameCreationListenerRequest>(
4520            (listener,),
4521            0x34ddec4e9f11e2aa,
4522            fidl::encoding::DynamicFlags::empty(),
4523        )
4524    }
4525
4526    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
4527    /// - `rules` are cumulative and applied in order.
4528    /// - `rules` are only applied on the first URL request in a redirect chain.
4529    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
4530    ///   will be closed with `ERR_INVALID_ARGS`.
4531    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
4532    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
4533    ///   `ERR_BAD_STATE`.
4534    pub fn r#set_url_request_rewrite_rules(
4535        &self,
4536        mut rules: &[UrlRequestRewriteRule],
4537        ___deadline: zx::MonotonicInstant,
4538    ) -> Result<(), fidl::Error> {
4539        let _response = self.client.send_query::<
4540            FrameSetUrlRequestRewriteRulesRequest,
4541            fidl::encoding::EmptyPayload,
4542            FrameMarker,
4543        >(
4544            (rules,),
4545            0x2e3f797350ab3281,
4546            fidl::encoding::DynamicFlags::empty(),
4547            ___deadline,
4548        )?;
4549        Ok(_response)
4550    }
4551
4552    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
4553    /// applied to audio streams that started after this message is processed. Should be called
4554    /// before the Frame is navigated to content in order to ensure that the settings applied to
4555    /// all media streams. Due to request pipelining, this means doing so before calling
4556    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
4557    pub fn r#set_media_settings(
4558        &self,
4559        mut settings: &FrameMediaSettings,
4560    ) -> Result<(), fidl::Error> {
4561        self.client.send::<FrameSetMediaSettingsRequest>(
4562            (settings,),
4563            0x7da879b6d284c143,
4564            fidl::encoding::DynamicFlags::empty(),
4565        )
4566    }
4567
4568    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
4569    /// web content will be adjusted in response to changes in the pixel size of the View,
4570    /// rather than changing the size reported to the content. Call with null `web_dips` to
4571    /// remove any prior forced content dimensions.
4572    pub fn r#force_content_dimensions(
4573        &self,
4574        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4575    ) -> Result<(), fidl::Error> {
4576        self.client.send::<FrameForceContentDimensionsRequest>(
4577            (web_dips,),
4578            0x8c7024c7149c901,
4579            fidl::encoding::DynamicFlags::empty(),
4580        )
4581    }
4582
4583    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
4584    /// permissions are denied.
4585    pub fn r#set_permission_state(
4586        &self,
4587        mut permission: &PermissionDescriptor,
4588        mut web_origin: &str,
4589        mut state: PermissionState,
4590    ) -> Result<(), fidl::Error> {
4591        self.client.send::<FrameSetPermissionStateRequest>(
4592            (permission, web_origin, state),
4593            0x19574e92a7033f4f,
4594            fidl::encoding::DynamicFlags::empty(),
4595        )
4596    }
4597
4598    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
4599    /// resources.
4600    ///
4601    /// May be used, for example, to prevent loading media in frames that are not visible.
4602    ///
4603    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
4604    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
4605    /// unblocked by a call to this method.
4606    ///
4607    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
4608    /// playing as appropriate.
4609    ///
4610    /// Any elements that have begun fetching or loading media resources for the current source
4611    /// before media loading was blocked will continue to fetch, load, and start playback as
4612    /// appropriate. This includes calls to `play()` even after media loading is blocked.
4613    pub fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
4614        self.client.send::<FrameSetBlockMediaLoadingRequest>(
4615            (blocked,),
4616            0x211071458fc9cf4f,
4617            fidl::encoding::DynamicFlags::empty(),
4618        )
4619    }
4620
4621    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
4622    /// document. The returned size might not reflect the memory usage of embedded iframes.
4623    pub fn r#get_private_memory_size(
4624        &self,
4625        ___deadline: zx::MonotonicInstant,
4626    ) -> Result<u64, fidl::Error> {
4627        let _response = self.client.send_query::<
4628            fidl::encoding::EmptyPayload,
4629            FrameGetPrivateMemorySizeResponse,
4630            FrameMarker,
4631        >(
4632            (),
4633            0x6ad4d43da6c129b0,
4634            fidl::encoding::DynamicFlags::empty(),
4635            ___deadline,
4636        )?;
4637        Ok(_response.size_bytes)
4638    }
4639
4640    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
4641    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
4642    /// requests. `params` defines when the message is sent. After sending the
4643    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
4644    /// until it receives a response.
4645    ///
4646    /// Should be called before `GetNavigationController` to ensure that it is applied to all
4647    /// navigations including the first [`NavigationController.LoadURL`] request.
4648    pub fn r#set_navigation_policy_provider(
4649        &self,
4650        mut params: &NavigationPolicyProviderParams,
4651        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
4652    ) -> Result<(), fidl::Error> {
4653        self.client.send::<FrameSetNavigationPolicyProviderRequest>(
4654            (params, provider),
4655            0x602ce35195d66654,
4656            fidl::encoding::DynamicFlags::empty(),
4657        )
4658    }
4659
4660    /// Sets various settings for how web content should be run in the Frame. May be called at any
4661    /// time, including after the URL has loaded. Each call changes only the specified fields,
4662    /// overwriting any prior value.
4663    ///
4664    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
4665    /// is not supported by the Frame.
4666    pub fn r#set_content_area_settings(
4667        &self,
4668        mut settings: &ContentAreaSettings,
4669    ) -> Result<(), fidl::Error> {
4670        self.client.send::<FrameSetContentAreaSettingsRequest>(
4671            (settings,),
4672            0x851f4de50c3c27e,
4673            fidl::encoding::DynamicFlags::empty(),
4674        )
4675    }
4676
4677    /// Reset the Frame's [`ContentAreaSettings`] to default values.
4678    pub fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
4679        self.client.send::<fidl::encoding::EmptyPayload>(
4680            (),
4681            0x6807e04f16f8ee5d,
4682            fidl::encoding::DynamicFlags::empty(),
4683        )
4684    }
4685
4686    /// Request graceful or immediate teardown of the Frame content and notification of completion
4687    /// via Frame epitaph.
4688    ///
4689    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
4690    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
4691    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
4692    /// content to run event handlers.
4693    ///
4694    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
4695    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
4696    ///
4697    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
4698    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
4699    ///   otherwise.
4700    ///
4701    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
4702    ///
4703    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
4704    pub fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
4705        self.client.send::<FrameCloseRequest>(
4706            payload,
4707            0x442e84138e65351,
4708            fidl::encoding::DynamicFlags::empty(),
4709        )
4710    }
4711}
4712
4713#[cfg(target_os = "fuchsia")]
4714impl From<FrameSynchronousProxy> for zx::NullableHandle {
4715    fn from(value: FrameSynchronousProxy) -> Self {
4716        value.into_channel().into()
4717    }
4718}
4719
4720#[cfg(target_os = "fuchsia")]
4721impl From<fidl::Channel> for FrameSynchronousProxy {
4722    fn from(value: fidl::Channel) -> Self {
4723        Self::new(value)
4724    }
4725}
4726
4727#[cfg(target_os = "fuchsia")]
4728impl fidl::endpoints::FromClient for FrameSynchronousProxy {
4729    type Protocol = FrameMarker;
4730
4731    fn from_client(value: fidl::endpoints::ClientEnd<FrameMarker>) -> Self {
4732        Self::new(value.into_channel())
4733    }
4734}
4735
4736#[derive(Debug, Clone)]
4737pub struct FrameProxy {
4738    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4739}
4740
4741impl fidl::endpoints::Proxy for FrameProxy {
4742    type Protocol = FrameMarker;
4743
4744    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4745        Self::new(inner)
4746    }
4747
4748    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4749        self.client.into_channel().map_err(|client| Self { client })
4750    }
4751
4752    fn as_channel(&self) -> &::fidl::AsyncChannel {
4753        self.client.as_channel()
4754    }
4755}
4756
4757impl FrameProxy {
4758    /// Create a new Proxy for fuchsia.web/Frame.
4759    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4760        let protocol_name = <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4761        Self { client: fidl::client::Client::new(channel, protocol_name) }
4762    }
4763
4764    /// Get a Stream of events from the remote end of the protocol.
4765    ///
4766    /// # Panics
4767    ///
4768    /// Panics if the event stream was already taken.
4769    pub fn take_event_stream(&self) -> FrameEventStream {
4770        FrameEventStream { event_receiver: self.client.take_event_receiver() }
4771    }
4772
4773    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4774    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4775    ///
4776    /// See the description of [`CreateContextParams.service_directory`] for additional services
4777    /// that must be present when using this method.
4778    pub fn r#create_view(
4779        &self,
4780        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4781    ) -> Result<(), fidl::Error> {
4782        FrameProxyInterface::r#create_view(self, view_token)
4783    }
4784
4785    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4786    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4787    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
4788    /// track the view.
4789    ///
4790    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
4791    /// and `view_token` will be closed.
4792    ///
4793    /// See the description of [`CreateContextParams.service_directory`] for additional services
4794    /// that must be present when using this method.
4795    pub fn r#create_view_with_view_ref(
4796        &self,
4797        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4798        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4799        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
4800    ) -> Result<(), fidl::Error> {
4801        FrameProxyInterface::r#create_view_with_view_ref(
4802            self,
4803            view_token,
4804            view_ref_control,
4805            view_ref,
4806        )
4807    }
4808
4809    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
4810    /// Caller should pass the other end of the token to
4811    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
4812    /// graph.
4813    pub fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
4814        FrameProxyInterface::r#create_view2(self, args)
4815    }
4816
4817    /// Enables headless rendering of the Frame.
4818    ///
4819    /// This is used when content depends on layout and/or animation events firing normally.
4820    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4821    pub fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
4822        FrameProxyInterface::r#enable_headless_rendering(self)
4823    }
4824
4825    /// Stops headless rendering of the Frame.
4826    ///
4827    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4828    pub fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
4829        FrameProxyInterface::r#disable_headless_rendering(self)
4830    }
4831
4832    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
4833    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
4834    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
4835    pub fn r#get_media_player(
4836        &self,
4837        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4838    ) -> Result<(), fidl::Error> {
4839        FrameProxyInterface::r#get_media_player(self, player)
4840    }
4841
4842    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
4843    /// reloaded, etc.
4844    ///
4845    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
4846    ///   [`NavigationController`].
4847    pub fn r#get_navigation_controller(
4848        &self,
4849        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4850    ) -> Result<(), fidl::Error> {
4851        FrameProxyInterface::r#get_navigation_controller(self, controller)
4852    }
4853
4854    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
4855    /// which matches entries in `origins`.
4856    ///
4857    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4858    /// `origins`, then the script will be evaluated unconditionally.
4859    ///
4860    /// Returns the result of executing `script`, as a JSON-encoded string.
4861    ///
4862    /// Note that scripts share the same execution context as the document,
4863    /// meaning that document may modify variables, classes, or objects set by
4864    /// the script in arbitrary or unpredictable ways.
4865    ///
4866    /// If an error occurred, the FrameError will be set to one of these values:
4867    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4868    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
4869    ///   `origins` or `origins` is an empty vector.
4870    pub fn r#execute_java_script(
4871        &self,
4872        mut origins: &[String],
4873        mut script: fidl_fuchsia_mem::Buffer,
4874    ) -> fidl::client::QueryResponseFut<
4875        FrameExecuteJavaScriptResult,
4876        fidl::encoding::DefaultFuchsiaResourceDialect,
4877    > {
4878        FrameProxyInterface::r#execute_java_script(self, origins, script)
4879    }
4880
4881    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
4882    /// a result.
4883    pub fn r#execute_java_script_no_result(
4884        &self,
4885        mut origins: &[String],
4886        mut script: fidl_fuchsia_mem::Buffer,
4887    ) -> fidl::client::QueryResponseFut<
4888        FrameExecuteJavaScriptNoResultResult,
4889        fidl::encoding::DefaultFuchsiaResourceDialect,
4890    > {
4891        FrameProxyInterface::r#execute_java_script_no_result(self, origins, script)
4892    }
4893
4894    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
4895    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
4896    /// of the document's scripts.
4897    ///
4898    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
4899    /// using the same `id` will be replaced.
4900    ///
4901    /// The order in which multiple bindings are executed is the same as the order in which the
4902    /// bindings were added. If a script is added which clobbers an existing script of the same
4903    /// `id`, the previous script's precedence in the injection order will be preserved.
4904    ///
4905    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4906    /// `origins`, then the script will be evaluated unconditionally.
4907    ///
4908    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4909    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4910    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4911    pub fn r#add_before_load_java_script(
4912        &self,
4913        mut id: u64,
4914        mut origins: &[String],
4915        mut script: fidl_fuchsia_mem::Buffer,
4916    ) -> fidl::client::QueryResponseFut<
4917        FrameAddBeforeLoadJavaScriptResult,
4918        fidl::encoding::DefaultFuchsiaResourceDialect,
4919    > {
4920        FrameProxyInterface::r#add_before_load_java_script(self, id, origins, script)
4921    }
4922
4923    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
4924    /// is no JavaScript snippet identified by `id`.
4925    pub fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
4926        FrameProxyInterface::r#remove_before_load_java_script(self, id)
4927    }
4928
4929    /// Posts a message to the frame's onMessage handler.
4930    ///
4931    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
4932    /// `"*"`, then the message will be sent to the document regardless of its origin.
4933    /// See the
4934    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
4935    /// section 9.4.3 for more details on how the target origin policy is applied.
4936    ///
4937    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4938    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
4939    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
4940    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4941    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
4942    pub fn r#post_message(
4943        &self,
4944        mut target_origin: &str,
4945        mut message: WebMessage,
4946    ) -> fidl::client::QueryResponseFut<
4947        FramePostMessageResult,
4948        fidl::encoding::DefaultFuchsiaResourceDialect,
4949    > {
4950        FrameProxyInterface::r#post_message(self, target_origin, message)
4951    }
4952
4953    /// Sets the listener for handling page navigation events.
4954    ///
4955    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4956    pub fn r#set_navigation_event_listener(
4957        &self,
4958        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4959    ) -> Result<(), fidl::Error> {
4960        FrameProxyInterface::r#set_navigation_event_listener(self, listener)
4961    }
4962
4963    /// Sets the listener for handling page navigation events. The listener will receive the
4964    /// current navigation state immediately. After that, it's notified whenever the state changes.
4965    ///
4966    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4967    /// - `flags`: Flags for optional features that should be enabled for the listener.
4968    pub fn r#set_navigation_event_listener2(
4969        &self,
4970        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4971        mut flags: NavigationEventListenerFlags,
4972    ) -> Result<(), fidl::Error> {
4973        FrameProxyInterface::r#set_navigation_event_listener2(self, listener, flags)
4974    }
4975
4976    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
4977    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
4978    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
4979    /// `error()`).
4980    /// The default value is [`ConsoleLogLevel.NONE`].
4981    ///
4982    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
4983    /// in Incognito and other private browsing modes.
4984    ///
4985    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
4986    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
4987    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
4988    ///   severity.
4989    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
4990    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
4991    pub fn r#set_java_script_log_level(
4992        &self,
4993        mut level: ConsoleLogLevel,
4994    ) -> Result<(), fidl::Error> {
4995        FrameProxyInterface::r#set_java_script_log_level(self, level)
4996    }
4997
4998    /// Specifies where to emit `console` log output to. By default log output will be routed to a
4999    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
5000    ///
5001    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
5002    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
5003    pub fn r#set_console_log_sink(
5004        &self,
5005        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
5006    ) -> Result<(), fidl::Error> {
5007        FrameProxyInterface::r#set_console_log_sink(self, sink)
5008    }
5009
5010    /// Enables or disables the processing of the specified `types` of user inputs.
5011    /// `allow` specifies whether to enable or disable the specified `types`.
5012    /// All input types are enabled by default.
5013    pub fn r#configure_input_types(
5014        &self,
5015        mut types: InputTypes,
5016        mut allow: AllowInputState,
5017    ) -> Result<(), fidl::Error> {
5018        FrameProxyInterface::r#configure_input_types(self, types, allow)
5019    }
5020
5021    /// Sets the listener for handling popup frame opened by web content. If no listener is
5022    /// present, then any new popup frame will be blocked.
5023    ///
5024    /// - `listener`: The listener to use. Unregisters any existing listener if null.
5025    pub fn r#set_popup_frame_creation_listener(
5026        &self,
5027        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
5028    ) -> Result<(), fidl::Error> {
5029        FrameProxyInterface::r#set_popup_frame_creation_listener(self, listener)
5030    }
5031
5032    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
5033    /// - `rules` are cumulative and applied in order.
5034    /// - `rules` are only applied on the first URL request in a redirect chain.
5035    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
5036    ///   will be closed with `ERR_INVALID_ARGS`.
5037    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
5038    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
5039    ///   `ERR_BAD_STATE`.
5040    pub fn r#set_url_request_rewrite_rules(
5041        &self,
5042        mut rules: &[UrlRequestRewriteRule],
5043    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5044        FrameProxyInterface::r#set_url_request_rewrite_rules(self, rules)
5045    }
5046
5047    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
5048    /// applied to audio streams that started after this message is processed. Should be called
5049    /// before the Frame is navigated to content in order to ensure that the settings applied to
5050    /// all media streams. Due to request pipelining, this means doing so before calling
5051    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
5052    pub fn r#set_media_settings(
5053        &self,
5054        mut settings: &FrameMediaSettings,
5055    ) -> Result<(), fidl::Error> {
5056        FrameProxyInterface::r#set_media_settings(self, settings)
5057    }
5058
5059    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
5060    /// web content will be adjusted in response to changes in the pixel size of the View,
5061    /// rather than changing the size reported to the content. Call with null `web_dips` to
5062    /// remove any prior forced content dimensions.
5063    pub fn r#force_content_dimensions(
5064        &self,
5065        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
5066    ) -> Result<(), fidl::Error> {
5067        FrameProxyInterface::r#force_content_dimensions(self, web_dips)
5068    }
5069
5070    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
5071    /// permissions are denied.
5072    pub fn r#set_permission_state(
5073        &self,
5074        mut permission: &PermissionDescriptor,
5075        mut web_origin: &str,
5076        mut state: PermissionState,
5077    ) -> Result<(), fidl::Error> {
5078        FrameProxyInterface::r#set_permission_state(self, permission, web_origin, state)
5079    }
5080
5081    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
5082    /// resources.
5083    ///
5084    /// May be used, for example, to prevent loading media in frames that are not visible.
5085    ///
5086    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
5087    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
5088    /// unblocked by a call to this method.
5089    ///
5090    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
5091    /// playing as appropriate.
5092    ///
5093    /// Any elements that have begun fetching or loading media resources for the current source
5094    /// before media loading was blocked will continue to fetch, load, and start playback as
5095    /// appropriate. This includes calls to `play()` even after media loading is blocked.
5096    pub fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
5097        FrameProxyInterface::r#set_block_media_loading(self, blocked)
5098    }
5099
5100    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
5101    /// document. The returned size might not reflect the memory usage of embedded iframes.
5102    pub fn r#get_private_memory_size(
5103        &self,
5104    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
5105        FrameProxyInterface::r#get_private_memory_size(self)
5106    }
5107
5108    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
5109    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
5110    /// requests. `params` defines when the message is sent. After sending the
5111    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
5112    /// until it receives a response.
5113    ///
5114    /// Should be called before `GetNavigationController` to ensure that it is applied to all
5115    /// navigations including the first [`NavigationController.LoadURL`] request.
5116    pub fn r#set_navigation_policy_provider(
5117        &self,
5118        mut params: &NavigationPolicyProviderParams,
5119        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
5120    ) -> Result<(), fidl::Error> {
5121        FrameProxyInterface::r#set_navigation_policy_provider(self, params, provider)
5122    }
5123
5124    /// Sets various settings for how web content should be run in the Frame. May be called at any
5125    /// time, including after the URL has loaded. Each call changes only the specified fields,
5126    /// overwriting any prior value.
5127    ///
5128    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
5129    /// is not supported by the Frame.
5130    pub fn r#set_content_area_settings(
5131        &self,
5132        mut settings: &ContentAreaSettings,
5133    ) -> Result<(), fidl::Error> {
5134        FrameProxyInterface::r#set_content_area_settings(self, settings)
5135    }
5136
5137    /// Reset the Frame's [`ContentAreaSettings`] to default values.
5138    pub fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
5139        FrameProxyInterface::r#reset_content_area_settings(self)
5140    }
5141
5142    /// Request graceful or immediate teardown of the Frame content and notification of completion
5143    /// via Frame epitaph.
5144    ///
5145    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
5146    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
5147    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
5148    /// content to run event handlers.
5149    ///
5150    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
5151    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
5152    ///
5153    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
5154    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
5155    ///   otherwise.
5156    ///
5157    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
5158    ///
5159    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
5160    pub fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
5161        FrameProxyInterface::r#close(self, payload)
5162    }
5163}
5164
5165impl FrameProxyInterface for FrameProxy {
5166    fn r#create_view(
5167        &self,
5168        mut view_token: fidl_fuchsia_ui_views::ViewToken,
5169    ) -> Result<(), fidl::Error> {
5170        self.client.send::<FrameCreateViewRequest>(
5171            (&mut view_token,),
5172            0x6a27859439133264,
5173            fidl::encoding::DynamicFlags::empty(),
5174        )
5175    }
5176
5177    fn r#create_view_with_view_ref(
5178        &self,
5179        mut view_token: fidl_fuchsia_ui_views::ViewToken,
5180        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
5181        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
5182    ) -> Result<(), fidl::Error> {
5183        self.client.send::<FrameCreateViewWithViewRefRequest>(
5184            (&mut view_token, &mut view_ref_control, &mut view_ref),
5185            0x1eb17ab2442326ac,
5186            fidl::encoding::DynamicFlags::empty(),
5187        )
5188    }
5189
5190    fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
5191        self.client.send::<FrameCreateView2Request>(
5192            (&mut args,),
5193            0x1be7e9512962eb37,
5194            fidl::encoding::DynamicFlags::empty(),
5195        )
5196    }
5197
5198    fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
5199        self.client.send::<fidl::encoding::EmptyPayload>(
5200            (),
5201            0x72a81aaae7a80d2b,
5202            fidl::encoding::DynamicFlags::empty(),
5203        )
5204    }
5205
5206    fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
5207        self.client.send::<fidl::encoding::EmptyPayload>(
5208            (),
5209            0x5ca38a3d1f7f543a,
5210            fidl::encoding::DynamicFlags::empty(),
5211        )
5212    }
5213
5214    fn r#get_media_player(
5215        &self,
5216        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
5217    ) -> Result<(), fidl::Error> {
5218        self.client.send::<FrameGetMediaPlayerRequest>(
5219            (player,),
5220            0xaafb639fc0b9eb9,
5221            fidl::encoding::DynamicFlags::empty(),
5222        )
5223    }
5224
5225    fn r#get_navigation_controller(
5226        &self,
5227        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
5228    ) -> Result<(), fidl::Error> {
5229        self.client.send::<FrameGetNavigationControllerRequest>(
5230            (controller,),
5231            0x4521cfe95217a688,
5232            fidl::encoding::DynamicFlags::empty(),
5233        )
5234    }
5235
5236    type ExecuteJavaScriptResponseFut = fidl::client::QueryResponseFut<
5237        FrameExecuteJavaScriptResult,
5238        fidl::encoding::DefaultFuchsiaResourceDialect,
5239    >;
5240    fn r#execute_java_script(
5241        &self,
5242        mut origins: &[String],
5243        mut script: fidl_fuchsia_mem::Buffer,
5244    ) -> Self::ExecuteJavaScriptResponseFut {
5245        fn _decode(
5246            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5247        ) -> Result<FrameExecuteJavaScriptResult, fidl::Error> {
5248            let _response = fidl::client::decode_transaction_body::<
5249                fidl::encoding::ResultType<FrameExecuteJavaScriptResponse, FrameError>,
5250                fidl::encoding::DefaultFuchsiaResourceDialect,
5251                0x79abdd4907000542,
5252            >(_buf?)?;
5253            Ok(_response.map(|x| x.result))
5254        }
5255        self.client
5256            .send_query_and_decode::<FrameExecuteJavaScriptRequest, FrameExecuteJavaScriptResult>(
5257                (origins, &mut script),
5258                0x79abdd4907000542,
5259                fidl::encoding::DynamicFlags::empty(),
5260                _decode,
5261            )
5262    }
5263
5264    type ExecuteJavaScriptNoResultResponseFut = fidl::client::QueryResponseFut<
5265        FrameExecuteJavaScriptNoResultResult,
5266        fidl::encoding::DefaultFuchsiaResourceDialect,
5267    >;
5268    fn r#execute_java_script_no_result(
5269        &self,
5270        mut origins: &[String],
5271        mut script: fidl_fuchsia_mem::Buffer,
5272    ) -> Self::ExecuteJavaScriptNoResultResponseFut {
5273        fn _decode(
5274            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5275        ) -> Result<FrameExecuteJavaScriptNoResultResult, fidl::Error> {
5276            let _response = fidl::client::decode_transaction_body::<
5277                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5278                fidl::encoding::DefaultFuchsiaResourceDialect,
5279                0x16b8491520cbcd63,
5280            >(_buf?)?;
5281            Ok(_response.map(|x| x))
5282        }
5283        self.client.send_query_and_decode::<
5284            FrameExecuteJavaScriptNoResultRequest,
5285            FrameExecuteJavaScriptNoResultResult,
5286        >(
5287            (origins, &mut script,),
5288            0x16b8491520cbcd63,
5289            fidl::encoding::DynamicFlags::empty(),
5290            _decode,
5291        )
5292    }
5293
5294    type AddBeforeLoadJavaScriptResponseFut = fidl::client::QueryResponseFut<
5295        FrameAddBeforeLoadJavaScriptResult,
5296        fidl::encoding::DefaultFuchsiaResourceDialect,
5297    >;
5298    fn r#add_before_load_java_script(
5299        &self,
5300        mut id: u64,
5301        mut origins: &[String],
5302        mut script: fidl_fuchsia_mem::Buffer,
5303    ) -> Self::AddBeforeLoadJavaScriptResponseFut {
5304        fn _decode(
5305            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5306        ) -> Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error> {
5307            let _response = fidl::client::decode_transaction_body::<
5308                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5309                fidl::encoding::DefaultFuchsiaResourceDialect,
5310                0x540ac0da59d823e,
5311            >(_buf?)?;
5312            Ok(_response.map(|x| x))
5313        }
5314        self.client.send_query_and_decode::<
5315            FrameAddBeforeLoadJavaScriptRequest,
5316            FrameAddBeforeLoadJavaScriptResult,
5317        >(
5318            (id, origins, &mut script,),
5319            0x540ac0da59d823e,
5320            fidl::encoding::DynamicFlags::empty(),
5321            _decode,
5322        )
5323    }
5324
5325    fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
5326        self.client.send::<FrameRemoveBeforeLoadJavaScriptRequest>(
5327            (id,),
5328            0x17d92b855b61d23a,
5329            fidl::encoding::DynamicFlags::empty(),
5330        )
5331    }
5332
5333    type PostMessageResponseFut = fidl::client::QueryResponseFut<
5334        FramePostMessageResult,
5335        fidl::encoding::DefaultFuchsiaResourceDialect,
5336    >;
5337    fn r#post_message(
5338        &self,
5339        mut target_origin: &str,
5340        mut message: WebMessage,
5341    ) -> Self::PostMessageResponseFut {
5342        fn _decode(
5343            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5344        ) -> Result<FramePostMessageResult, fidl::Error> {
5345            let _response = fidl::client::decode_transaction_body::<
5346                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5347                fidl::encoding::DefaultFuchsiaResourceDialect,
5348                0x751d686eb7caa341,
5349            >(_buf?)?;
5350            Ok(_response.map(|x| x))
5351        }
5352        self.client.send_query_and_decode::<FramePostMessageRequest, FramePostMessageResult>(
5353            (target_origin, &mut message),
5354            0x751d686eb7caa341,
5355            fidl::encoding::DynamicFlags::empty(),
5356            _decode,
5357        )
5358    }
5359
5360    fn r#set_navigation_event_listener(
5361        &self,
5362        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
5363    ) -> Result<(), fidl::Error> {
5364        self.client.send::<FrameSetNavigationEventListenerRequest>(
5365            (listener,),
5366            0x965ba0fa20e0a56,
5367            fidl::encoding::DynamicFlags::empty(),
5368        )
5369    }
5370
5371    fn r#set_navigation_event_listener2(
5372        &self,
5373        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
5374        mut flags: NavigationEventListenerFlags,
5375    ) -> Result<(), fidl::Error> {
5376        self.client.send::<FrameSetNavigationEventListener2Request>(
5377            (listener, flags),
5378            0x5f8b40607f1f578f,
5379            fidl::encoding::DynamicFlags::empty(),
5380        )
5381    }
5382
5383    fn r#set_java_script_log_level(&self, mut level: ConsoleLogLevel) -> Result<(), fidl::Error> {
5384        self.client.send::<FrameSetJavaScriptLogLevelRequest>(
5385            (level,),
5386            0x74824b11a71c4b5b,
5387            fidl::encoding::DynamicFlags::empty(),
5388        )
5389    }
5390
5391    fn r#set_console_log_sink(
5392        &self,
5393        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
5394    ) -> Result<(), fidl::Error> {
5395        self.client.send::<FrameSetConsoleLogSinkRequest>(
5396            (sink,),
5397            0x18f5cbc19fa4687b,
5398            fidl::encoding::DynamicFlags::empty(),
5399        )
5400    }
5401
5402    fn r#configure_input_types(
5403        &self,
5404        mut types: InputTypes,
5405        mut allow: AllowInputState,
5406    ) -> Result<(), fidl::Error> {
5407        self.client.send::<FrameConfigureInputTypesRequest>(
5408            (types, allow),
5409            0x38e08fe763c6bef6,
5410            fidl::encoding::DynamicFlags::empty(),
5411        )
5412    }
5413
5414    fn r#set_popup_frame_creation_listener(
5415        &self,
5416        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
5417    ) -> Result<(), fidl::Error> {
5418        self.client.send::<FrameSetPopupFrameCreationListenerRequest>(
5419            (listener,),
5420            0x34ddec4e9f11e2aa,
5421            fidl::encoding::DynamicFlags::empty(),
5422        )
5423    }
5424
5425    type SetUrlRequestRewriteRulesResponseFut =
5426        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5427    fn r#set_url_request_rewrite_rules(
5428        &self,
5429        mut rules: &[UrlRequestRewriteRule],
5430    ) -> Self::SetUrlRequestRewriteRulesResponseFut {
5431        fn _decode(
5432            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5433        ) -> Result<(), fidl::Error> {
5434            let _response = fidl::client::decode_transaction_body::<
5435                fidl::encoding::EmptyPayload,
5436                fidl::encoding::DefaultFuchsiaResourceDialect,
5437                0x2e3f797350ab3281,
5438            >(_buf?)?;
5439            Ok(_response)
5440        }
5441        self.client.send_query_and_decode::<FrameSetUrlRequestRewriteRulesRequest, ()>(
5442            (rules,),
5443            0x2e3f797350ab3281,
5444            fidl::encoding::DynamicFlags::empty(),
5445            _decode,
5446        )
5447    }
5448
5449    fn r#set_media_settings(&self, mut settings: &FrameMediaSettings) -> Result<(), fidl::Error> {
5450        self.client.send::<FrameSetMediaSettingsRequest>(
5451            (settings,),
5452            0x7da879b6d284c143,
5453            fidl::encoding::DynamicFlags::empty(),
5454        )
5455    }
5456
5457    fn r#force_content_dimensions(
5458        &self,
5459        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
5460    ) -> Result<(), fidl::Error> {
5461        self.client.send::<FrameForceContentDimensionsRequest>(
5462            (web_dips,),
5463            0x8c7024c7149c901,
5464            fidl::encoding::DynamicFlags::empty(),
5465        )
5466    }
5467
5468    fn r#set_permission_state(
5469        &self,
5470        mut permission: &PermissionDescriptor,
5471        mut web_origin: &str,
5472        mut state: PermissionState,
5473    ) -> Result<(), fidl::Error> {
5474        self.client.send::<FrameSetPermissionStateRequest>(
5475            (permission, web_origin, state),
5476            0x19574e92a7033f4f,
5477            fidl::encoding::DynamicFlags::empty(),
5478        )
5479    }
5480
5481    fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
5482        self.client.send::<FrameSetBlockMediaLoadingRequest>(
5483            (blocked,),
5484            0x211071458fc9cf4f,
5485            fidl::encoding::DynamicFlags::empty(),
5486        )
5487    }
5488
5489    type GetPrivateMemorySizeResponseFut =
5490        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
5491    fn r#get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut {
5492        fn _decode(
5493            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5494        ) -> Result<u64, fidl::Error> {
5495            let _response = fidl::client::decode_transaction_body::<
5496                FrameGetPrivateMemorySizeResponse,
5497                fidl::encoding::DefaultFuchsiaResourceDialect,
5498                0x6ad4d43da6c129b0,
5499            >(_buf?)?;
5500            Ok(_response.size_bytes)
5501        }
5502        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
5503            (),
5504            0x6ad4d43da6c129b0,
5505            fidl::encoding::DynamicFlags::empty(),
5506            _decode,
5507        )
5508    }
5509
5510    fn r#set_navigation_policy_provider(
5511        &self,
5512        mut params: &NavigationPolicyProviderParams,
5513        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
5514    ) -> Result<(), fidl::Error> {
5515        self.client.send::<FrameSetNavigationPolicyProviderRequest>(
5516            (params, provider),
5517            0x602ce35195d66654,
5518            fidl::encoding::DynamicFlags::empty(),
5519        )
5520    }
5521
5522    fn r#set_content_area_settings(
5523        &self,
5524        mut settings: &ContentAreaSettings,
5525    ) -> Result<(), fidl::Error> {
5526        self.client.send::<FrameSetContentAreaSettingsRequest>(
5527            (settings,),
5528            0x851f4de50c3c27e,
5529            fidl::encoding::DynamicFlags::empty(),
5530        )
5531    }
5532
5533    fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
5534        self.client.send::<fidl::encoding::EmptyPayload>(
5535            (),
5536            0x6807e04f16f8ee5d,
5537            fidl::encoding::DynamicFlags::empty(),
5538        )
5539    }
5540
5541    fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
5542        self.client.send::<FrameCloseRequest>(
5543            payload,
5544            0x442e84138e65351,
5545            fidl::encoding::DynamicFlags::empty(),
5546        )
5547    }
5548}
5549
5550pub struct FrameEventStream {
5551    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5552}
5553
5554impl std::marker::Unpin for FrameEventStream {}
5555
5556impl futures::stream::FusedStream for FrameEventStream {
5557    fn is_terminated(&self) -> bool {
5558        self.event_receiver.is_terminated()
5559    }
5560}
5561
5562impl futures::Stream for FrameEventStream {
5563    type Item = Result<FrameEvent, fidl::Error>;
5564
5565    fn poll_next(
5566        mut self: std::pin::Pin<&mut Self>,
5567        cx: &mut std::task::Context<'_>,
5568    ) -> std::task::Poll<Option<Self::Item>> {
5569        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5570            &mut self.event_receiver,
5571            cx
5572        )?) {
5573            Some(buf) => std::task::Poll::Ready(Some(FrameEvent::decode(buf))),
5574            None => std::task::Poll::Ready(None),
5575        }
5576    }
5577}
5578
5579#[derive(Debug)]
5580pub enum FrameEvent {}
5581
5582impl FrameEvent {
5583    /// Decodes a message buffer as a [`FrameEvent`].
5584    fn decode(
5585        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5586    ) -> Result<FrameEvent, fidl::Error> {
5587        let (bytes, _handles) = buf.split_mut();
5588        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5589        debug_assert_eq!(tx_header.tx_id, 0);
5590        match tx_header.ordinal {
5591            _ => Err(fidl::Error::UnknownOrdinal {
5592                ordinal: tx_header.ordinal,
5593                protocol_name: <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5594            }),
5595        }
5596    }
5597}
5598
5599/// A Stream of incoming requests for fuchsia.web/Frame.
5600pub struct FrameRequestStream {
5601    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5602    is_terminated: bool,
5603}
5604
5605impl std::marker::Unpin for FrameRequestStream {}
5606
5607impl futures::stream::FusedStream for FrameRequestStream {
5608    fn is_terminated(&self) -> bool {
5609        self.is_terminated
5610    }
5611}
5612
5613impl fidl::endpoints::RequestStream for FrameRequestStream {
5614    type Protocol = FrameMarker;
5615    type ControlHandle = FrameControlHandle;
5616
5617    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5618        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5619    }
5620
5621    fn control_handle(&self) -> Self::ControlHandle {
5622        FrameControlHandle { inner: self.inner.clone() }
5623    }
5624
5625    fn into_inner(
5626        self,
5627    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5628    {
5629        (self.inner, self.is_terminated)
5630    }
5631
5632    fn from_inner(
5633        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5634        is_terminated: bool,
5635    ) -> Self {
5636        Self { inner, is_terminated }
5637    }
5638}
5639
5640impl futures::Stream for FrameRequestStream {
5641    type Item = Result<FrameRequest, fidl::Error>;
5642
5643    fn poll_next(
5644        mut self: std::pin::Pin<&mut Self>,
5645        cx: &mut std::task::Context<'_>,
5646    ) -> std::task::Poll<Option<Self::Item>> {
5647        let this = &mut *self;
5648        if this.inner.check_shutdown(cx) {
5649            this.is_terminated = true;
5650            return std::task::Poll::Ready(None);
5651        }
5652        if this.is_terminated {
5653            panic!("polled FrameRequestStream after completion");
5654        }
5655        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5656            |bytes, handles| {
5657                match this.inner.channel().read_etc(cx, bytes, handles) {
5658                    std::task::Poll::Ready(Ok(())) => {}
5659                    std::task::Poll::Pending => return std::task::Poll::Pending,
5660                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5661                        this.is_terminated = true;
5662                        return std::task::Poll::Ready(None);
5663                    }
5664                    std::task::Poll::Ready(Err(e)) => {
5665                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5666                            e.into(),
5667                        ))));
5668                    }
5669                }
5670
5671                // A message has been received from the channel
5672                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5673
5674                std::task::Poll::Ready(Some(match header.ordinal {
5675                    0x6a27859439133264 => {
5676                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5677                        let mut req = fidl::new_empty!(
5678                            FrameCreateViewRequest,
5679                            fidl::encoding::DefaultFuchsiaResourceDialect
5680                        );
5681                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
5682                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5683                        Ok(FrameRequest::CreateView { view_token: req.view_token, control_handle })
5684                    }
5685                    0x1eb17ab2442326ac => {
5686                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5687                        let mut req = fidl::new_empty!(
5688                            FrameCreateViewWithViewRefRequest,
5689                            fidl::encoding::DefaultFuchsiaResourceDialect
5690                        );
5691                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateViewWithViewRefRequest>(&header, _body_bytes, handles, &mut req)?;
5692                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5693                        Ok(FrameRequest::CreateViewWithViewRef {
5694                            view_token: req.view_token,
5695                            view_ref_control: req.view_ref_control,
5696                            view_ref: req.view_ref,
5697
5698                            control_handle,
5699                        })
5700                    }
5701                    0x1be7e9512962eb37 => {
5702                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5703                        let mut req = fidl::new_empty!(
5704                            FrameCreateView2Request,
5705                            fidl::encoding::DefaultFuchsiaResourceDialect
5706                        );
5707                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
5708                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5709                        Ok(FrameRequest::CreateView2 { args: req.args, control_handle })
5710                    }
5711                    0x72a81aaae7a80d2b => {
5712                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5713                        let mut req = fidl::new_empty!(
5714                            fidl::encoding::EmptyPayload,
5715                            fidl::encoding::DefaultFuchsiaResourceDialect
5716                        );
5717                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5718                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5719                        Ok(FrameRequest::EnableHeadlessRendering { control_handle })
5720                    }
5721                    0x5ca38a3d1f7f543a => {
5722                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5723                        let mut req = fidl::new_empty!(
5724                            fidl::encoding::EmptyPayload,
5725                            fidl::encoding::DefaultFuchsiaResourceDialect
5726                        );
5727                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5728                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5729                        Ok(FrameRequest::DisableHeadlessRendering { control_handle })
5730                    }
5731                    0xaafb639fc0b9eb9 => {
5732                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5733                        let mut req = fidl::new_empty!(
5734                            FrameGetMediaPlayerRequest,
5735                            fidl::encoding::DefaultFuchsiaResourceDialect
5736                        );
5737                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameGetMediaPlayerRequest>(&header, _body_bytes, handles, &mut req)?;
5738                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5739                        Ok(FrameRequest::GetMediaPlayer { player: req.player, control_handle })
5740                    }
5741                    0x4521cfe95217a688 => {
5742                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5743                        let mut req = fidl::new_empty!(
5744                            FrameGetNavigationControllerRequest,
5745                            fidl::encoding::DefaultFuchsiaResourceDialect
5746                        );
5747                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameGetNavigationControllerRequest>(&header, _body_bytes, handles, &mut req)?;
5748                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5749                        Ok(FrameRequest::GetNavigationController {
5750                            controller: req.controller,
5751
5752                            control_handle,
5753                        })
5754                    }
5755                    0x79abdd4907000542 => {
5756                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5757                        let mut req = fidl::new_empty!(
5758                            FrameExecuteJavaScriptRequest,
5759                            fidl::encoding::DefaultFuchsiaResourceDialect
5760                        );
5761                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameExecuteJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5762                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5763                        Ok(FrameRequest::ExecuteJavaScript {
5764                            origins: req.origins,
5765                            script: req.script,
5766
5767                            responder: FrameExecuteJavaScriptResponder {
5768                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5769                                tx_id: header.tx_id,
5770                            },
5771                        })
5772                    }
5773                    0x16b8491520cbcd63 => {
5774                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5775                        let mut req = fidl::new_empty!(
5776                            FrameExecuteJavaScriptNoResultRequest,
5777                            fidl::encoding::DefaultFuchsiaResourceDialect
5778                        );
5779                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameExecuteJavaScriptNoResultRequest>(&header, _body_bytes, handles, &mut req)?;
5780                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5781                        Ok(FrameRequest::ExecuteJavaScriptNoResult {
5782                            origins: req.origins,
5783                            script: req.script,
5784
5785                            responder: FrameExecuteJavaScriptNoResultResponder {
5786                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5787                                tx_id: header.tx_id,
5788                            },
5789                        })
5790                    }
5791                    0x540ac0da59d823e => {
5792                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5793                        let mut req = fidl::new_empty!(
5794                            FrameAddBeforeLoadJavaScriptRequest,
5795                            fidl::encoding::DefaultFuchsiaResourceDialect
5796                        );
5797                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameAddBeforeLoadJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5798                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5799                        Ok(FrameRequest::AddBeforeLoadJavaScript {
5800                            id: req.id,
5801                            origins: req.origins,
5802                            script: req.script,
5803
5804                            responder: FrameAddBeforeLoadJavaScriptResponder {
5805                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5806                                tx_id: header.tx_id,
5807                            },
5808                        })
5809                    }
5810                    0x17d92b855b61d23a => {
5811                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5812                        let mut req = fidl::new_empty!(
5813                            FrameRemoveBeforeLoadJavaScriptRequest,
5814                            fidl::encoding::DefaultFuchsiaResourceDialect
5815                        );
5816                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameRemoveBeforeLoadJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5817                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5818                        Ok(FrameRequest::RemoveBeforeLoadJavaScript { id: req.id, control_handle })
5819                    }
5820                    0x751d686eb7caa341 => {
5821                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5822                        let mut req = fidl::new_empty!(
5823                            FramePostMessageRequest,
5824                            fidl::encoding::DefaultFuchsiaResourceDialect
5825                        );
5826                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FramePostMessageRequest>(&header, _body_bytes, handles, &mut req)?;
5827                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5828                        Ok(FrameRequest::PostMessage {
5829                            target_origin: req.target_origin,
5830                            message: req.message,
5831
5832                            responder: FramePostMessageResponder {
5833                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5834                                tx_id: header.tx_id,
5835                            },
5836                        })
5837                    }
5838                    0x965ba0fa20e0a56 => {
5839                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5840                        let mut req = fidl::new_empty!(
5841                            FrameSetNavigationEventListenerRequest,
5842                            fidl::encoding::DefaultFuchsiaResourceDialect
5843                        );
5844                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationEventListenerRequest>(&header, _body_bytes, handles, &mut req)?;
5845                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5846                        Ok(FrameRequest::SetNavigationEventListener {
5847                            listener: req.listener,
5848
5849                            control_handle,
5850                        })
5851                    }
5852                    0x5f8b40607f1f578f => {
5853                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5854                        let mut req = fidl::new_empty!(
5855                            FrameSetNavigationEventListener2Request,
5856                            fidl::encoding::DefaultFuchsiaResourceDialect
5857                        );
5858                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationEventListener2Request>(&header, _body_bytes, handles, &mut req)?;
5859                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5860                        Ok(FrameRequest::SetNavigationEventListener2 {
5861                            listener: req.listener,
5862                            flags: req.flags,
5863
5864                            control_handle,
5865                        })
5866                    }
5867                    0x74824b11a71c4b5b => {
5868                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5869                        let mut req = fidl::new_empty!(
5870                            FrameSetJavaScriptLogLevelRequest,
5871                            fidl::encoding::DefaultFuchsiaResourceDialect
5872                        );
5873                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetJavaScriptLogLevelRequest>(&header, _body_bytes, handles, &mut req)?;
5874                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5875                        Ok(FrameRequest::SetJavaScriptLogLevel { level: req.level, control_handle })
5876                    }
5877                    0x18f5cbc19fa4687b => {
5878                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5879                        let mut req = fidl::new_empty!(
5880                            FrameSetConsoleLogSinkRequest,
5881                            fidl::encoding::DefaultFuchsiaResourceDialect
5882                        );
5883                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetConsoleLogSinkRequest>(&header, _body_bytes, handles, &mut req)?;
5884                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5885                        Ok(FrameRequest::SetConsoleLogSink { sink: req.sink, control_handle })
5886                    }
5887                    0x38e08fe763c6bef6 => {
5888                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5889                        let mut req = fidl::new_empty!(
5890                            FrameConfigureInputTypesRequest,
5891                            fidl::encoding::DefaultFuchsiaResourceDialect
5892                        );
5893                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameConfigureInputTypesRequest>(&header, _body_bytes, handles, &mut req)?;
5894                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5895                        Ok(FrameRequest::ConfigureInputTypes {
5896                            types: req.types,
5897                            allow: req.allow,
5898
5899                            control_handle,
5900                        })
5901                    }
5902                    0x34ddec4e9f11e2aa => {
5903                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5904                        let mut req = fidl::new_empty!(
5905                            FrameSetPopupFrameCreationListenerRequest,
5906                            fidl::encoding::DefaultFuchsiaResourceDialect
5907                        );
5908                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetPopupFrameCreationListenerRequest>(&header, _body_bytes, handles, &mut req)?;
5909                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5910                        Ok(FrameRequest::SetPopupFrameCreationListener {
5911                            listener: req.listener,
5912
5913                            control_handle,
5914                        })
5915                    }
5916                    0x2e3f797350ab3281 => {
5917                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5918                        let mut req = fidl::new_empty!(
5919                            FrameSetUrlRequestRewriteRulesRequest,
5920                            fidl::encoding::DefaultFuchsiaResourceDialect
5921                        );
5922                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetUrlRequestRewriteRulesRequest>(&header, _body_bytes, handles, &mut req)?;
5923                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5924                        Ok(FrameRequest::SetUrlRequestRewriteRules {
5925                            rules: req.rules,
5926
5927                            responder: FrameSetUrlRequestRewriteRulesResponder {
5928                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5929                                tx_id: header.tx_id,
5930                            },
5931                        })
5932                    }
5933                    0x7da879b6d284c143 => {
5934                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5935                        let mut req = fidl::new_empty!(
5936                            FrameSetMediaSettingsRequest,
5937                            fidl::encoding::DefaultFuchsiaResourceDialect
5938                        );
5939                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetMediaSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
5940                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5941                        Ok(FrameRequest::SetMediaSettings {
5942                            settings: req.settings,
5943
5944                            control_handle,
5945                        })
5946                    }
5947                    0x8c7024c7149c901 => {
5948                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5949                        let mut req = fidl::new_empty!(
5950                            FrameForceContentDimensionsRequest,
5951                            fidl::encoding::DefaultFuchsiaResourceDialect
5952                        );
5953                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameForceContentDimensionsRequest>(&header, _body_bytes, handles, &mut req)?;
5954                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5955                        Ok(FrameRequest::ForceContentDimensions {
5956                            web_dips: req.web_dips,
5957
5958                            control_handle,
5959                        })
5960                    }
5961                    0x19574e92a7033f4f => {
5962                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5963                        let mut req = fidl::new_empty!(
5964                            FrameSetPermissionStateRequest,
5965                            fidl::encoding::DefaultFuchsiaResourceDialect
5966                        );
5967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetPermissionStateRequest>(&header, _body_bytes, handles, &mut req)?;
5968                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5969                        Ok(FrameRequest::SetPermissionState {
5970                            permission: req.permission,
5971                            web_origin: req.web_origin,
5972                            state: req.state,
5973
5974                            control_handle,
5975                        })
5976                    }
5977                    0x211071458fc9cf4f => {
5978                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5979                        let mut req = fidl::new_empty!(
5980                            FrameSetBlockMediaLoadingRequest,
5981                            fidl::encoding::DefaultFuchsiaResourceDialect
5982                        );
5983                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetBlockMediaLoadingRequest>(&header, _body_bytes, handles, &mut req)?;
5984                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5985                        Ok(FrameRequest::SetBlockMediaLoading {
5986                            blocked: req.blocked,
5987
5988                            control_handle,
5989                        })
5990                    }
5991                    0x6ad4d43da6c129b0 => {
5992                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5993                        let mut req = fidl::new_empty!(
5994                            fidl::encoding::EmptyPayload,
5995                            fidl::encoding::DefaultFuchsiaResourceDialect
5996                        );
5997                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5998                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5999                        Ok(FrameRequest::GetPrivateMemorySize {
6000                            responder: FrameGetPrivateMemorySizeResponder {
6001                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6002                                tx_id: header.tx_id,
6003                            },
6004                        })
6005                    }
6006                    0x602ce35195d66654 => {
6007                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6008                        let mut req = fidl::new_empty!(
6009                            FrameSetNavigationPolicyProviderRequest,
6010                            fidl::encoding::DefaultFuchsiaResourceDialect
6011                        );
6012                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationPolicyProviderRequest>(&header, _body_bytes, handles, &mut req)?;
6013                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6014                        Ok(FrameRequest::SetNavigationPolicyProvider {
6015                            params: req.params,
6016                            provider: req.provider,
6017
6018                            control_handle,
6019                        })
6020                    }
6021                    0x851f4de50c3c27e => {
6022                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6023                        let mut req = fidl::new_empty!(
6024                            FrameSetContentAreaSettingsRequest,
6025                            fidl::encoding::DefaultFuchsiaResourceDialect
6026                        );
6027                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetContentAreaSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
6028                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6029                        Ok(FrameRequest::SetContentAreaSettings {
6030                            settings: req.settings,
6031
6032                            control_handle,
6033                        })
6034                    }
6035                    0x6807e04f16f8ee5d => {
6036                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6037                        let mut req = fidl::new_empty!(
6038                            fidl::encoding::EmptyPayload,
6039                            fidl::encoding::DefaultFuchsiaResourceDialect
6040                        );
6041                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6042                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6043                        Ok(FrameRequest::ResetContentAreaSettings { control_handle })
6044                    }
6045                    0x442e84138e65351 => {
6046                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6047                        let mut req = fidl::new_empty!(
6048                            FrameCloseRequest,
6049                            fidl::encoding::DefaultFuchsiaResourceDialect
6050                        );
6051                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCloseRequest>(&header, _body_bytes, handles, &mut req)?;
6052                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6053                        Ok(FrameRequest::Close { payload: req, control_handle })
6054                    }
6055                    _ => Err(fidl::Error::UnknownOrdinal {
6056                        ordinal: header.ordinal,
6057                        protocol_name: <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6058                    }),
6059                }))
6060            },
6061        )
6062    }
6063}
6064
6065#[derive(Debug)]
6066pub enum FrameRequest {
6067    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
6068    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
6069    ///
6070    /// See the description of [`CreateContextParams.service_directory`] for additional services
6071    /// that must be present when using this method.
6072    CreateView { view_token: fidl_fuchsia_ui_views::ViewToken, control_handle: FrameControlHandle },
6073    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
6074    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
6075    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
6076    /// track the view.
6077    ///
6078    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
6079    /// and `view_token` will be closed.
6080    ///
6081    /// See the description of [`CreateContextParams.service_directory`] for additional services
6082    /// that must be present when using this method.
6083    CreateViewWithViewRef {
6084        view_token: fidl_fuchsia_ui_views::ViewToken,
6085        view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
6086        view_ref: fidl_fuchsia_ui_views::ViewRef,
6087        control_handle: FrameControlHandle,
6088    },
6089    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
6090    /// Caller should pass the other end of the token to
6091    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
6092    /// graph.
6093    CreateView2 { args: CreateView2Args, control_handle: FrameControlHandle },
6094    /// Enables headless rendering of the Frame.
6095    ///
6096    /// This is used when content depends on layout and/or animation events firing normally.
6097    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
6098    EnableHeadlessRendering { control_handle: FrameControlHandle },
6099    /// Stops headless rendering of the Frame.
6100    ///
6101    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
6102    DisableHeadlessRendering { control_handle: FrameControlHandle },
6103    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
6104    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
6105    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
6106    GetMediaPlayer {
6107        player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
6108        control_handle: FrameControlHandle,
6109    },
6110    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
6111    /// reloaded, etc.
6112    ///
6113    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
6114    ///   [`NavigationController`].
6115    GetNavigationController {
6116        controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
6117        control_handle: FrameControlHandle,
6118    },
6119    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
6120    /// which matches entries in `origins`.
6121    ///
6122    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
6123    /// `origins`, then the script will be evaluated unconditionally.
6124    ///
6125    /// Returns the result of executing `script`, as a JSON-encoded string.
6126    ///
6127    /// Note that scripts share the same execution context as the document,
6128    /// meaning that document may modify variables, classes, or objects set by
6129    /// the script in arbitrary or unpredictable ways.
6130    ///
6131    /// If an error occurred, the FrameError will be set to one of these values:
6132    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
6133    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
6134    ///   `origins` or `origins` is an empty vector.
6135    ExecuteJavaScript {
6136        origins: Vec<String>,
6137        script: fidl_fuchsia_mem::Buffer,
6138        responder: FrameExecuteJavaScriptResponder,
6139    },
6140    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
6141    /// a result.
6142    ExecuteJavaScriptNoResult {
6143        origins: Vec<String>,
6144        script: fidl_fuchsia_mem::Buffer,
6145        responder: FrameExecuteJavaScriptNoResultResponder,
6146    },
6147    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
6148    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
6149    /// of the document's scripts.
6150    ///
6151    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
6152    /// using the same `id` will be replaced.
6153    ///
6154    /// The order in which multiple bindings are executed is the same as the order in which the
6155    /// bindings were added. If a script is added which clobbers an existing script of the same
6156    /// `id`, the previous script's precedence in the injection order will be preserved.
6157    ///
6158    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
6159    /// `origins`, then the script will be evaluated unconditionally.
6160    ///
6161    /// If an error occurred, the [`FrameError`] will be set to one of these values:
6162    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
6163    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
6164    AddBeforeLoadJavaScript {
6165        id: u64,
6166        origins: Vec<String>,
6167        script: fidl_fuchsia_mem::Buffer,
6168        responder: FrameAddBeforeLoadJavaScriptResponder,
6169    },
6170    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
6171    /// is no JavaScript snippet identified by `id`.
6172    RemoveBeforeLoadJavaScript { id: u64, control_handle: FrameControlHandle },
6173    /// Posts a message to the frame's onMessage handler.
6174    ///
6175    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
6176    /// `"*"`, then the message will be sent to the document regardless of its origin.
6177    /// See the
6178    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
6179    /// section 9.4.3 for more details on how the target origin policy is applied.
6180    ///
6181    /// If an error occurred, the [`FrameError`] will be set to one of these values:
6182    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
6183    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
6184    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
6185    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
6186    PostMessage { target_origin: String, message: WebMessage, responder: FramePostMessageResponder },
6187    /// Sets the listener for handling page navigation events.
6188    ///
6189    /// - `listener`: The observer to use. Unregisters any existing listener if null.
6190    SetNavigationEventListener {
6191        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6192        control_handle: FrameControlHandle,
6193    },
6194    /// Sets the listener for handling page navigation events. The listener will receive the
6195    /// current navigation state immediately. After that, it's notified whenever the state changes.
6196    ///
6197    /// - `listener`: The observer to use. Unregisters any existing listener if null.
6198    /// - `flags`: Flags for optional features that should be enabled for the listener.
6199    SetNavigationEventListener2 {
6200        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6201        flags: NavigationEventListenerFlags,
6202        control_handle: FrameControlHandle,
6203    },
6204    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
6205    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
6206    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
6207    /// `error()`).
6208    /// The default value is [`ConsoleLogLevel.NONE`].
6209    ///
6210    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
6211    /// in Incognito and other private browsing modes.
6212    ///
6213    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
6214    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
6215    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
6216    ///   severity.
6217    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
6218    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
6219    SetJavaScriptLogLevel { level: ConsoleLogLevel, control_handle: FrameControlHandle },
6220    /// Specifies where to emit `console` log output to. By default log output will be routed to a
6221    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
6222    ///
6223    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
6224    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
6225    SetConsoleLogSink {
6226        sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
6227        control_handle: FrameControlHandle,
6228    },
6229    /// Enables or disables the processing of the specified `types` of user inputs.
6230    /// `allow` specifies whether to enable or disable the specified `types`.
6231    /// All input types are enabled by default.
6232    ConfigureInputTypes {
6233        types: InputTypes,
6234        allow: AllowInputState,
6235        control_handle: FrameControlHandle,
6236    },
6237    /// Sets the listener for handling popup frame opened by web content. If no listener is
6238    /// present, then any new popup frame will be blocked.
6239    ///
6240    /// - `listener`: The listener to use. Unregisters any existing listener if null.
6241    SetPopupFrameCreationListener {
6242        listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
6243        control_handle: FrameControlHandle,
6244    },
6245    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
6246    /// - `rules` are cumulative and applied in order.
6247    /// - `rules` are only applied on the first URL request in a redirect chain.
6248    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
6249    ///   will be closed with `ERR_INVALID_ARGS`.
6250    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
6251    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
6252    ///   `ERR_BAD_STATE`.
6253    SetUrlRequestRewriteRules {
6254        rules: Vec<UrlRequestRewriteRule>,
6255        responder: FrameSetUrlRequestRewriteRulesResponder,
6256    },
6257    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
6258    /// applied to audio streams that started after this message is processed. Should be called
6259    /// before the Frame is navigated to content in order to ensure that the settings applied to
6260    /// all media streams. Due to request pipelining, this means doing so before calling
6261    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
6262    SetMediaSettings { settings: FrameMediaSettings, control_handle: FrameControlHandle },
6263    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
6264    /// web content will be adjusted in response to changes in the pixel size of the View,
6265    /// rather than changing the size reported to the content. Call with null `web_dips` to
6266    /// remove any prior forced content dimensions.
6267    ForceContentDimensions {
6268        web_dips: Option<Box<fidl_fuchsia_ui_gfx::Vec2>>,
6269        control_handle: FrameControlHandle,
6270    },
6271    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
6272    /// permissions are denied.
6273    SetPermissionState {
6274        permission: PermissionDescriptor,
6275        web_origin: String,
6276        state: PermissionState,
6277        control_handle: FrameControlHandle,
6278    },
6279    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
6280    /// resources.
6281    ///
6282    /// May be used, for example, to prevent loading media in frames that are not visible.
6283    ///
6284    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
6285    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
6286    /// unblocked by a call to this method.
6287    ///
6288    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
6289    /// playing as appropriate.
6290    ///
6291    /// Any elements that have begun fetching or loading media resources for the current source
6292    /// before media loading was blocked will continue to fetch, load, and start playback as
6293    /// appropriate. This includes calls to `play()` even after media loading is blocked.
6294    SetBlockMediaLoading { blocked: bool, control_handle: FrameControlHandle },
6295    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
6296    /// document. The returned size might not reflect the memory usage of embedded iframes.
6297    GetPrivateMemorySize { responder: FrameGetPrivateMemorySizeResponder },
6298    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
6299    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
6300    /// requests. `params` defines when the message is sent. After sending the
6301    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
6302    /// until it receives a response.
6303    ///
6304    /// Should be called before `GetNavigationController` to ensure that it is applied to all
6305    /// navigations including the first [`NavigationController.LoadURL`] request.
6306    SetNavigationPolicyProvider {
6307        params: NavigationPolicyProviderParams,
6308        provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
6309        control_handle: FrameControlHandle,
6310    },
6311    /// Sets various settings for how web content should be run in the Frame. May be called at any
6312    /// time, including after the URL has loaded. Each call changes only the specified fields,
6313    /// overwriting any prior value.
6314    ///
6315    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
6316    /// is not supported by the Frame.
6317    SetContentAreaSettings { settings: ContentAreaSettings, control_handle: FrameControlHandle },
6318    /// Reset the Frame's [`ContentAreaSettings`] to default values.
6319    ResetContentAreaSettings { control_handle: FrameControlHandle },
6320    /// Request graceful or immediate teardown of the Frame content and notification of completion
6321    /// via Frame epitaph.
6322    ///
6323    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
6324    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
6325    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
6326    /// content to run event handlers.
6327    ///
6328    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
6329    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
6330    ///
6331    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
6332    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
6333    ///   otherwise.
6334    ///
6335    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
6336    ///
6337    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
6338    Close { payload: FrameCloseRequest, control_handle: FrameControlHandle },
6339}
6340
6341impl FrameRequest {
6342    #[allow(irrefutable_let_patterns)]
6343    pub fn into_create_view(
6344        self,
6345    ) -> Option<(fidl_fuchsia_ui_views::ViewToken, FrameControlHandle)> {
6346        if let FrameRequest::CreateView { view_token, control_handle } = self {
6347            Some((view_token, control_handle))
6348        } else {
6349            None
6350        }
6351    }
6352
6353    #[allow(irrefutable_let_patterns)]
6354    pub fn into_create_view_with_view_ref(
6355        self,
6356    ) -> Option<(
6357        fidl_fuchsia_ui_views::ViewToken,
6358        fidl_fuchsia_ui_views::ViewRefControl,
6359        fidl_fuchsia_ui_views::ViewRef,
6360        FrameControlHandle,
6361    )> {
6362        if let FrameRequest::CreateViewWithViewRef {
6363            view_token,
6364            view_ref_control,
6365            view_ref,
6366            control_handle,
6367        } = self
6368        {
6369            Some((view_token, view_ref_control, view_ref, control_handle))
6370        } else {
6371            None
6372        }
6373    }
6374
6375    #[allow(irrefutable_let_patterns)]
6376    pub fn into_create_view2(self) -> Option<(CreateView2Args, FrameControlHandle)> {
6377        if let FrameRequest::CreateView2 { args, control_handle } = self {
6378            Some((args, control_handle))
6379        } else {
6380            None
6381        }
6382    }
6383
6384    #[allow(irrefutable_let_patterns)]
6385    pub fn into_enable_headless_rendering(self) -> Option<(FrameControlHandle)> {
6386        if let FrameRequest::EnableHeadlessRendering { control_handle } = self {
6387            Some((control_handle))
6388        } else {
6389            None
6390        }
6391    }
6392
6393    #[allow(irrefutable_let_patterns)]
6394    pub fn into_disable_headless_rendering(self) -> Option<(FrameControlHandle)> {
6395        if let FrameRequest::DisableHeadlessRendering { control_handle } = self {
6396            Some((control_handle))
6397        } else {
6398            None
6399        }
6400    }
6401
6402    #[allow(irrefutable_let_patterns)]
6403    pub fn into_get_media_player(
6404        self,
6405    ) -> Option<(
6406        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
6407        FrameControlHandle,
6408    )> {
6409        if let FrameRequest::GetMediaPlayer { player, control_handle } = self {
6410            Some((player, control_handle))
6411        } else {
6412            None
6413        }
6414    }
6415
6416    #[allow(irrefutable_let_patterns)]
6417    pub fn into_get_navigation_controller(
6418        self,
6419    ) -> Option<(fidl::endpoints::ServerEnd<NavigationControllerMarker>, FrameControlHandle)> {
6420        if let FrameRequest::GetNavigationController { controller, control_handle } = self {
6421            Some((controller, control_handle))
6422        } else {
6423            None
6424        }
6425    }
6426
6427    #[allow(irrefutable_let_patterns)]
6428    pub fn into_execute_java_script(
6429        self,
6430    ) -> Option<(Vec<String>, fidl_fuchsia_mem::Buffer, FrameExecuteJavaScriptResponder)> {
6431        if let FrameRequest::ExecuteJavaScript { origins, script, responder } = self {
6432            Some((origins, script, responder))
6433        } else {
6434            None
6435        }
6436    }
6437
6438    #[allow(irrefutable_let_patterns)]
6439    pub fn into_execute_java_script_no_result(
6440        self,
6441    ) -> Option<(Vec<String>, fidl_fuchsia_mem::Buffer, FrameExecuteJavaScriptNoResultResponder)>
6442    {
6443        if let FrameRequest::ExecuteJavaScriptNoResult { origins, script, responder } = self {
6444            Some((origins, script, responder))
6445        } else {
6446            None
6447        }
6448    }
6449
6450    #[allow(irrefutable_let_patterns)]
6451    pub fn into_add_before_load_java_script(
6452        self,
6453    ) -> Option<(u64, Vec<String>, fidl_fuchsia_mem::Buffer, FrameAddBeforeLoadJavaScriptResponder)>
6454    {
6455        if let FrameRequest::AddBeforeLoadJavaScript { id, origins, script, responder } = self {
6456            Some((id, origins, script, responder))
6457        } else {
6458            None
6459        }
6460    }
6461
6462    #[allow(irrefutable_let_patterns)]
6463    pub fn into_remove_before_load_java_script(self) -> Option<(u64, FrameControlHandle)> {
6464        if let FrameRequest::RemoveBeforeLoadJavaScript { id, control_handle } = self {
6465            Some((id, control_handle))
6466        } else {
6467            None
6468        }
6469    }
6470
6471    #[allow(irrefutable_let_patterns)]
6472    pub fn into_post_message(self) -> Option<(String, WebMessage, FramePostMessageResponder)> {
6473        if let FrameRequest::PostMessage { target_origin, message, responder } = self {
6474            Some((target_origin, message, responder))
6475        } else {
6476            None
6477        }
6478    }
6479
6480    #[allow(irrefutable_let_patterns)]
6481    pub fn into_set_navigation_event_listener(
6482        self,
6483    ) -> Option<(
6484        Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6485        FrameControlHandle,
6486    )> {
6487        if let FrameRequest::SetNavigationEventListener { listener, control_handle } = self {
6488            Some((listener, control_handle))
6489        } else {
6490            None
6491        }
6492    }
6493
6494    #[allow(irrefutable_let_patterns)]
6495    pub fn into_set_navigation_event_listener2(
6496        self,
6497    ) -> Option<(
6498        Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6499        NavigationEventListenerFlags,
6500        FrameControlHandle,
6501    )> {
6502        if let FrameRequest::SetNavigationEventListener2 { listener, flags, control_handle } = self
6503        {
6504            Some((listener, flags, control_handle))
6505        } else {
6506            None
6507        }
6508    }
6509
6510    #[allow(irrefutable_let_patterns)]
6511    pub fn into_set_java_script_log_level(self) -> Option<(ConsoleLogLevel, FrameControlHandle)> {
6512        if let FrameRequest::SetJavaScriptLogLevel { level, control_handle } = self {
6513            Some((level, control_handle))
6514        } else {
6515            None
6516        }
6517    }
6518
6519    #[allow(irrefutable_let_patterns)]
6520    pub fn into_set_console_log_sink(
6521        self,
6522    ) -> Option<(
6523        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
6524        FrameControlHandle,
6525    )> {
6526        if let FrameRequest::SetConsoleLogSink { sink, control_handle } = self {
6527            Some((sink, control_handle))
6528        } else {
6529            None
6530        }
6531    }
6532
6533    #[allow(irrefutable_let_patterns)]
6534    pub fn into_configure_input_types(
6535        self,
6536    ) -> Option<(InputTypes, AllowInputState, FrameControlHandle)> {
6537        if let FrameRequest::ConfigureInputTypes { types, allow, control_handle } = self {
6538            Some((types, allow, control_handle))
6539        } else {
6540            None
6541        }
6542    }
6543
6544    #[allow(irrefutable_let_patterns)]
6545    pub fn into_set_popup_frame_creation_listener(
6546        self,
6547    ) -> Option<(
6548        Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
6549        FrameControlHandle,
6550    )> {
6551        if let FrameRequest::SetPopupFrameCreationListener { listener, control_handle } = self {
6552            Some((listener, control_handle))
6553        } else {
6554            None
6555        }
6556    }
6557
6558    #[allow(irrefutable_let_patterns)]
6559    pub fn into_set_url_request_rewrite_rules(
6560        self,
6561    ) -> Option<(Vec<UrlRequestRewriteRule>, FrameSetUrlRequestRewriteRulesResponder)> {
6562        if let FrameRequest::SetUrlRequestRewriteRules { rules, responder } = self {
6563            Some((rules, responder))
6564        } else {
6565            None
6566        }
6567    }
6568
6569    #[allow(irrefutable_let_patterns)]
6570    pub fn into_set_media_settings(self) -> Option<(FrameMediaSettings, FrameControlHandle)> {
6571        if let FrameRequest::SetMediaSettings { settings, control_handle } = self {
6572            Some((settings, control_handle))
6573        } else {
6574            None
6575        }
6576    }
6577
6578    #[allow(irrefutable_let_patterns)]
6579    pub fn into_force_content_dimensions(
6580        self,
6581    ) -> Option<(Option<Box<fidl_fuchsia_ui_gfx::Vec2>>, FrameControlHandle)> {
6582        if let FrameRequest::ForceContentDimensions { web_dips, control_handle } = self {
6583            Some((web_dips, control_handle))
6584        } else {
6585            None
6586        }
6587    }
6588
6589    #[allow(irrefutable_let_patterns)]
6590    pub fn into_set_permission_state(
6591        self,
6592    ) -> Option<(PermissionDescriptor, String, PermissionState, FrameControlHandle)> {
6593        if let FrameRequest::SetPermissionState { permission, web_origin, state, control_handle } =
6594            self
6595        {
6596            Some((permission, web_origin, state, control_handle))
6597        } else {
6598            None
6599        }
6600    }
6601
6602    #[allow(irrefutable_let_patterns)]
6603    pub fn into_set_block_media_loading(self) -> Option<(bool, FrameControlHandle)> {
6604        if let FrameRequest::SetBlockMediaLoading { blocked, control_handle } = self {
6605            Some((blocked, control_handle))
6606        } else {
6607            None
6608        }
6609    }
6610
6611    #[allow(irrefutable_let_patterns)]
6612    pub fn into_get_private_memory_size(self) -> Option<(FrameGetPrivateMemorySizeResponder)> {
6613        if let FrameRequest::GetPrivateMemorySize { responder } = self {
6614            Some((responder))
6615        } else {
6616            None
6617        }
6618    }
6619
6620    #[allow(irrefutable_let_patterns)]
6621    pub fn into_set_navigation_policy_provider(
6622        self,
6623    ) -> Option<(
6624        NavigationPolicyProviderParams,
6625        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
6626        FrameControlHandle,
6627    )> {
6628        if let FrameRequest::SetNavigationPolicyProvider { params, provider, control_handle } = self
6629        {
6630            Some((params, provider, control_handle))
6631        } else {
6632            None
6633        }
6634    }
6635
6636    #[allow(irrefutable_let_patterns)]
6637    pub fn into_set_content_area_settings(
6638        self,
6639    ) -> Option<(ContentAreaSettings, FrameControlHandle)> {
6640        if let FrameRequest::SetContentAreaSettings { settings, control_handle } = self {
6641            Some((settings, control_handle))
6642        } else {
6643            None
6644        }
6645    }
6646
6647    #[allow(irrefutable_let_patterns)]
6648    pub fn into_reset_content_area_settings(self) -> Option<(FrameControlHandle)> {
6649        if let FrameRequest::ResetContentAreaSettings { control_handle } = self {
6650            Some((control_handle))
6651        } else {
6652            None
6653        }
6654    }
6655
6656    #[allow(irrefutable_let_patterns)]
6657    pub fn into_close(self) -> Option<(FrameCloseRequest, FrameControlHandle)> {
6658        if let FrameRequest::Close { payload, control_handle } = self {
6659            Some((payload, control_handle))
6660        } else {
6661            None
6662        }
6663    }
6664
6665    /// Name of the method defined in FIDL
6666    pub fn method_name(&self) -> &'static str {
6667        match *self {
6668            FrameRequest::CreateView { .. } => "create_view",
6669            FrameRequest::CreateViewWithViewRef { .. } => "create_view_with_view_ref",
6670            FrameRequest::CreateView2 { .. } => "create_view2",
6671            FrameRequest::EnableHeadlessRendering { .. } => "enable_headless_rendering",
6672            FrameRequest::DisableHeadlessRendering { .. } => "disable_headless_rendering",
6673            FrameRequest::GetMediaPlayer { .. } => "get_media_player",
6674            FrameRequest::GetNavigationController { .. } => "get_navigation_controller",
6675            FrameRequest::ExecuteJavaScript { .. } => "execute_java_script",
6676            FrameRequest::ExecuteJavaScriptNoResult { .. } => "execute_java_script_no_result",
6677            FrameRequest::AddBeforeLoadJavaScript { .. } => "add_before_load_java_script",
6678            FrameRequest::RemoveBeforeLoadJavaScript { .. } => "remove_before_load_java_script",
6679            FrameRequest::PostMessage { .. } => "post_message",
6680            FrameRequest::SetNavigationEventListener { .. } => "set_navigation_event_listener",
6681            FrameRequest::SetNavigationEventListener2 { .. } => "set_navigation_event_listener2",
6682            FrameRequest::SetJavaScriptLogLevel { .. } => "set_java_script_log_level",
6683            FrameRequest::SetConsoleLogSink { .. } => "set_console_log_sink",
6684            FrameRequest::ConfigureInputTypes { .. } => "configure_input_types",
6685            FrameRequest::SetPopupFrameCreationListener { .. } => {
6686                "set_popup_frame_creation_listener"
6687            }
6688            FrameRequest::SetUrlRequestRewriteRules { .. } => "set_url_request_rewrite_rules",
6689            FrameRequest::SetMediaSettings { .. } => "set_media_settings",
6690            FrameRequest::ForceContentDimensions { .. } => "force_content_dimensions",
6691            FrameRequest::SetPermissionState { .. } => "set_permission_state",
6692            FrameRequest::SetBlockMediaLoading { .. } => "set_block_media_loading",
6693            FrameRequest::GetPrivateMemorySize { .. } => "get_private_memory_size",
6694            FrameRequest::SetNavigationPolicyProvider { .. } => "set_navigation_policy_provider",
6695            FrameRequest::SetContentAreaSettings { .. } => "set_content_area_settings",
6696            FrameRequest::ResetContentAreaSettings { .. } => "reset_content_area_settings",
6697            FrameRequest::Close { .. } => "close",
6698        }
6699    }
6700}
6701
6702#[derive(Debug, Clone)]
6703pub struct FrameControlHandle {
6704    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6705}
6706
6707impl fidl::endpoints::ControlHandle for FrameControlHandle {
6708    fn shutdown(&self) {
6709        self.inner.shutdown()
6710    }
6711
6712    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6713        self.inner.shutdown_with_epitaph(status)
6714    }
6715
6716    fn is_closed(&self) -> bool {
6717        self.inner.channel().is_closed()
6718    }
6719    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6720        self.inner.channel().on_closed()
6721    }
6722
6723    #[cfg(target_os = "fuchsia")]
6724    fn signal_peer(
6725        &self,
6726        clear_mask: zx::Signals,
6727        set_mask: zx::Signals,
6728    ) -> Result<(), zx_status::Status> {
6729        use fidl::Peered;
6730        self.inner.channel().signal_peer(clear_mask, set_mask)
6731    }
6732}
6733
6734impl FrameControlHandle {}
6735
6736#[must_use = "FIDL methods require a response to be sent"]
6737#[derive(Debug)]
6738pub struct FrameExecuteJavaScriptResponder {
6739    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6740    tx_id: u32,
6741}
6742
6743/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6744/// if the responder is dropped without sending a response, so that the client
6745/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6746impl std::ops::Drop for FrameExecuteJavaScriptResponder {
6747    fn drop(&mut self) {
6748        self.control_handle.shutdown();
6749        // Safety: drops once, never accessed again
6750        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6751    }
6752}
6753
6754impl fidl::endpoints::Responder for FrameExecuteJavaScriptResponder {
6755    type ControlHandle = FrameControlHandle;
6756
6757    fn control_handle(&self) -> &FrameControlHandle {
6758        &self.control_handle
6759    }
6760
6761    fn drop_without_shutdown(mut self) {
6762        // Safety: drops once, never accessed again due to mem::forget
6763        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6764        // Prevent Drop from running (which would shut down the channel)
6765        std::mem::forget(self);
6766    }
6767}
6768
6769impl FrameExecuteJavaScriptResponder {
6770    /// Sends a response to the FIDL transaction.
6771    ///
6772    /// Sets the channel to shutdown if an error occurs.
6773    pub fn send(
6774        self,
6775        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6776    ) -> Result<(), fidl::Error> {
6777        let _result = self.send_raw(result);
6778        if _result.is_err() {
6779            self.control_handle.shutdown();
6780        }
6781        self.drop_without_shutdown();
6782        _result
6783    }
6784
6785    /// Similar to "send" but does not shutdown the channel if an error occurs.
6786    pub fn send_no_shutdown_on_err(
6787        self,
6788        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6789    ) -> Result<(), fidl::Error> {
6790        let _result = self.send_raw(result);
6791        self.drop_without_shutdown();
6792        _result
6793    }
6794
6795    fn send_raw(
6796        &self,
6797        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6798    ) -> Result<(), fidl::Error> {
6799        self.control_handle.inner.send::<fidl::encoding::ResultType<
6800            FrameExecuteJavaScriptResponse,
6801            FrameError,
6802        >>(
6803            result.as_mut().map_err(|e| *e).map(|result| (result,)),
6804            self.tx_id,
6805            0x79abdd4907000542,
6806            fidl::encoding::DynamicFlags::empty(),
6807        )
6808    }
6809}
6810
6811#[must_use = "FIDL methods require a response to be sent"]
6812#[derive(Debug)]
6813pub struct FrameExecuteJavaScriptNoResultResponder {
6814    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6815    tx_id: u32,
6816}
6817
6818/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6819/// if the responder is dropped without sending a response, so that the client
6820/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6821impl std::ops::Drop for FrameExecuteJavaScriptNoResultResponder {
6822    fn drop(&mut self) {
6823        self.control_handle.shutdown();
6824        // Safety: drops once, never accessed again
6825        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6826    }
6827}
6828
6829impl fidl::endpoints::Responder for FrameExecuteJavaScriptNoResultResponder {
6830    type ControlHandle = FrameControlHandle;
6831
6832    fn control_handle(&self) -> &FrameControlHandle {
6833        &self.control_handle
6834    }
6835
6836    fn drop_without_shutdown(mut self) {
6837        // Safety: drops once, never accessed again due to mem::forget
6838        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6839        // Prevent Drop from running (which would shut down the channel)
6840        std::mem::forget(self);
6841    }
6842}
6843
6844impl FrameExecuteJavaScriptNoResultResponder {
6845    /// Sends a response to the FIDL transaction.
6846    ///
6847    /// Sets the channel to shutdown if an error occurs.
6848    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6849        let _result = self.send_raw(result);
6850        if _result.is_err() {
6851            self.control_handle.shutdown();
6852        }
6853        self.drop_without_shutdown();
6854        _result
6855    }
6856
6857    /// Similar to "send" but does not shutdown the channel if an error occurs.
6858    pub fn send_no_shutdown_on_err(
6859        self,
6860        mut result: Result<(), FrameError>,
6861    ) -> Result<(), fidl::Error> {
6862        let _result = self.send_raw(result);
6863        self.drop_without_shutdown();
6864        _result
6865    }
6866
6867    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6868        self.control_handle
6869            .inner
6870            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6871                result,
6872                self.tx_id,
6873                0x16b8491520cbcd63,
6874                fidl::encoding::DynamicFlags::empty(),
6875            )
6876    }
6877}
6878
6879#[must_use = "FIDL methods require a response to be sent"]
6880#[derive(Debug)]
6881pub struct FrameAddBeforeLoadJavaScriptResponder {
6882    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6883    tx_id: u32,
6884}
6885
6886/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6887/// if the responder is dropped without sending a response, so that the client
6888/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6889impl std::ops::Drop for FrameAddBeforeLoadJavaScriptResponder {
6890    fn drop(&mut self) {
6891        self.control_handle.shutdown();
6892        // Safety: drops once, never accessed again
6893        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6894    }
6895}
6896
6897impl fidl::endpoints::Responder for FrameAddBeforeLoadJavaScriptResponder {
6898    type ControlHandle = FrameControlHandle;
6899
6900    fn control_handle(&self) -> &FrameControlHandle {
6901        &self.control_handle
6902    }
6903
6904    fn drop_without_shutdown(mut self) {
6905        // Safety: drops once, never accessed again due to mem::forget
6906        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6907        // Prevent Drop from running (which would shut down the channel)
6908        std::mem::forget(self);
6909    }
6910}
6911
6912impl FrameAddBeforeLoadJavaScriptResponder {
6913    /// Sends a response to the FIDL transaction.
6914    ///
6915    /// Sets the channel to shutdown if an error occurs.
6916    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6917        let _result = self.send_raw(result);
6918        if _result.is_err() {
6919            self.control_handle.shutdown();
6920        }
6921        self.drop_without_shutdown();
6922        _result
6923    }
6924
6925    /// Similar to "send" but does not shutdown the channel if an error occurs.
6926    pub fn send_no_shutdown_on_err(
6927        self,
6928        mut result: Result<(), FrameError>,
6929    ) -> Result<(), fidl::Error> {
6930        let _result = self.send_raw(result);
6931        self.drop_without_shutdown();
6932        _result
6933    }
6934
6935    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6936        self.control_handle
6937            .inner
6938            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6939                result,
6940                self.tx_id,
6941                0x540ac0da59d823e,
6942                fidl::encoding::DynamicFlags::empty(),
6943            )
6944    }
6945}
6946
6947#[must_use = "FIDL methods require a response to be sent"]
6948#[derive(Debug)]
6949pub struct FramePostMessageResponder {
6950    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6951    tx_id: u32,
6952}
6953
6954/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6955/// if the responder is dropped without sending a response, so that the client
6956/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6957impl std::ops::Drop for FramePostMessageResponder {
6958    fn drop(&mut self) {
6959        self.control_handle.shutdown();
6960        // Safety: drops once, never accessed again
6961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6962    }
6963}
6964
6965impl fidl::endpoints::Responder for FramePostMessageResponder {
6966    type ControlHandle = FrameControlHandle;
6967
6968    fn control_handle(&self) -> &FrameControlHandle {
6969        &self.control_handle
6970    }
6971
6972    fn drop_without_shutdown(mut self) {
6973        // Safety: drops once, never accessed again due to mem::forget
6974        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6975        // Prevent Drop from running (which would shut down the channel)
6976        std::mem::forget(self);
6977    }
6978}
6979
6980impl FramePostMessageResponder {
6981    /// Sends a response to the FIDL transaction.
6982    ///
6983    /// Sets the channel to shutdown if an error occurs.
6984    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6985        let _result = self.send_raw(result);
6986        if _result.is_err() {
6987            self.control_handle.shutdown();
6988        }
6989        self.drop_without_shutdown();
6990        _result
6991    }
6992
6993    /// Similar to "send" but does not shutdown the channel if an error occurs.
6994    pub fn send_no_shutdown_on_err(
6995        self,
6996        mut result: Result<(), FrameError>,
6997    ) -> Result<(), fidl::Error> {
6998        let _result = self.send_raw(result);
6999        self.drop_without_shutdown();
7000        _result
7001    }
7002
7003    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
7004        self.control_handle
7005            .inner
7006            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
7007                result,
7008                self.tx_id,
7009                0x751d686eb7caa341,
7010                fidl::encoding::DynamicFlags::empty(),
7011            )
7012    }
7013}
7014
7015#[must_use = "FIDL methods require a response to be sent"]
7016#[derive(Debug)]
7017pub struct FrameSetUrlRequestRewriteRulesResponder {
7018    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
7019    tx_id: u32,
7020}
7021
7022/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
7023/// if the responder is dropped without sending a response, so that the client
7024/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7025impl std::ops::Drop for FrameSetUrlRequestRewriteRulesResponder {
7026    fn drop(&mut self) {
7027        self.control_handle.shutdown();
7028        // Safety: drops once, never accessed again
7029        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7030    }
7031}
7032
7033impl fidl::endpoints::Responder for FrameSetUrlRequestRewriteRulesResponder {
7034    type ControlHandle = FrameControlHandle;
7035
7036    fn control_handle(&self) -> &FrameControlHandle {
7037        &self.control_handle
7038    }
7039
7040    fn drop_without_shutdown(mut self) {
7041        // Safety: drops once, never accessed again due to mem::forget
7042        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7043        // Prevent Drop from running (which would shut down the channel)
7044        std::mem::forget(self);
7045    }
7046}
7047
7048impl FrameSetUrlRequestRewriteRulesResponder {
7049    /// Sends a response to the FIDL transaction.
7050    ///
7051    /// Sets the channel to shutdown if an error occurs.
7052    pub fn send(self) -> Result<(), fidl::Error> {
7053        let _result = self.send_raw();
7054        if _result.is_err() {
7055            self.control_handle.shutdown();
7056        }
7057        self.drop_without_shutdown();
7058        _result
7059    }
7060
7061    /// Similar to "send" but does not shutdown the channel if an error occurs.
7062    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7063        let _result = self.send_raw();
7064        self.drop_without_shutdown();
7065        _result
7066    }
7067
7068    fn send_raw(&self) -> Result<(), fidl::Error> {
7069        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7070            (),
7071            self.tx_id,
7072            0x2e3f797350ab3281,
7073            fidl::encoding::DynamicFlags::empty(),
7074        )
7075    }
7076}
7077
7078#[must_use = "FIDL methods require a response to be sent"]
7079#[derive(Debug)]
7080pub struct FrameGetPrivateMemorySizeResponder {
7081    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
7082    tx_id: u32,
7083}
7084
7085/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
7086/// if the responder is dropped without sending a response, so that the client
7087/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7088impl std::ops::Drop for FrameGetPrivateMemorySizeResponder {
7089    fn drop(&mut self) {
7090        self.control_handle.shutdown();
7091        // Safety: drops once, never accessed again
7092        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7093    }
7094}
7095
7096impl fidl::endpoints::Responder for FrameGetPrivateMemorySizeResponder {
7097    type ControlHandle = FrameControlHandle;
7098
7099    fn control_handle(&self) -> &FrameControlHandle {
7100        &self.control_handle
7101    }
7102
7103    fn drop_without_shutdown(mut self) {
7104        // Safety: drops once, never accessed again due to mem::forget
7105        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7106        // Prevent Drop from running (which would shut down the channel)
7107        std::mem::forget(self);
7108    }
7109}
7110
7111impl FrameGetPrivateMemorySizeResponder {
7112    /// Sends a response to the FIDL transaction.
7113    ///
7114    /// Sets the channel to shutdown if an error occurs.
7115    pub fn send(self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7116        let _result = self.send_raw(size_bytes);
7117        if _result.is_err() {
7118            self.control_handle.shutdown();
7119        }
7120        self.drop_without_shutdown();
7121        _result
7122    }
7123
7124    /// Similar to "send" but does not shutdown the channel if an error occurs.
7125    pub fn send_no_shutdown_on_err(self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7126        let _result = self.send_raw(size_bytes);
7127        self.drop_without_shutdown();
7128        _result
7129    }
7130
7131    fn send_raw(&self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7132        self.control_handle.inner.send::<FrameGetPrivateMemorySizeResponse>(
7133            (size_bytes,),
7134            self.tx_id,
7135            0x6ad4d43da6c129b0,
7136            fidl::encoding::DynamicFlags::empty(),
7137        )
7138    }
7139}
7140
7141#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7142pub struct FrameHostMarker;
7143
7144impl fidl::endpoints::ProtocolMarker for FrameHostMarker {
7145    type Proxy = FrameHostProxy;
7146    type RequestStream = FrameHostRequestStream;
7147    #[cfg(target_os = "fuchsia")]
7148    type SynchronousProxy = FrameHostSynchronousProxy;
7149
7150    const DEBUG_NAME: &'static str = "fuchsia.web.FrameHost";
7151}
7152impl fidl::endpoints::DiscoverableProtocolMarker for FrameHostMarker {}
7153
7154pub trait FrameHostProxyInterface: Send + Sync {
7155    fn r#create_frame_with_params(
7156        &self,
7157        params: CreateFrameParams,
7158        frame: fidl::endpoints::ServerEnd<FrameMarker>,
7159    ) -> Result<(), fidl::Error>;
7160}
7161#[derive(Debug)]
7162#[cfg(target_os = "fuchsia")]
7163pub struct FrameHostSynchronousProxy {
7164    client: fidl::client::sync::Client,
7165}
7166
7167#[cfg(target_os = "fuchsia")]
7168impl fidl::endpoints::SynchronousProxy for FrameHostSynchronousProxy {
7169    type Proxy = FrameHostProxy;
7170    type Protocol = FrameHostMarker;
7171
7172    fn from_channel(inner: fidl::Channel) -> Self {
7173        Self::new(inner)
7174    }
7175
7176    fn into_channel(self) -> fidl::Channel {
7177        self.client.into_channel()
7178    }
7179
7180    fn as_channel(&self) -> &fidl::Channel {
7181        self.client.as_channel()
7182    }
7183}
7184
7185#[cfg(target_os = "fuchsia")]
7186impl FrameHostSynchronousProxy {
7187    pub fn new(channel: fidl::Channel) -> Self {
7188        Self { client: fidl::client::sync::Client::new(channel) }
7189    }
7190
7191    pub fn into_channel(self) -> fidl::Channel {
7192        self.client.into_channel()
7193    }
7194
7195    /// Waits until an event arrives and returns it. It is safe for other
7196    /// threads to make concurrent requests while waiting for an event.
7197    pub fn wait_for_event(
7198        &self,
7199        deadline: zx::MonotonicInstant,
7200    ) -> Result<FrameHostEvent, fidl::Error> {
7201        FrameHostEvent::decode(self.client.wait_for_event::<FrameHostMarker>(deadline)?)
7202    }
7203
7204    /// Behaves identically to [`Context.CreateFrameWithParams`].
7205    pub fn r#create_frame_with_params(
7206        &self,
7207        mut params: CreateFrameParams,
7208        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7209    ) -> Result<(), fidl::Error> {
7210        self.client.send::<FrameHostCreateFrameWithParamsRequest>(
7211            (&mut params, frame),
7212            0x670186c3a1b3f28,
7213            fidl::encoding::DynamicFlags::empty(),
7214        )
7215    }
7216}
7217
7218#[cfg(target_os = "fuchsia")]
7219impl From<FrameHostSynchronousProxy> for zx::NullableHandle {
7220    fn from(value: FrameHostSynchronousProxy) -> Self {
7221        value.into_channel().into()
7222    }
7223}
7224
7225#[cfg(target_os = "fuchsia")]
7226impl From<fidl::Channel> for FrameHostSynchronousProxy {
7227    fn from(value: fidl::Channel) -> Self {
7228        Self::new(value)
7229    }
7230}
7231
7232#[cfg(target_os = "fuchsia")]
7233impl fidl::endpoints::FromClient for FrameHostSynchronousProxy {
7234    type Protocol = FrameHostMarker;
7235
7236    fn from_client(value: fidl::endpoints::ClientEnd<FrameHostMarker>) -> Self {
7237        Self::new(value.into_channel())
7238    }
7239}
7240
7241#[derive(Debug, Clone)]
7242pub struct FrameHostProxy {
7243    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7244}
7245
7246impl fidl::endpoints::Proxy for FrameHostProxy {
7247    type Protocol = FrameHostMarker;
7248
7249    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7250        Self::new(inner)
7251    }
7252
7253    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7254        self.client.into_channel().map_err(|client| Self { client })
7255    }
7256
7257    fn as_channel(&self) -> &::fidl::AsyncChannel {
7258        self.client.as_channel()
7259    }
7260}
7261
7262impl FrameHostProxy {
7263    /// Create a new Proxy for fuchsia.web/FrameHost.
7264    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7265        let protocol_name = <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7266        Self { client: fidl::client::Client::new(channel, protocol_name) }
7267    }
7268
7269    /// Get a Stream of events from the remote end of the protocol.
7270    ///
7271    /// # Panics
7272    ///
7273    /// Panics if the event stream was already taken.
7274    pub fn take_event_stream(&self) -> FrameHostEventStream {
7275        FrameHostEventStream { event_receiver: self.client.take_event_receiver() }
7276    }
7277
7278    /// Behaves identically to [`Context.CreateFrameWithParams`].
7279    pub fn r#create_frame_with_params(
7280        &self,
7281        mut params: CreateFrameParams,
7282        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7283    ) -> Result<(), fidl::Error> {
7284        FrameHostProxyInterface::r#create_frame_with_params(self, params, frame)
7285    }
7286}
7287
7288impl FrameHostProxyInterface for FrameHostProxy {
7289    fn r#create_frame_with_params(
7290        &self,
7291        mut params: CreateFrameParams,
7292        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7293    ) -> Result<(), fidl::Error> {
7294        self.client.send::<FrameHostCreateFrameWithParamsRequest>(
7295            (&mut params, frame),
7296            0x670186c3a1b3f28,
7297            fidl::encoding::DynamicFlags::empty(),
7298        )
7299    }
7300}
7301
7302pub struct FrameHostEventStream {
7303    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7304}
7305
7306impl std::marker::Unpin for FrameHostEventStream {}
7307
7308impl futures::stream::FusedStream for FrameHostEventStream {
7309    fn is_terminated(&self) -> bool {
7310        self.event_receiver.is_terminated()
7311    }
7312}
7313
7314impl futures::Stream for FrameHostEventStream {
7315    type Item = Result<FrameHostEvent, fidl::Error>;
7316
7317    fn poll_next(
7318        mut self: std::pin::Pin<&mut Self>,
7319        cx: &mut std::task::Context<'_>,
7320    ) -> std::task::Poll<Option<Self::Item>> {
7321        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7322            &mut self.event_receiver,
7323            cx
7324        )?) {
7325            Some(buf) => std::task::Poll::Ready(Some(FrameHostEvent::decode(buf))),
7326            None => std::task::Poll::Ready(None),
7327        }
7328    }
7329}
7330
7331#[derive(Debug)]
7332pub enum FrameHostEvent {}
7333
7334impl FrameHostEvent {
7335    /// Decodes a message buffer as a [`FrameHostEvent`].
7336    fn decode(
7337        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7338    ) -> Result<FrameHostEvent, fidl::Error> {
7339        let (bytes, _handles) = buf.split_mut();
7340        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7341        debug_assert_eq!(tx_header.tx_id, 0);
7342        match tx_header.ordinal {
7343            _ => Err(fidl::Error::UnknownOrdinal {
7344                ordinal: tx_header.ordinal,
7345                protocol_name: <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7346            }),
7347        }
7348    }
7349}
7350
7351/// A Stream of incoming requests for fuchsia.web/FrameHost.
7352pub struct FrameHostRequestStream {
7353    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7354    is_terminated: bool,
7355}
7356
7357impl std::marker::Unpin for FrameHostRequestStream {}
7358
7359impl futures::stream::FusedStream for FrameHostRequestStream {
7360    fn is_terminated(&self) -> bool {
7361        self.is_terminated
7362    }
7363}
7364
7365impl fidl::endpoints::RequestStream for FrameHostRequestStream {
7366    type Protocol = FrameHostMarker;
7367    type ControlHandle = FrameHostControlHandle;
7368
7369    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7370        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7371    }
7372
7373    fn control_handle(&self) -> Self::ControlHandle {
7374        FrameHostControlHandle { inner: self.inner.clone() }
7375    }
7376
7377    fn into_inner(
7378        self,
7379    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7380    {
7381        (self.inner, self.is_terminated)
7382    }
7383
7384    fn from_inner(
7385        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7386        is_terminated: bool,
7387    ) -> Self {
7388        Self { inner, is_terminated }
7389    }
7390}
7391
7392impl futures::Stream for FrameHostRequestStream {
7393    type Item = Result<FrameHostRequest, fidl::Error>;
7394
7395    fn poll_next(
7396        mut self: std::pin::Pin<&mut Self>,
7397        cx: &mut std::task::Context<'_>,
7398    ) -> std::task::Poll<Option<Self::Item>> {
7399        let this = &mut *self;
7400        if this.inner.check_shutdown(cx) {
7401            this.is_terminated = true;
7402            return std::task::Poll::Ready(None);
7403        }
7404        if this.is_terminated {
7405            panic!("polled FrameHostRequestStream after completion");
7406        }
7407        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7408            |bytes, handles| {
7409                match this.inner.channel().read_etc(cx, bytes, handles) {
7410                    std::task::Poll::Ready(Ok(())) => {}
7411                    std::task::Poll::Pending => return std::task::Poll::Pending,
7412                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7413                        this.is_terminated = true;
7414                        return std::task::Poll::Ready(None);
7415                    }
7416                    std::task::Poll::Ready(Err(e)) => {
7417                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7418                            e.into(),
7419                        ))));
7420                    }
7421                }
7422
7423                // A message has been received from the channel
7424                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7425
7426                std::task::Poll::Ready(Some(match header.ordinal {
7427                    0x670186c3a1b3f28 => {
7428                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7429                        let mut req = fidl::new_empty!(
7430                            FrameHostCreateFrameWithParamsRequest,
7431                            fidl::encoding::DefaultFuchsiaResourceDialect
7432                        );
7433                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameHostCreateFrameWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
7434                        let control_handle = FrameHostControlHandle { inner: this.inner.clone() };
7435                        Ok(FrameHostRequest::CreateFrameWithParams {
7436                            params: req.params,
7437                            frame: req.frame,
7438
7439                            control_handle,
7440                        })
7441                    }
7442                    _ => Err(fidl::Error::UnknownOrdinal {
7443                        ordinal: header.ordinal,
7444                        protocol_name:
7445                            <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7446                    }),
7447                }))
7448            },
7449        )
7450    }
7451}
7452
7453/// Used by [`Context`] clients to delegate [`Frame`] hosting capabilities to selected peers.
7454#[derive(Debug)]
7455pub enum FrameHostRequest {
7456    /// Behaves identically to [`Context.CreateFrameWithParams`].
7457    CreateFrameWithParams {
7458        params: CreateFrameParams,
7459        frame: fidl::endpoints::ServerEnd<FrameMarker>,
7460        control_handle: FrameHostControlHandle,
7461    },
7462}
7463
7464impl FrameHostRequest {
7465    #[allow(irrefutable_let_patterns)]
7466    pub fn into_create_frame_with_params(
7467        self,
7468    ) -> Option<(CreateFrameParams, fidl::endpoints::ServerEnd<FrameMarker>, FrameHostControlHandle)>
7469    {
7470        if let FrameHostRequest::CreateFrameWithParams { params, frame, control_handle } = self {
7471            Some((params, frame, control_handle))
7472        } else {
7473            None
7474        }
7475    }
7476
7477    /// Name of the method defined in FIDL
7478    pub fn method_name(&self) -> &'static str {
7479        match *self {
7480            FrameHostRequest::CreateFrameWithParams { .. } => "create_frame_with_params",
7481        }
7482    }
7483}
7484
7485#[derive(Debug, Clone)]
7486pub struct FrameHostControlHandle {
7487    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7488}
7489
7490impl fidl::endpoints::ControlHandle for FrameHostControlHandle {
7491    fn shutdown(&self) {
7492        self.inner.shutdown()
7493    }
7494
7495    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7496        self.inner.shutdown_with_epitaph(status)
7497    }
7498
7499    fn is_closed(&self) -> bool {
7500        self.inner.channel().is_closed()
7501    }
7502    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7503        self.inner.channel().on_closed()
7504    }
7505
7506    #[cfg(target_os = "fuchsia")]
7507    fn signal_peer(
7508        &self,
7509        clear_mask: zx::Signals,
7510        set_mask: zx::Signals,
7511    ) -> Result<(), zx_status::Status> {
7512        use fidl::Peered;
7513        self.inner.channel().signal_peer(clear_mask, set_mask)
7514    }
7515}
7516
7517impl FrameHostControlHandle {}
7518
7519#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7520pub struct MessagePortMarker;
7521
7522impl fidl::endpoints::ProtocolMarker for MessagePortMarker {
7523    type Proxy = MessagePortProxy;
7524    type RequestStream = MessagePortRequestStream;
7525    #[cfg(target_os = "fuchsia")]
7526    type SynchronousProxy = MessagePortSynchronousProxy;
7527
7528    const DEBUG_NAME: &'static str = "(anonymous) MessagePort";
7529}
7530pub type MessagePortPostMessageResult = Result<(), FrameError>;
7531
7532pub trait MessagePortProxyInterface: Send + Sync {
7533    type PostMessageResponseFut: std::future::Future<Output = Result<MessagePortPostMessageResult, fidl::Error>>
7534        + Send;
7535    fn r#post_message(&self, message: WebMessage) -> Self::PostMessageResponseFut;
7536    type ReceiveMessageResponseFut: std::future::Future<Output = Result<WebMessage, fidl::Error>>
7537        + Send;
7538    fn r#receive_message(&self) -> Self::ReceiveMessageResponseFut;
7539}
7540#[derive(Debug)]
7541#[cfg(target_os = "fuchsia")]
7542pub struct MessagePortSynchronousProxy {
7543    client: fidl::client::sync::Client,
7544}
7545
7546#[cfg(target_os = "fuchsia")]
7547impl fidl::endpoints::SynchronousProxy for MessagePortSynchronousProxy {
7548    type Proxy = MessagePortProxy;
7549    type Protocol = MessagePortMarker;
7550
7551    fn from_channel(inner: fidl::Channel) -> Self {
7552        Self::new(inner)
7553    }
7554
7555    fn into_channel(self) -> fidl::Channel {
7556        self.client.into_channel()
7557    }
7558
7559    fn as_channel(&self) -> &fidl::Channel {
7560        self.client.as_channel()
7561    }
7562}
7563
7564#[cfg(target_os = "fuchsia")]
7565impl MessagePortSynchronousProxy {
7566    pub fn new(channel: fidl::Channel) -> Self {
7567        Self { client: fidl::client::sync::Client::new(channel) }
7568    }
7569
7570    pub fn into_channel(self) -> fidl::Channel {
7571        self.client.into_channel()
7572    }
7573
7574    /// Waits until an event arrives and returns it. It is safe for other
7575    /// threads to make concurrent requests while waiting for an event.
7576    pub fn wait_for_event(
7577        &self,
7578        deadline: zx::MonotonicInstant,
7579    ) -> Result<MessagePortEvent, fidl::Error> {
7580        MessagePortEvent::decode(self.client.wait_for_event::<MessagePortMarker>(deadline)?)
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        ___deadline: zx::MonotonicInstant,
7594    ) -> Result<MessagePortPostMessageResult, fidl::Error> {
7595        let _response = self.client.send_query::<
7596            MessagePortPostMessageRequest,
7597            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
7598            MessagePortMarker,
7599        >(
7600            (&mut message,),
7601            0x2bcf0a6ed30ffd1f,
7602            fidl::encoding::DynamicFlags::empty(),
7603            ___deadline,
7604        )?;
7605        Ok(_response.map(|x| x))
7606    }
7607
7608    /// Asynchronously reads the next message from the channel. The client should invoke the
7609    /// callback when it is ready to process another message. Unreceived messages are buffered
7610    /// on the sender's side and bounded by its available resources.
7611    pub fn r#receive_message(
7612        &self,
7613        ___deadline: zx::MonotonicInstant,
7614    ) -> Result<WebMessage, fidl::Error> {
7615        let _response = self.client.send_query::<
7616            fidl::encoding::EmptyPayload,
7617            MessagePortReceiveMessageResponse,
7618            MessagePortMarker,
7619        >(
7620            (),
7621            0x6c8a6051690be58d,
7622            fidl::encoding::DynamicFlags::empty(),
7623            ___deadline,
7624        )?;
7625        Ok(_response.message)
7626    }
7627}
7628
7629#[cfg(target_os = "fuchsia")]
7630impl From<MessagePortSynchronousProxy> for zx::NullableHandle {
7631    fn from(value: MessagePortSynchronousProxy) -> Self {
7632        value.into_channel().into()
7633    }
7634}
7635
7636#[cfg(target_os = "fuchsia")]
7637impl From<fidl::Channel> for MessagePortSynchronousProxy {
7638    fn from(value: fidl::Channel) -> Self {
7639        Self::new(value)
7640    }
7641}
7642
7643#[cfg(target_os = "fuchsia")]
7644impl fidl::endpoints::FromClient for MessagePortSynchronousProxy {
7645    type Protocol = MessagePortMarker;
7646
7647    fn from_client(value: fidl::endpoints::ClientEnd<MessagePortMarker>) -> Self {
7648        Self::new(value.into_channel())
7649    }
7650}
7651
7652#[derive(Debug, Clone)]
7653pub struct MessagePortProxy {
7654    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7655}
7656
7657impl fidl::endpoints::Proxy for MessagePortProxy {
7658    type Protocol = MessagePortMarker;
7659
7660    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7661        Self::new(inner)
7662    }
7663
7664    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7665        self.client.into_channel().map_err(|client| Self { client })
7666    }
7667
7668    fn as_channel(&self) -> &::fidl::AsyncChannel {
7669        self.client.as_channel()
7670    }
7671}
7672
7673impl MessagePortProxy {
7674    /// Create a new Proxy for fuchsia.web/MessagePort.
7675    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7676        let protocol_name = <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7677        Self { client: fidl::client::Client::new(channel, protocol_name) }
7678    }
7679
7680    /// Get a Stream of events from the remote end of the protocol.
7681    ///
7682    /// # Panics
7683    ///
7684    /// Panics if the event stream was already taken.
7685    pub fn take_event_stream(&self) -> MessagePortEventStream {
7686        MessagePortEventStream { event_receiver: self.client.take_event_receiver() }
7687    }
7688
7689    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7690    /// time. It is not necessary for the caller to wait for the completion callback before calling
7691    /// [`MessagePort.PostMessage`] again.
7692    ///
7693    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7694    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7695    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7696    pub fn r#post_message(
7697        &self,
7698        mut message: WebMessage,
7699    ) -> fidl::client::QueryResponseFut<
7700        MessagePortPostMessageResult,
7701        fidl::encoding::DefaultFuchsiaResourceDialect,
7702    > {
7703        MessagePortProxyInterface::r#post_message(self, message)
7704    }
7705
7706    /// Asynchronously reads the next message from the channel. The client should invoke the
7707    /// callback when it is ready to process another message. Unreceived messages are buffered
7708    /// on the sender's side and bounded by its available resources.
7709    pub fn r#receive_message(
7710        &self,
7711    ) -> fidl::client::QueryResponseFut<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
7712    {
7713        MessagePortProxyInterface::r#receive_message(self)
7714    }
7715}
7716
7717impl MessagePortProxyInterface for MessagePortProxy {
7718    type PostMessageResponseFut = fidl::client::QueryResponseFut<
7719        MessagePortPostMessageResult,
7720        fidl::encoding::DefaultFuchsiaResourceDialect,
7721    >;
7722    fn r#post_message(&self, mut message: WebMessage) -> Self::PostMessageResponseFut {
7723        fn _decode(
7724            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7725        ) -> Result<MessagePortPostMessageResult, fidl::Error> {
7726            let _response = fidl::client::decode_transaction_body::<
7727                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
7728                fidl::encoding::DefaultFuchsiaResourceDialect,
7729                0x2bcf0a6ed30ffd1f,
7730            >(_buf?)?;
7731            Ok(_response.map(|x| x))
7732        }
7733        self.client
7734            .send_query_and_decode::<MessagePortPostMessageRequest, MessagePortPostMessageResult>(
7735                (&mut message,),
7736                0x2bcf0a6ed30ffd1f,
7737                fidl::encoding::DynamicFlags::empty(),
7738                _decode,
7739            )
7740    }
7741
7742    type ReceiveMessageResponseFut =
7743        fidl::client::QueryResponseFut<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>;
7744    fn r#receive_message(&self) -> Self::ReceiveMessageResponseFut {
7745        fn _decode(
7746            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7747        ) -> Result<WebMessage, fidl::Error> {
7748            let _response = fidl::client::decode_transaction_body::<
7749                MessagePortReceiveMessageResponse,
7750                fidl::encoding::DefaultFuchsiaResourceDialect,
7751                0x6c8a6051690be58d,
7752            >(_buf?)?;
7753            Ok(_response.message)
7754        }
7755        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WebMessage>(
7756            (),
7757            0x6c8a6051690be58d,
7758            fidl::encoding::DynamicFlags::empty(),
7759            _decode,
7760        )
7761    }
7762}
7763
7764pub struct MessagePortEventStream {
7765    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7766}
7767
7768impl std::marker::Unpin for MessagePortEventStream {}
7769
7770impl futures::stream::FusedStream for MessagePortEventStream {
7771    fn is_terminated(&self) -> bool {
7772        self.event_receiver.is_terminated()
7773    }
7774}
7775
7776impl futures::Stream for MessagePortEventStream {
7777    type Item = Result<MessagePortEvent, fidl::Error>;
7778
7779    fn poll_next(
7780        mut self: std::pin::Pin<&mut Self>,
7781        cx: &mut std::task::Context<'_>,
7782    ) -> std::task::Poll<Option<Self::Item>> {
7783        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7784            &mut self.event_receiver,
7785            cx
7786        )?) {
7787            Some(buf) => std::task::Poll::Ready(Some(MessagePortEvent::decode(buf))),
7788            None => std::task::Poll::Ready(None),
7789        }
7790    }
7791}
7792
7793#[derive(Debug)]
7794pub enum MessagePortEvent {}
7795
7796impl MessagePortEvent {
7797    /// Decodes a message buffer as a [`MessagePortEvent`].
7798    fn decode(
7799        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7800    ) -> Result<MessagePortEvent, fidl::Error> {
7801        let (bytes, _handles) = buf.split_mut();
7802        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7803        debug_assert_eq!(tx_header.tx_id, 0);
7804        match tx_header.ordinal {
7805            _ => Err(fidl::Error::UnknownOrdinal {
7806                ordinal: tx_header.ordinal,
7807                protocol_name: <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7808            }),
7809        }
7810    }
7811}
7812
7813/// A Stream of incoming requests for fuchsia.web/MessagePort.
7814pub struct MessagePortRequestStream {
7815    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7816    is_terminated: bool,
7817}
7818
7819impl std::marker::Unpin for MessagePortRequestStream {}
7820
7821impl futures::stream::FusedStream for MessagePortRequestStream {
7822    fn is_terminated(&self) -> bool {
7823        self.is_terminated
7824    }
7825}
7826
7827impl fidl::endpoints::RequestStream for MessagePortRequestStream {
7828    type Protocol = MessagePortMarker;
7829    type ControlHandle = MessagePortControlHandle;
7830
7831    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7832        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7833    }
7834
7835    fn control_handle(&self) -> Self::ControlHandle {
7836        MessagePortControlHandle { inner: self.inner.clone() }
7837    }
7838
7839    fn into_inner(
7840        self,
7841    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7842    {
7843        (self.inner, self.is_terminated)
7844    }
7845
7846    fn from_inner(
7847        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7848        is_terminated: bool,
7849    ) -> Self {
7850        Self { inner, is_terminated }
7851    }
7852}
7853
7854impl futures::Stream for MessagePortRequestStream {
7855    type Item = Result<MessagePortRequest, fidl::Error>;
7856
7857    fn poll_next(
7858        mut self: std::pin::Pin<&mut Self>,
7859        cx: &mut std::task::Context<'_>,
7860    ) -> std::task::Poll<Option<Self::Item>> {
7861        let this = &mut *self;
7862        if this.inner.check_shutdown(cx) {
7863            this.is_terminated = true;
7864            return std::task::Poll::Ready(None);
7865        }
7866        if this.is_terminated {
7867            panic!("polled MessagePortRequestStream after completion");
7868        }
7869        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7870            |bytes, handles| {
7871                match this.inner.channel().read_etc(cx, bytes, handles) {
7872                    std::task::Poll::Ready(Ok(())) => {}
7873                    std::task::Poll::Pending => return std::task::Poll::Pending,
7874                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7875                        this.is_terminated = true;
7876                        return std::task::Poll::Ready(None);
7877                    }
7878                    std::task::Poll::Ready(Err(e)) => {
7879                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7880                            e.into(),
7881                        ))));
7882                    }
7883                }
7884
7885                // A message has been received from the channel
7886                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7887
7888                std::task::Poll::Ready(Some(match header.ordinal {
7889                    0x2bcf0a6ed30ffd1f => {
7890                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7891                        let mut req = fidl::new_empty!(
7892                            MessagePortPostMessageRequest,
7893                            fidl::encoding::DefaultFuchsiaResourceDialect
7894                        );
7895                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MessagePortPostMessageRequest>(&header, _body_bytes, handles, &mut req)?;
7896                        let control_handle = MessagePortControlHandle { inner: this.inner.clone() };
7897                        Ok(MessagePortRequest::PostMessage {
7898                            message: req.message,
7899
7900                            responder: MessagePortPostMessageResponder {
7901                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7902                                tx_id: header.tx_id,
7903                            },
7904                        })
7905                    }
7906                    0x6c8a6051690be58d => {
7907                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7908                        let mut req = fidl::new_empty!(
7909                            fidl::encoding::EmptyPayload,
7910                            fidl::encoding::DefaultFuchsiaResourceDialect
7911                        );
7912                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7913                        let control_handle = MessagePortControlHandle { inner: this.inner.clone() };
7914                        Ok(MessagePortRequest::ReceiveMessage {
7915                            responder: MessagePortReceiveMessageResponder {
7916                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7917                                tx_id: header.tx_id,
7918                            },
7919                        })
7920                    }
7921                    _ => Err(fidl::Error::UnknownOrdinal {
7922                        ordinal: header.ordinal,
7923                        protocol_name:
7924                            <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7925                    }),
7926                }))
7927            },
7928        )
7929    }
7930}
7931
7932/// Represents one end of an HTML5 MessageChannel. Can be used to send and exchange Messages with
7933/// the peered MessagePort in the Frame's script context. The port is destroyed when either end of
7934/// the MessagePort channel is torn down.
7935#[derive(Debug)]
7936pub enum MessagePortRequest {
7937    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7938    /// time. It is not necessary for the caller to wait for the completion callback before calling
7939    /// [`MessagePort.PostMessage`] again.
7940    ///
7941    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7942    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7943    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7944    PostMessage { message: WebMessage, responder: MessagePortPostMessageResponder },
7945    /// Asynchronously reads the next message from the channel. The client should invoke the
7946    /// callback when it is ready to process another message. Unreceived messages are buffered
7947    /// on the sender's side and bounded by its available resources.
7948    ReceiveMessage { responder: MessagePortReceiveMessageResponder },
7949}
7950
7951impl MessagePortRequest {
7952    #[allow(irrefutable_let_patterns)]
7953    pub fn into_post_message(self) -> Option<(WebMessage, MessagePortPostMessageResponder)> {
7954        if let MessagePortRequest::PostMessage { message, responder } = self {
7955            Some((message, responder))
7956        } else {
7957            None
7958        }
7959    }
7960
7961    #[allow(irrefutable_let_patterns)]
7962    pub fn into_receive_message(self) -> Option<(MessagePortReceiveMessageResponder)> {
7963        if let MessagePortRequest::ReceiveMessage { responder } = self {
7964            Some((responder))
7965        } else {
7966            None
7967        }
7968    }
7969
7970    /// Name of the method defined in FIDL
7971    pub fn method_name(&self) -> &'static str {
7972        match *self {
7973            MessagePortRequest::PostMessage { .. } => "post_message",
7974            MessagePortRequest::ReceiveMessage { .. } => "receive_message",
7975        }
7976    }
7977}
7978
7979#[derive(Debug, Clone)]
7980pub struct MessagePortControlHandle {
7981    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7982}
7983
7984impl fidl::endpoints::ControlHandle for MessagePortControlHandle {
7985    fn shutdown(&self) {
7986        self.inner.shutdown()
7987    }
7988
7989    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7990        self.inner.shutdown_with_epitaph(status)
7991    }
7992
7993    fn is_closed(&self) -> bool {
7994        self.inner.channel().is_closed()
7995    }
7996    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7997        self.inner.channel().on_closed()
7998    }
7999
8000    #[cfg(target_os = "fuchsia")]
8001    fn signal_peer(
8002        &self,
8003        clear_mask: zx::Signals,
8004        set_mask: zx::Signals,
8005    ) -> Result<(), zx_status::Status> {
8006        use fidl::Peered;
8007        self.inner.channel().signal_peer(clear_mask, set_mask)
8008    }
8009}
8010
8011impl MessagePortControlHandle {}
8012
8013#[must_use = "FIDL methods require a response to be sent"]
8014#[derive(Debug)]
8015pub struct MessagePortPostMessageResponder {
8016    control_handle: std::mem::ManuallyDrop<MessagePortControlHandle>,
8017    tx_id: u32,
8018}
8019
8020/// Set the the channel to be shutdown (see [`MessagePortControlHandle::shutdown`])
8021/// if the responder is dropped without sending a response, so that the client
8022/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8023impl std::ops::Drop for MessagePortPostMessageResponder {
8024    fn drop(&mut self) {
8025        self.control_handle.shutdown();
8026        // Safety: drops once, never accessed again
8027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8028    }
8029}
8030
8031impl fidl::endpoints::Responder for MessagePortPostMessageResponder {
8032    type ControlHandle = MessagePortControlHandle;
8033
8034    fn control_handle(&self) -> &MessagePortControlHandle {
8035        &self.control_handle
8036    }
8037
8038    fn drop_without_shutdown(mut self) {
8039        // Safety: drops once, never accessed again due to mem::forget
8040        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8041        // Prevent Drop from running (which would shut down the channel)
8042        std::mem::forget(self);
8043    }
8044}
8045
8046impl MessagePortPostMessageResponder {
8047    /// Sends a response to the FIDL transaction.
8048    ///
8049    /// Sets the channel to shutdown if an error occurs.
8050    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
8051        let _result = self.send_raw(result);
8052        if _result.is_err() {
8053            self.control_handle.shutdown();
8054        }
8055        self.drop_without_shutdown();
8056        _result
8057    }
8058
8059    /// Similar to "send" but does not shutdown the channel if an error occurs.
8060    pub fn send_no_shutdown_on_err(
8061        self,
8062        mut result: Result<(), FrameError>,
8063    ) -> Result<(), fidl::Error> {
8064        let _result = self.send_raw(result);
8065        self.drop_without_shutdown();
8066        _result
8067    }
8068
8069    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
8070        self.control_handle
8071            .inner
8072            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
8073                result,
8074                self.tx_id,
8075                0x2bcf0a6ed30ffd1f,
8076                fidl::encoding::DynamicFlags::empty(),
8077            )
8078    }
8079}
8080
8081#[must_use = "FIDL methods require a response to be sent"]
8082#[derive(Debug)]
8083pub struct MessagePortReceiveMessageResponder {
8084    control_handle: std::mem::ManuallyDrop<MessagePortControlHandle>,
8085    tx_id: u32,
8086}
8087
8088/// Set the the channel to be shutdown (see [`MessagePortControlHandle::shutdown`])
8089/// if the responder is dropped without sending a response, so that the client
8090/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8091impl std::ops::Drop for MessagePortReceiveMessageResponder {
8092    fn drop(&mut self) {
8093        self.control_handle.shutdown();
8094        // Safety: drops once, never accessed again
8095        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8096    }
8097}
8098
8099impl fidl::endpoints::Responder for MessagePortReceiveMessageResponder {
8100    type ControlHandle = MessagePortControlHandle;
8101
8102    fn control_handle(&self) -> &MessagePortControlHandle {
8103        &self.control_handle
8104    }
8105
8106    fn drop_without_shutdown(mut self) {
8107        // Safety: drops once, never accessed again due to mem::forget
8108        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8109        // Prevent Drop from running (which would shut down the channel)
8110        std::mem::forget(self);
8111    }
8112}
8113
8114impl MessagePortReceiveMessageResponder {
8115    /// Sends a response to the FIDL transaction.
8116    ///
8117    /// Sets the channel to shutdown if an error occurs.
8118    pub fn send(self, mut message: WebMessage) -> Result<(), fidl::Error> {
8119        let _result = self.send_raw(message);
8120        if _result.is_err() {
8121            self.control_handle.shutdown();
8122        }
8123        self.drop_without_shutdown();
8124        _result
8125    }
8126
8127    /// Similar to "send" but does not shutdown the channel if an error occurs.
8128    pub fn send_no_shutdown_on_err(self, mut message: WebMessage) -> Result<(), fidl::Error> {
8129        let _result = self.send_raw(message);
8130        self.drop_without_shutdown();
8131        _result
8132    }
8133
8134    fn send_raw(&self, mut message: WebMessage) -> Result<(), fidl::Error> {
8135        self.control_handle.inner.send::<MessagePortReceiveMessageResponse>(
8136            (&mut message,),
8137            self.tx_id,
8138            0x6c8a6051690be58d,
8139            fidl::encoding::DynamicFlags::empty(),
8140        )
8141    }
8142}
8143
8144#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8145pub struct NavigationControllerMarker;
8146
8147impl fidl::endpoints::ProtocolMarker for NavigationControllerMarker {
8148    type Proxy = NavigationControllerProxy;
8149    type RequestStream = NavigationControllerRequestStream;
8150    #[cfg(target_os = "fuchsia")]
8151    type SynchronousProxy = NavigationControllerSynchronousProxy;
8152
8153    const DEBUG_NAME: &'static str = "(anonymous) NavigationController";
8154}
8155pub type NavigationControllerLoadUrlResult = Result<(), NavigationControllerError>;
8156
8157pub trait NavigationControllerProxyInterface: Send + Sync {
8158    type LoadUrlResponseFut: std::future::Future<Output = Result<NavigationControllerLoadUrlResult, fidl::Error>>
8159        + Send;
8160    fn r#load_url(&self, url: &str, params: LoadUrlParams) -> Self::LoadUrlResponseFut;
8161    fn r#go_back(&self) -> Result<(), fidl::Error>;
8162    fn r#go_forward(&self) -> Result<(), fidl::Error>;
8163    fn r#stop(&self) -> Result<(), fidl::Error>;
8164    fn r#reload(&self, type_: ReloadType) -> Result<(), fidl::Error>;
8165}
8166#[derive(Debug)]
8167#[cfg(target_os = "fuchsia")]
8168pub struct NavigationControllerSynchronousProxy {
8169    client: fidl::client::sync::Client,
8170}
8171
8172#[cfg(target_os = "fuchsia")]
8173impl fidl::endpoints::SynchronousProxy for NavigationControllerSynchronousProxy {
8174    type Proxy = NavigationControllerProxy;
8175    type Protocol = NavigationControllerMarker;
8176
8177    fn from_channel(inner: fidl::Channel) -> Self {
8178        Self::new(inner)
8179    }
8180
8181    fn into_channel(self) -> fidl::Channel {
8182        self.client.into_channel()
8183    }
8184
8185    fn as_channel(&self) -> &fidl::Channel {
8186        self.client.as_channel()
8187    }
8188}
8189
8190#[cfg(target_os = "fuchsia")]
8191impl NavigationControllerSynchronousProxy {
8192    pub fn new(channel: fidl::Channel) -> Self {
8193        Self { client: fidl::client::sync::Client::new(channel) }
8194    }
8195
8196    pub fn into_channel(self) -> fidl::Channel {
8197        self.client.into_channel()
8198    }
8199
8200    /// Waits until an event arrives and returns it. It is safe for other
8201    /// threads to make concurrent requests while waiting for an event.
8202    pub fn wait_for_event(
8203        &self,
8204        deadline: zx::MonotonicInstant,
8205    ) -> Result<NavigationControllerEvent, fidl::Error> {
8206        NavigationControllerEvent::decode(
8207            self.client.wait_for_event::<NavigationControllerMarker>(deadline)?,
8208        )
8209    }
8210
8211    /// Tells the [`Frame`] to navigate to a `url`.
8212    ///
8213    /// - `url`: The address to navigate to.
8214    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8215    ///   cookies, HTTP headers, etc.)
8216    ///
8217    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8218    /// - `INVALID_URL`: The `url` parameter is invalid.
8219    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8220    pub fn r#load_url(
8221        &self,
8222        mut url: &str,
8223        mut params: LoadUrlParams,
8224        ___deadline: zx::MonotonicInstant,
8225    ) -> Result<NavigationControllerLoadUrlResult, fidl::Error> {
8226        let _response =
8227            self.client
8228                .send_query::<NavigationControllerLoadUrlRequest, fidl::encoding::ResultType<
8229                    fidl::encoding::EmptyStruct,
8230                    NavigationControllerError,
8231                >, NavigationControllerMarker>(
8232                    (url, &mut params),
8233                    0x78f2ab0a480d0182,
8234                    fidl::encoding::DynamicFlags::empty(),
8235                    ___deadline,
8236                )?;
8237        Ok(_response.map(|x| x))
8238    }
8239
8240    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8241    pub fn r#go_back(&self) -> Result<(), fidl::Error> {
8242        self.client.send::<fidl::encoding::EmptyPayload>(
8243            (),
8244            0x2accdd8d87d89c38,
8245            fidl::encoding::DynamicFlags::empty(),
8246        )
8247    }
8248
8249    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8250    pub fn r#go_forward(&self) -> Result<(), fidl::Error> {
8251        self.client.send::<fidl::encoding::EmptyPayload>(
8252            (),
8253            0x39e4ac955ade2781,
8254            fidl::encoding::DynamicFlags::empty(),
8255        )
8256    }
8257
8258    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8259    pub fn r#stop(&self) -> Result<(), fidl::Error> {
8260        self.client.send::<fidl::encoding::EmptyPayload>(
8261            (),
8262            0x2383078ffbe6fea,
8263            fidl::encoding::DynamicFlags::empty(),
8264        )
8265    }
8266
8267    /// Tells the [`Frame`] to reload the current page.
8268    pub fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8269        self.client.send::<NavigationControllerReloadRequest>(
8270            (type_,),
8271            0x33faedfe67d6f00,
8272            fidl::encoding::DynamicFlags::empty(),
8273        )
8274    }
8275}
8276
8277#[cfg(target_os = "fuchsia")]
8278impl From<NavigationControllerSynchronousProxy> for zx::NullableHandle {
8279    fn from(value: NavigationControllerSynchronousProxy) -> Self {
8280        value.into_channel().into()
8281    }
8282}
8283
8284#[cfg(target_os = "fuchsia")]
8285impl From<fidl::Channel> for NavigationControllerSynchronousProxy {
8286    fn from(value: fidl::Channel) -> Self {
8287        Self::new(value)
8288    }
8289}
8290
8291#[cfg(target_os = "fuchsia")]
8292impl fidl::endpoints::FromClient for NavigationControllerSynchronousProxy {
8293    type Protocol = NavigationControllerMarker;
8294
8295    fn from_client(value: fidl::endpoints::ClientEnd<NavigationControllerMarker>) -> Self {
8296        Self::new(value.into_channel())
8297    }
8298}
8299
8300#[derive(Debug, Clone)]
8301pub struct NavigationControllerProxy {
8302    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8303}
8304
8305impl fidl::endpoints::Proxy for NavigationControllerProxy {
8306    type Protocol = NavigationControllerMarker;
8307
8308    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8309        Self::new(inner)
8310    }
8311
8312    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8313        self.client.into_channel().map_err(|client| Self { client })
8314    }
8315
8316    fn as_channel(&self) -> &::fidl::AsyncChannel {
8317        self.client.as_channel()
8318    }
8319}
8320
8321impl NavigationControllerProxy {
8322    /// Create a new Proxy for fuchsia.web/NavigationController.
8323    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8324        let protocol_name =
8325            <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8326        Self { client: fidl::client::Client::new(channel, protocol_name) }
8327    }
8328
8329    /// Get a Stream of events from the remote end of the protocol.
8330    ///
8331    /// # Panics
8332    ///
8333    /// Panics if the event stream was already taken.
8334    pub fn take_event_stream(&self) -> NavigationControllerEventStream {
8335        NavigationControllerEventStream { event_receiver: self.client.take_event_receiver() }
8336    }
8337
8338    /// Tells the [`Frame`] to navigate to a `url`.
8339    ///
8340    /// - `url`: The address to navigate to.
8341    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8342    ///   cookies, HTTP headers, etc.)
8343    ///
8344    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8345    /// - `INVALID_URL`: The `url` parameter is invalid.
8346    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8347    pub fn r#load_url(
8348        &self,
8349        mut url: &str,
8350        mut params: LoadUrlParams,
8351    ) -> fidl::client::QueryResponseFut<
8352        NavigationControllerLoadUrlResult,
8353        fidl::encoding::DefaultFuchsiaResourceDialect,
8354    > {
8355        NavigationControllerProxyInterface::r#load_url(self, url, params)
8356    }
8357
8358    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8359    pub fn r#go_back(&self) -> Result<(), fidl::Error> {
8360        NavigationControllerProxyInterface::r#go_back(self)
8361    }
8362
8363    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8364    pub fn r#go_forward(&self) -> Result<(), fidl::Error> {
8365        NavigationControllerProxyInterface::r#go_forward(self)
8366    }
8367
8368    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8369    pub fn r#stop(&self) -> Result<(), fidl::Error> {
8370        NavigationControllerProxyInterface::r#stop(self)
8371    }
8372
8373    /// Tells the [`Frame`] to reload the current page.
8374    pub fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8375        NavigationControllerProxyInterface::r#reload(self, type_)
8376    }
8377}
8378
8379impl NavigationControllerProxyInterface for NavigationControllerProxy {
8380    type LoadUrlResponseFut = fidl::client::QueryResponseFut<
8381        NavigationControllerLoadUrlResult,
8382        fidl::encoding::DefaultFuchsiaResourceDialect,
8383    >;
8384    fn r#load_url(&self, mut url: &str, mut params: LoadUrlParams) -> Self::LoadUrlResponseFut {
8385        fn _decode(
8386            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8387        ) -> Result<NavigationControllerLoadUrlResult, fidl::Error> {
8388            let _response = fidl::client::decode_transaction_body::<
8389                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NavigationControllerError>,
8390                fidl::encoding::DefaultFuchsiaResourceDialect,
8391                0x78f2ab0a480d0182,
8392            >(_buf?)?;
8393            Ok(_response.map(|x| x))
8394        }
8395        self.client.send_query_and_decode::<
8396            NavigationControllerLoadUrlRequest,
8397            NavigationControllerLoadUrlResult,
8398        >(
8399            (url, &mut params,),
8400            0x78f2ab0a480d0182,
8401            fidl::encoding::DynamicFlags::empty(),
8402            _decode,
8403        )
8404    }
8405
8406    fn r#go_back(&self) -> Result<(), fidl::Error> {
8407        self.client.send::<fidl::encoding::EmptyPayload>(
8408            (),
8409            0x2accdd8d87d89c38,
8410            fidl::encoding::DynamicFlags::empty(),
8411        )
8412    }
8413
8414    fn r#go_forward(&self) -> Result<(), fidl::Error> {
8415        self.client.send::<fidl::encoding::EmptyPayload>(
8416            (),
8417            0x39e4ac955ade2781,
8418            fidl::encoding::DynamicFlags::empty(),
8419        )
8420    }
8421
8422    fn r#stop(&self) -> Result<(), fidl::Error> {
8423        self.client.send::<fidl::encoding::EmptyPayload>(
8424            (),
8425            0x2383078ffbe6fea,
8426            fidl::encoding::DynamicFlags::empty(),
8427        )
8428    }
8429
8430    fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8431        self.client.send::<NavigationControllerReloadRequest>(
8432            (type_,),
8433            0x33faedfe67d6f00,
8434            fidl::encoding::DynamicFlags::empty(),
8435        )
8436    }
8437}
8438
8439pub struct NavigationControllerEventStream {
8440    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8441}
8442
8443impl std::marker::Unpin for NavigationControllerEventStream {}
8444
8445impl futures::stream::FusedStream for NavigationControllerEventStream {
8446    fn is_terminated(&self) -> bool {
8447        self.event_receiver.is_terminated()
8448    }
8449}
8450
8451impl futures::Stream for NavigationControllerEventStream {
8452    type Item = Result<NavigationControllerEvent, fidl::Error>;
8453
8454    fn poll_next(
8455        mut self: std::pin::Pin<&mut Self>,
8456        cx: &mut std::task::Context<'_>,
8457    ) -> std::task::Poll<Option<Self::Item>> {
8458        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8459            &mut self.event_receiver,
8460            cx
8461        )?) {
8462            Some(buf) => std::task::Poll::Ready(Some(NavigationControllerEvent::decode(buf))),
8463            None => std::task::Poll::Ready(None),
8464        }
8465    }
8466}
8467
8468#[derive(Debug)]
8469pub enum NavigationControllerEvent {}
8470
8471impl NavigationControllerEvent {
8472    /// Decodes a message buffer as a [`NavigationControllerEvent`].
8473    fn decode(
8474        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8475    ) -> Result<NavigationControllerEvent, fidl::Error> {
8476        let (bytes, _handles) = buf.split_mut();
8477        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8478        debug_assert_eq!(tx_header.tx_id, 0);
8479        match tx_header.ordinal {
8480            _ => Err(fidl::Error::UnknownOrdinal {
8481                ordinal: tx_header.ordinal,
8482                protocol_name:
8483                    <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8484            }),
8485        }
8486    }
8487}
8488
8489/// A Stream of incoming requests for fuchsia.web/NavigationController.
8490pub struct NavigationControllerRequestStream {
8491    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8492    is_terminated: bool,
8493}
8494
8495impl std::marker::Unpin for NavigationControllerRequestStream {}
8496
8497impl futures::stream::FusedStream for NavigationControllerRequestStream {
8498    fn is_terminated(&self) -> bool {
8499        self.is_terminated
8500    }
8501}
8502
8503impl fidl::endpoints::RequestStream for NavigationControllerRequestStream {
8504    type Protocol = NavigationControllerMarker;
8505    type ControlHandle = NavigationControllerControlHandle;
8506
8507    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8508        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8509    }
8510
8511    fn control_handle(&self) -> Self::ControlHandle {
8512        NavigationControllerControlHandle { inner: self.inner.clone() }
8513    }
8514
8515    fn into_inner(
8516        self,
8517    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8518    {
8519        (self.inner, self.is_terminated)
8520    }
8521
8522    fn from_inner(
8523        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8524        is_terminated: bool,
8525    ) -> Self {
8526        Self { inner, is_terminated }
8527    }
8528}
8529
8530impl futures::Stream for NavigationControllerRequestStream {
8531    type Item = Result<NavigationControllerRequest, fidl::Error>;
8532
8533    fn poll_next(
8534        mut self: std::pin::Pin<&mut Self>,
8535        cx: &mut std::task::Context<'_>,
8536    ) -> std::task::Poll<Option<Self::Item>> {
8537        let this = &mut *self;
8538        if this.inner.check_shutdown(cx) {
8539            this.is_terminated = true;
8540            return std::task::Poll::Ready(None);
8541        }
8542        if this.is_terminated {
8543            panic!("polled NavigationControllerRequestStream after completion");
8544        }
8545        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8546            |bytes, handles| {
8547                match this.inner.channel().read_etc(cx, bytes, handles) {
8548                    std::task::Poll::Ready(Ok(())) => {}
8549                    std::task::Poll::Pending => return std::task::Poll::Pending,
8550                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8551                        this.is_terminated = true;
8552                        return std::task::Poll::Ready(None);
8553                    }
8554                    std::task::Poll::Ready(Err(e)) => {
8555                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8556                            e.into(),
8557                        ))));
8558                    }
8559                }
8560
8561                // A message has been received from the channel
8562                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8563
8564                std::task::Poll::Ready(Some(match header.ordinal {
8565                0x78f2ab0a480d0182 => {
8566                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8567                    let mut req = fidl::new_empty!(NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8568                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationControllerLoadUrlRequest>(&header, _body_bytes, handles, &mut req)?;
8569                    let control_handle = NavigationControllerControlHandle {
8570                        inner: this.inner.clone(),
8571                    };
8572                    Ok(NavigationControllerRequest::LoadUrl {url: req.url,
8573params: req.params,
8574
8575                        responder: NavigationControllerLoadUrlResponder {
8576                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8577                            tx_id: header.tx_id,
8578                        },
8579                    })
8580                }
8581                0x2accdd8d87d89c38 => {
8582                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8583                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8584                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8585                    let control_handle = NavigationControllerControlHandle {
8586                        inner: this.inner.clone(),
8587                    };
8588                    Ok(NavigationControllerRequest::GoBack {
8589                        control_handle,
8590                    })
8591                }
8592                0x39e4ac955ade2781 => {
8593                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8594                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8595                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8596                    let control_handle = NavigationControllerControlHandle {
8597                        inner: this.inner.clone(),
8598                    };
8599                    Ok(NavigationControllerRequest::GoForward {
8600                        control_handle,
8601                    })
8602                }
8603                0x2383078ffbe6fea => {
8604                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8605                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8606                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8607                    let control_handle = NavigationControllerControlHandle {
8608                        inner: this.inner.clone(),
8609                    };
8610                    Ok(NavigationControllerRequest::Stop {
8611                        control_handle,
8612                    })
8613                }
8614                0x33faedfe67d6f00 => {
8615                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8616                    let mut req = fidl::new_empty!(NavigationControllerReloadRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8617                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationControllerReloadRequest>(&header, _body_bytes, handles, &mut req)?;
8618                    let control_handle = NavigationControllerControlHandle {
8619                        inner: this.inner.clone(),
8620                    };
8621                    Ok(NavigationControllerRequest::Reload {type_: req.type_,
8622
8623                        control_handle,
8624                    })
8625                }
8626                _ => Err(fidl::Error::UnknownOrdinal {
8627                    ordinal: header.ordinal,
8628                    protocol_name: <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8629                }),
8630            }))
8631            },
8632        )
8633    }
8634}
8635
8636/// Provides methods for controlling and querying the navigation state of a [`Frame`].
8637#[derive(Debug)]
8638pub enum NavigationControllerRequest {
8639    /// Tells the [`Frame`] to navigate to a `url`.
8640    ///
8641    /// - `url`: The address to navigate to.
8642    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8643    ///   cookies, HTTP headers, etc.)
8644    ///
8645    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8646    /// - `INVALID_URL`: The `url` parameter is invalid.
8647    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8648    LoadUrl { url: String, params: LoadUrlParams, responder: NavigationControllerLoadUrlResponder },
8649    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8650    GoBack { control_handle: NavigationControllerControlHandle },
8651    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8652    GoForward { control_handle: NavigationControllerControlHandle },
8653    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8654    Stop { control_handle: NavigationControllerControlHandle },
8655    /// Tells the [`Frame`] to reload the current page.
8656    Reload { type_: ReloadType, control_handle: NavigationControllerControlHandle },
8657}
8658
8659impl NavigationControllerRequest {
8660    #[allow(irrefutable_let_patterns)]
8661    pub fn into_load_url(
8662        self,
8663    ) -> Option<(String, LoadUrlParams, NavigationControllerLoadUrlResponder)> {
8664        if let NavigationControllerRequest::LoadUrl { url, params, responder } = self {
8665            Some((url, params, responder))
8666        } else {
8667            None
8668        }
8669    }
8670
8671    #[allow(irrefutable_let_patterns)]
8672    pub fn into_go_back(self) -> Option<(NavigationControllerControlHandle)> {
8673        if let NavigationControllerRequest::GoBack { control_handle } = self {
8674            Some((control_handle))
8675        } else {
8676            None
8677        }
8678    }
8679
8680    #[allow(irrefutable_let_patterns)]
8681    pub fn into_go_forward(self) -> Option<(NavigationControllerControlHandle)> {
8682        if let NavigationControllerRequest::GoForward { control_handle } = self {
8683            Some((control_handle))
8684        } else {
8685            None
8686        }
8687    }
8688
8689    #[allow(irrefutable_let_patterns)]
8690    pub fn into_stop(self) -> Option<(NavigationControllerControlHandle)> {
8691        if let NavigationControllerRequest::Stop { control_handle } = self {
8692            Some((control_handle))
8693        } else {
8694            None
8695        }
8696    }
8697
8698    #[allow(irrefutable_let_patterns)]
8699    pub fn into_reload(self) -> Option<(ReloadType, NavigationControllerControlHandle)> {
8700        if let NavigationControllerRequest::Reload { type_, control_handle } = self {
8701            Some((type_, control_handle))
8702        } else {
8703            None
8704        }
8705    }
8706
8707    /// Name of the method defined in FIDL
8708    pub fn method_name(&self) -> &'static str {
8709        match *self {
8710            NavigationControllerRequest::LoadUrl { .. } => "load_url",
8711            NavigationControllerRequest::GoBack { .. } => "go_back",
8712            NavigationControllerRequest::GoForward { .. } => "go_forward",
8713            NavigationControllerRequest::Stop { .. } => "stop",
8714            NavigationControllerRequest::Reload { .. } => "reload",
8715        }
8716    }
8717}
8718
8719#[derive(Debug, Clone)]
8720pub struct NavigationControllerControlHandle {
8721    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8722}
8723
8724impl fidl::endpoints::ControlHandle for NavigationControllerControlHandle {
8725    fn shutdown(&self) {
8726        self.inner.shutdown()
8727    }
8728
8729    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8730        self.inner.shutdown_with_epitaph(status)
8731    }
8732
8733    fn is_closed(&self) -> bool {
8734        self.inner.channel().is_closed()
8735    }
8736    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8737        self.inner.channel().on_closed()
8738    }
8739
8740    #[cfg(target_os = "fuchsia")]
8741    fn signal_peer(
8742        &self,
8743        clear_mask: zx::Signals,
8744        set_mask: zx::Signals,
8745    ) -> Result<(), zx_status::Status> {
8746        use fidl::Peered;
8747        self.inner.channel().signal_peer(clear_mask, set_mask)
8748    }
8749}
8750
8751impl NavigationControllerControlHandle {}
8752
8753#[must_use = "FIDL methods require a response to be sent"]
8754#[derive(Debug)]
8755pub struct NavigationControllerLoadUrlResponder {
8756    control_handle: std::mem::ManuallyDrop<NavigationControllerControlHandle>,
8757    tx_id: u32,
8758}
8759
8760/// Set the the channel to be shutdown (see [`NavigationControllerControlHandle::shutdown`])
8761/// if the responder is dropped without sending a response, so that the client
8762/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8763impl std::ops::Drop for NavigationControllerLoadUrlResponder {
8764    fn drop(&mut self) {
8765        self.control_handle.shutdown();
8766        // Safety: drops once, never accessed again
8767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8768    }
8769}
8770
8771impl fidl::endpoints::Responder for NavigationControllerLoadUrlResponder {
8772    type ControlHandle = NavigationControllerControlHandle;
8773
8774    fn control_handle(&self) -> &NavigationControllerControlHandle {
8775        &self.control_handle
8776    }
8777
8778    fn drop_without_shutdown(mut self) {
8779        // Safety: drops once, never accessed again due to mem::forget
8780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8781        // Prevent Drop from running (which would shut down the channel)
8782        std::mem::forget(self);
8783    }
8784}
8785
8786impl NavigationControllerLoadUrlResponder {
8787    /// Sends a response to the FIDL transaction.
8788    ///
8789    /// Sets the channel to shutdown if an error occurs.
8790    pub fn send(
8791        self,
8792        mut result: Result<(), NavigationControllerError>,
8793    ) -> Result<(), fidl::Error> {
8794        let _result = self.send_raw(result);
8795        if _result.is_err() {
8796            self.control_handle.shutdown();
8797        }
8798        self.drop_without_shutdown();
8799        _result
8800    }
8801
8802    /// Similar to "send" but does not shutdown the channel if an error occurs.
8803    pub fn send_no_shutdown_on_err(
8804        self,
8805        mut result: Result<(), NavigationControllerError>,
8806    ) -> Result<(), fidl::Error> {
8807        let _result = self.send_raw(result);
8808        self.drop_without_shutdown();
8809        _result
8810    }
8811
8812    fn send_raw(
8813        &self,
8814        mut result: Result<(), NavigationControllerError>,
8815    ) -> Result<(), fidl::Error> {
8816        self.control_handle.inner.send::<fidl::encoding::ResultType<
8817            fidl::encoding::EmptyStruct,
8818            NavigationControllerError,
8819        >>(
8820            result,
8821            self.tx_id,
8822            0x78f2ab0a480d0182,
8823            fidl::encoding::DynamicFlags::empty(),
8824        )
8825    }
8826}
8827
8828#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8829pub struct NavigationEventListenerMarker;
8830
8831impl fidl::endpoints::ProtocolMarker for NavigationEventListenerMarker {
8832    type Proxy = NavigationEventListenerProxy;
8833    type RequestStream = NavigationEventListenerRequestStream;
8834    #[cfg(target_os = "fuchsia")]
8835    type SynchronousProxy = NavigationEventListenerSynchronousProxy;
8836
8837    const DEBUG_NAME: &'static str = "(anonymous) NavigationEventListener";
8838}
8839
8840pub trait NavigationEventListenerProxyInterface: Send + Sync {
8841    type OnNavigationStateChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
8842        + Send;
8843    fn r#on_navigation_state_changed(
8844        &self,
8845        change: NavigationState,
8846    ) -> Self::OnNavigationStateChangedResponseFut;
8847}
8848#[derive(Debug)]
8849#[cfg(target_os = "fuchsia")]
8850pub struct NavigationEventListenerSynchronousProxy {
8851    client: fidl::client::sync::Client,
8852}
8853
8854#[cfg(target_os = "fuchsia")]
8855impl fidl::endpoints::SynchronousProxy for NavigationEventListenerSynchronousProxy {
8856    type Proxy = NavigationEventListenerProxy;
8857    type Protocol = NavigationEventListenerMarker;
8858
8859    fn from_channel(inner: fidl::Channel) -> Self {
8860        Self::new(inner)
8861    }
8862
8863    fn into_channel(self) -> fidl::Channel {
8864        self.client.into_channel()
8865    }
8866
8867    fn as_channel(&self) -> &fidl::Channel {
8868        self.client.as_channel()
8869    }
8870}
8871
8872#[cfg(target_os = "fuchsia")]
8873impl NavigationEventListenerSynchronousProxy {
8874    pub fn new(channel: fidl::Channel) -> Self {
8875        Self { client: fidl::client::sync::Client::new(channel) }
8876    }
8877
8878    pub fn into_channel(self) -> fidl::Channel {
8879        self.client.into_channel()
8880    }
8881
8882    /// Waits until an event arrives and returns it. It is safe for other
8883    /// threads to make concurrent requests while waiting for an event.
8884    pub fn wait_for_event(
8885        &self,
8886        deadline: zx::MonotonicInstant,
8887    ) -> Result<NavigationEventListenerEvent, fidl::Error> {
8888        NavigationEventListenerEvent::decode(
8889            self.client.wait_for_event::<NavigationEventListenerMarker>(deadline)?,
8890        )
8891    }
8892
8893    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
8894    /// navigation state has changed. In the first call, `change` contains the current navigation
8895    /// state (empty before the first navigation request). In every following call, `change` will
8896    /// have values set for all fields that have changed at any time since the previous
8897    /// notification. This means that some fields may have the same value as was previously
8898    /// reported, for example, if they changed to some other value and back again. If a field is
8899    /// unset, then its value has not changed at any time since the previous notification.
8900    ///
8901    /// Implementer must call the acknowledgement callback to receive new navigation events.
8902    pub fn r#on_navigation_state_changed(
8903        &self,
8904        mut change: NavigationState,
8905        ___deadline: zx::MonotonicInstant,
8906    ) -> Result<(), fidl::Error> {
8907        let _response = self.client.send_query::<
8908            NavigationEventListenerOnNavigationStateChangedRequest,
8909            fidl::encoding::EmptyPayload,
8910            NavigationEventListenerMarker,
8911        >(
8912            (&mut change,),
8913            0x453ac6bcbc82fbb6,
8914            fidl::encoding::DynamicFlags::empty(),
8915            ___deadline,
8916        )?;
8917        Ok(_response)
8918    }
8919}
8920
8921#[cfg(target_os = "fuchsia")]
8922impl From<NavigationEventListenerSynchronousProxy> for zx::NullableHandle {
8923    fn from(value: NavigationEventListenerSynchronousProxy) -> Self {
8924        value.into_channel().into()
8925    }
8926}
8927
8928#[cfg(target_os = "fuchsia")]
8929impl From<fidl::Channel> for NavigationEventListenerSynchronousProxy {
8930    fn from(value: fidl::Channel) -> Self {
8931        Self::new(value)
8932    }
8933}
8934
8935#[cfg(target_os = "fuchsia")]
8936impl fidl::endpoints::FromClient for NavigationEventListenerSynchronousProxy {
8937    type Protocol = NavigationEventListenerMarker;
8938
8939    fn from_client(value: fidl::endpoints::ClientEnd<NavigationEventListenerMarker>) -> Self {
8940        Self::new(value.into_channel())
8941    }
8942}
8943
8944#[derive(Debug, Clone)]
8945pub struct NavigationEventListenerProxy {
8946    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8947}
8948
8949impl fidl::endpoints::Proxy for NavigationEventListenerProxy {
8950    type Protocol = NavigationEventListenerMarker;
8951
8952    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8953        Self::new(inner)
8954    }
8955
8956    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8957        self.client.into_channel().map_err(|client| Self { client })
8958    }
8959
8960    fn as_channel(&self) -> &::fidl::AsyncChannel {
8961        self.client.as_channel()
8962    }
8963}
8964
8965impl NavigationEventListenerProxy {
8966    /// Create a new Proxy for fuchsia.web/NavigationEventListener.
8967    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8968        let protocol_name =
8969            <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8970        Self { client: fidl::client::Client::new(channel, protocol_name) }
8971    }
8972
8973    /// Get a Stream of events from the remote end of the protocol.
8974    ///
8975    /// # Panics
8976    ///
8977    /// Panics if the event stream was already taken.
8978    pub fn take_event_stream(&self) -> NavigationEventListenerEventStream {
8979        NavigationEventListenerEventStream { event_receiver: self.client.take_event_receiver() }
8980    }
8981
8982    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
8983    /// navigation state has changed. In the first call, `change` contains the current navigation
8984    /// state (empty before the first navigation request). In every following call, `change` will
8985    /// have values set for all fields that have changed at any time since the previous
8986    /// notification. This means that some fields may have the same value as was previously
8987    /// reported, for example, if they changed to some other value and back again. If a field is
8988    /// unset, then its value has not changed at any time since the previous notification.
8989    ///
8990    /// Implementer must call the acknowledgement callback to receive new navigation events.
8991    pub fn r#on_navigation_state_changed(
8992        &self,
8993        mut change: NavigationState,
8994    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8995        NavigationEventListenerProxyInterface::r#on_navigation_state_changed(self, change)
8996    }
8997}
8998
8999impl NavigationEventListenerProxyInterface for NavigationEventListenerProxy {
9000    type OnNavigationStateChangedResponseFut =
9001        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9002    fn r#on_navigation_state_changed(
9003        &self,
9004        mut change: NavigationState,
9005    ) -> Self::OnNavigationStateChangedResponseFut {
9006        fn _decode(
9007            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9008        ) -> Result<(), fidl::Error> {
9009            let _response = fidl::client::decode_transaction_body::<
9010                fidl::encoding::EmptyPayload,
9011                fidl::encoding::DefaultFuchsiaResourceDialect,
9012                0x453ac6bcbc82fbb6,
9013            >(_buf?)?;
9014            Ok(_response)
9015        }
9016        self.client
9017            .send_query_and_decode::<NavigationEventListenerOnNavigationStateChangedRequest, ()>(
9018                (&mut change,),
9019                0x453ac6bcbc82fbb6,
9020                fidl::encoding::DynamicFlags::empty(),
9021                _decode,
9022            )
9023    }
9024}
9025
9026pub struct NavigationEventListenerEventStream {
9027    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9028}
9029
9030impl std::marker::Unpin for NavigationEventListenerEventStream {}
9031
9032impl futures::stream::FusedStream for NavigationEventListenerEventStream {
9033    fn is_terminated(&self) -> bool {
9034        self.event_receiver.is_terminated()
9035    }
9036}
9037
9038impl futures::Stream for NavigationEventListenerEventStream {
9039    type Item = Result<NavigationEventListenerEvent, fidl::Error>;
9040
9041    fn poll_next(
9042        mut self: std::pin::Pin<&mut Self>,
9043        cx: &mut std::task::Context<'_>,
9044    ) -> std::task::Poll<Option<Self::Item>> {
9045        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9046            &mut self.event_receiver,
9047            cx
9048        )?) {
9049            Some(buf) => std::task::Poll::Ready(Some(NavigationEventListenerEvent::decode(buf))),
9050            None => std::task::Poll::Ready(None),
9051        }
9052    }
9053}
9054
9055#[derive(Debug)]
9056pub enum NavigationEventListenerEvent {}
9057
9058impl NavigationEventListenerEvent {
9059    /// Decodes a message buffer as a [`NavigationEventListenerEvent`].
9060    fn decode(
9061        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9062    ) -> Result<NavigationEventListenerEvent, fidl::Error> {
9063        let (bytes, _handles) = buf.split_mut();
9064        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9065        debug_assert_eq!(tx_header.tx_id, 0);
9066        match tx_header.ordinal {
9067            _ => Err(fidl::Error::UnknownOrdinal {
9068                ordinal: tx_header.ordinal,
9069                protocol_name:
9070                    <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9071            }),
9072        }
9073    }
9074}
9075
9076/// A Stream of incoming requests for fuchsia.web/NavigationEventListener.
9077pub struct NavigationEventListenerRequestStream {
9078    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9079    is_terminated: bool,
9080}
9081
9082impl std::marker::Unpin for NavigationEventListenerRequestStream {}
9083
9084impl futures::stream::FusedStream for NavigationEventListenerRequestStream {
9085    fn is_terminated(&self) -> bool {
9086        self.is_terminated
9087    }
9088}
9089
9090impl fidl::endpoints::RequestStream for NavigationEventListenerRequestStream {
9091    type Protocol = NavigationEventListenerMarker;
9092    type ControlHandle = NavigationEventListenerControlHandle;
9093
9094    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9095        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9096    }
9097
9098    fn control_handle(&self) -> Self::ControlHandle {
9099        NavigationEventListenerControlHandle { inner: self.inner.clone() }
9100    }
9101
9102    fn into_inner(
9103        self,
9104    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9105    {
9106        (self.inner, self.is_terminated)
9107    }
9108
9109    fn from_inner(
9110        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9111        is_terminated: bool,
9112    ) -> Self {
9113        Self { inner, is_terminated }
9114    }
9115}
9116
9117impl futures::Stream for NavigationEventListenerRequestStream {
9118    type Item = Result<NavigationEventListenerRequest, fidl::Error>;
9119
9120    fn poll_next(
9121        mut self: std::pin::Pin<&mut Self>,
9122        cx: &mut std::task::Context<'_>,
9123    ) -> std::task::Poll<Option<Self::Item>> {
9124        let this = &mut *self;
9125        if this.inner.check_shutdown(cx) {
9126            this.is_terminated = true;
9127            return std::task::Poll::Ready(None);
9128        }
9129        if this.is_terminated {
9130            panic!("polled NavigationEventListenerRequestStream after completion");
9131        }
9132        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9133            |bytes, handles| {
9134                match this.inner.channel().read_etc(cx, bytes, handles) {
9135                    std::task::Poll::Ready(Ok(())) => {}
9136                    std::task::Poll::Pending => return std::task::Poll::Pending,
9137                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9138                        this.is_terminated = true;
9139                        return std::task::Poll::Ready(None);
9140                    }
9141                    std::task::Poll::Ready(Err(e)) => {
9142                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9143                            e.into(),
9144                        ))));
9145                    }
9146                }
9147
9148                // A message has been received from the channel
9149                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9150
9151                std::task::Poll::Ready(Some(match header.ordinal {
9152                0x453ac6bcbc82fbb6 => {
9153                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9154                    let mut req = fidl::new_empty!(NavigationEventListenerOnNavigationStateChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9155                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationEventListenerOnNavigationStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
9156                    let control_handle = NavigationEventListenerControlHandle {
9157                        inner: this.inner.clone(),
9158                    };
9159                    Ok(NavigationEventListenerRequest::OnNavigationStateChanged {change: req.change,
9160
9161                        responder: NavigationEventListenerOnNavigationStateChangedResponder {
9162                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9163                            tx_id: header.tx_id,
9164                        },
9165                    })
9166                }
9167                _ => Err(fidl::Error::UnknownOrdinal {
9168                    ordinal: header.ordinal,
9169                    protocol_name: <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9170                }),
9171            }))
9172            },
9173        )
9174    }
9175}
9176
9177/// Interface supplied by the embedder for receiving notifications about navigation events in a
9178/// [`Frame`].
9179#[derive(Debug)]
9180pub enum NavigationEventListenerRequest {
9181    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
9182    /// navigation state has changed. In the first call, `change` contains the current navigation
9183    /// state (empty before the first navigation request). In every following call, `change` will
9184    /// have values set for all fields that have changed at any time since the previous
9185    /// notification. This means that some fields may have the same value as was previously
9186    /// reported, for example, if they changed to some other value and back again. If a field is
9187    /// unset, then its value has not changed at any time since the previous notification.
9188    ///
9189    /// Implementer must call the acknowledgement callback to receive new navigation events.
9190    OnNavigationStateChanged {
9191        change: NavigationState,
9192        responder: NavigationEventListenerOnNavigationStateChangedResponder,
9193    },
9194}
9195
9196impl NavigationEventListenerRequest {
9197    #[allow(irrefutable_let_patterns)]
9198    pub fn into_on_navigation_state_changed(
9199        self,
9200    ) -> Option<(NavigationState, NavigationEventListenerOnNavigationStateChangedResponder)> {
9201        if let NavigationEventListenerRequest::OnNavigationStateChanged { change, responder } = self
9202        {
9203            Some((change, responder))
9204        } else {
9205            None
9206        }
9207    }
9208
9209    /// Name of the method defined in FIDL
9210    pub fn method_name(&self) -> &'static str {
9211        match *self {
9212            NavigationEventListenerRequest::OnNavigationStateChanged { .. } => {
9213                "on_navigation_state_changed"
9214            }
9215        }
9216    }
9217}
9218
9219#[derive(Debug, Clone)]
9220pub struct NavigationEventListenerControlHandle {
9221    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9222}
9223
9224impl fidl::endpoints::ControlHandle for NavigationEventListenerControlHandle {
9225    fn shutdown(&self) {
9226        self.inner.shutdown()
9227    }
9228
9229    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9230        self.inner.shutdown_with_epitaph(status)
9231    }
9232
9233    fn is_closed(&self) -> bool {
9234        self.inner.channel().is_closed()
9235    }
9236    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9237        self.inner.channel().on_closed()
9238    }
9239
9240    #[cfg(target_os = "fuchsia")]
9241    fn signal_peer(
9242        &self,
9243        clear_mask: zx::Signals,
9244        set_mask: zx::Signals,
9245    ) -> Result<(), zx_status::Status> {
9246        use fidl::Peered;
9247        self.inner.channel().signal_peer(clear_mask, set_mask)
9248    }
9249}
9250
9251impl NavigationEventListenerControlHandle {}
9252
9253#[must_use = "FIDL methods require a response to be sent"]
9254#[derive(Debug)]
9255pub struct NavigationEventListenerOnNavigationStateChangedResponder {
9256    control_handle: std::mem::ManuallyDrop<NavigationEventListenerControlHandle>,
9257    tx_id: u32,
9258}
9259
9260/// Set the the channel to be shutdown (see [`NavigationEventListenerControlHandle::shutdown`])
9261/// if the responder is dropped without sending a response, so that the client
9262/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9263impl std::ops::Drop for NavigationEventListenerOnNavigationStateChangedResponder {
9264    fn drop(&mut self) {
9265        self.control_handle.shutdown();
9266        // Safety: drops once, never accessed again
9267        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9268    }
9269}
9270
9271impl fidl::endpoints::Responder for NavigationEventListenerOnNavigationStateChangedResponder {
9272    type ControlHandle = NavigationEventListenerControlHandle;
9273
9274    fn control_handle(&self) -> &NavigationEventListenerControlHandle {
9275        &self.control_handle
9276    }
9277
9278    fn drop_without_shutdown(mut self) {
9279        // Safety: drops once, never accessed again due to mem::forget
9280        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9281        // Prevent Drop from running (which would shut down the channel)
9282        std::mem::forget(self);
9283    }
9284}
9285
9286impl NavigationEventListenerOnNavigationStateChangedResponder {
9287    /// Sends a response to the FIDL transaction.
9288    ///
9289    /// Sets the channel to shutdown if an error occurs.
9290    pub fn send(self) -> Result<(), fidl::Error> {
9291        let _result = self.send_raw();
9292        if _result.is_err() {
9293            self.control_handle.shutdown();
9294        }
9295        self.drop_without_shutdown();
9296        _result
9297    }
9298
9299    /// Similar to "send" but does not shutdown the channel if an error occurs.
9300    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9301        let _result = self.send_raw();
9302        self.drop_without_shutdown();
9303        _result
9304    }
9305
9306    fn send_raw(&self) -> Result<(), fidl::Error> {
9307        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9308            (),
9309            self.tx_id,
9310            0x453ac6bcbc82fbb6,
9311            fidl::encoding::DynamicFlags::empty(),
9312        )
9313    }
9314}
9315
9316#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9317pub struct NavigationPolicyProviderMarker;
9318
9319impl fidl::endpoints::ProtocolMarker for NavigationPolicyProviderMarker {
9320    type Proxy = NavigationPolicyProviderProxy;
9321    type RequestStream = NavigationPolicyProviderRequestStream;
9322    #[cfg(target_os = "fuchsia")]
9323    type SynchronousProxy = NavigationPolicyProviderSynchronousProxy;
9324
9325    const DEBUG_NAME: &'static str = "(anonymous) NavigationPolicyProvider";
9326}
9327
9328pub trait NavigationPolicyProviderProxyInterface: Send + Sync {
9329    type EvaluateRequestedNavigationResponseFut: std::future::Future<Output = Result<NavigationDecision, fidl::Error>>
9330        + Send;
9331    fn r#evaluate_requested_navigation(
9332        &self,
9333        requested_navigation: &RequestedNavigation,
9334    ) -> Self::EvaluateRequestedNavigationResponseFut;
9335}
9336#[derive(Debug)]
9337#[cfg(target_os = "fuchsia")]
9338pub struct NavigationPolicyProviderSynchronousProxy {
9339    client: fidl::client::sync::Client,
9340}
9341
9342#[cfg(target_os = "fuchsia")]
9343impl fidl::endpoints::SynchronousProxy for NavigationPolicyProviderSynchronousProxy {
9344    type Proxy = NavigationPolicyProviderProxy;
9345    type Protocol = NavigationPolicyProviderMarker;
9346
9347    fn from_channel(inner: fidl::Channel) -> Self {
9348        Self::new(inner)
9349    }
9350
9351    fn into_channel(self) -> fidl::Channel {
9352        self.client.into_channel()
9353    }
9354
9355    fn as_channel(&self) -> &fidl::Channel {
9356        self.client.as_channel()
9357    }
9358}
9359
9360#[cfg(target_os = "fuchsia")]
9361impl NavigationPolicyProviderSynchronousProxy {
9362    pub fn new(channel: fidl::Channel) -> Self {
9363        Self { client: fidl::client::sync::Client::new(channel) }
9364    }
9365
9366    pub fn into_channel(self) -> fidl::Channel {
9367        self.client.into_channel()
9368    }
9369
9370    /// Waits until an event arrives and returns it. It is safe for other
9371    /// threads to make concurrent requests while waiting for an event.
9372    pub fn wait_for_event(
9373        &self,
9374        deadline: zx::MonotonicInstant,
9375    ) -> Result<NavigationPolicyProviderEvent, fidl::Error> {
9376        NavigationPolicyProviderEvent::decode(
9377            self.client.wait_for_event::<NavigationPolicyProviderMarker>(deadline)?,
9378        )
9379    }
9380
9381    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9382    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9383    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9384    pub fn r#evaluate_requested_navigation(
9385        &self,
9386        mut requested_navigation: &RequestedNavigation,
9387        ___deadline: zx::MonotonicInstant,
9388    ) -> Result<NavigationDecision, fidl::Error> {
9389        let _response = self.client.send_query::<
9390            NavigationPolicyProviderEvaluateRequestedNavigationRequest,
9391            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
9392            NavigationPolicyProviderMarker,
9393        >(
9394            (requested_navigation,),
9395            0x54446b50cf3512b6,
9396            fidl::encoding::DynamicFlags::empty(),
9397            ___deadline,
9398        )?;
9399        Ok(_response.decision)
9400    }
9401}
9402
9403#[cfg(target_os = "fuchsia")]
9404impl From<NavigationPolicyProviderSynchronousProxy> for zx::NullableHandle {
9405    fn from(value: NavigationPolicyProviderSynchronousProxy) -> Self {
9406        value.into_channel().into()
9407    }
9408}
9409
9410#[cfg(target_os = "fuchsia")]
9411impl From<fidl::Channel> for NavigationPolicyProviderSynchronousProxy {
9412    fn from(value: fidl::Channel) -> Self {
9413        Self::new(value)
9414    }
9415}
9416
9417#[cfg(target_os = "fuchsia")]
9418impl fidl::endpoints::FromClient for NavigationPolicyProviderSynchronousProxy {
9419    type Protocol = NavigationPolicyProviderMarker;
9420
9421    fn from_client(value: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>) -> Self {
9422        Self::new(value.into_channel())
9423    }
9424}
9425
9426#[derive(Debug, Clone)]
9427pub struct NavigationPolicyProviderProxy {
9428    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9429}
9430
9431impl fidl::endpoints::Proxy for NavigationPolicyProviderProxy {
9432    type Protocol = NavigationPolicyProviderMarker;
9433
9434    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9435        Self::new(inner)
9436    }
9437
9438    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9439        self.client.into_channel().map_err(|client| Self { client })
9440    }
9441
9442    fn as_channel(&self) -> &::fidl::AsyncChannel {
9443        self.client.as_channel()
9444    }
9445}
9446
9447impl NavigationPolicyProviderProxy {
9448    /// Create a new Proxy for fuchsia.web/NavigationPolicyProvider.
9449    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9450        let protocol_name =
9451            <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9452        Self { client: fidl::client::Client::new(channel, protocol_name) }
9453    }
9454
9455    /// Get a Stream of events from the remote end of the protocol.
9456    ///
9457    /// # Panics
9458    ///
9459    /// Panics if the event stream was already taken.
9460    pub fn take_event_stream(&self) -> NavigationPolicyProviderEventStream {
9461        NavigationPolicyProviderEventStream { event_receiver: self.client.take_event_receiver() }
9462    }
9463
9464    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9465    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9466    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9467    pub fn r#evaluate_requested_navigation(
9468        &self,
9469        mut requested_navigation: &RequestedNavigation,
9470    ) -> fidl::client::QueryResponseFut<
9471        NavigationDecision,
9472        fidl::encoding::DefaultFuchsiaResourceDialect,
9473    > {
9474        NavigationPolicyProviderProxyInterface::r#evaluate_requested_navigation(
9475            self,
9476            requested_navigation,
9477        )
9478    }
9479}
9480
9481impl NavigationPolicyProviderProxyInterface for NavigationPolicyProviderProxy {
9482    type EvaluateRequestedNavigationResponseFut = fidl::client::QueryResponseFut<
9483        NavigationDecision,
9484        fidl::encoding::DefaultFuchsiaResourceDialect,
9485    >;
9486    fn r#evaluate_requested_navigation(
9487        &self,
9488        mut requested_navigation: &RequestedNavigation,
9489    ) -> Self::EvaluateRequestedNavigationResponseFut {
9490        fn _decode(
9491            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9492        ) -> Result<NavigationDecision, fidl::Error> {
9493            let _response = fidl::client::decode_transaction_body::<
9494                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
9495                fidl::encoding::DefaultFuchsiaResourceDialect,
9496                0x54446b50cf3512b6,
9497            >(_buf?)?;
9498            Ok(_response.decision)
9499        }
9500        self.client.send_query_and_decode::<
9501            NavigationPolicyProviderEvaluateRequestedNavigationRequest,
9502            NavigationDecision,
9503        >(
9504            (requested_navigation,),
9505            0x54446b50cf3512b6,
9506            fidl::encoding::DynamicFlags::empty(),
9507            _decode,
9508        )
9509    }
9510}
9511
9512pub struct NavigationPolicyProviderEventStream {
9513    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9514}
9515
9516impl std::marker::Unpin for NavigationPolicyProviderEventStream {}
9517
9518impl futures::stream::FusedStream for NavigationPolicyProviderEventStream {
9519    fn is_terminated(&self) -> bool {
9520        self.event_receiver.is_terminated()
9521    }
9522}
9523
9524impl futures::Stream for NavigationPolicyProviderEventStream {
9525    type Item = Result<NavigationPolicyProviderEvent, fidl::Error>;
9526
9527    fn poll_next(
9528        mut self: std::pin::Pin<&mut Self>,
9529        cx: &mut std::task::Context<'_>,
9530    ) -> std::task::Poll<Option<Self::Item>> {
9531        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9532            &mut self.event_receiver,
9533            cx
9534        )?) {
9535            Some(buf) => std::task::Poll::Ready(Some(NavigationPolicyProviderEvent::decode(buf))),
9536            None => std::task::Poll::Ready(None),
9537        }
9538    }
9539}
9540
9541#[derive(Debug)]
9542pub enum NavigationPolicyProviderEvent {}
9543
9544impl NavigationPolicyProviderEvent {
9545    /// Decodes a message buffer as a [`NavigationPolicyProviderEvent`].
9546    fn decode(
9547        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9548    ) -> Result<NavigationPolicyProviderEvent, fidl::Error> {
9549        let (bytes, _handles) = buf.split_mut();
9550        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9551        debug_assert_eq!(tx_header.tx_id, 0);
9552        match tx_header.ordinal {
9553            _ => Err(fidl::Error::UnknownOrdinal {
9554                ordinal: tx_header.ordinal,
9555                protocol_name:
9556                    <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9557            }),
9558        }
9559    }
9560}
9561
9562/// A Stream of incoming requests for fuchsia.web/NavigationPolicyProvider.
9563pub struct NavigationPolicyProviderRequestStream {
9564    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9565    is_terminated: bool,
9566}
9567
9568impl std::marker::Unpin for NavigationPolicyProviderRequestStream {}
9569
9570impl futures::stream::FusedStream for NavigationPolicyProviderRequestStream {
9571    fn is_terminated(&self) -> bool {
9572        self.is_terminated
9573    }
9574}
9575
9576impl fidl::endpoints::RequestStream for NavigationPolicyProviderRequestStream {
9577    type Protocol = NavigationPolicyProviderMarker;
9578    type ControlHandle = NavigationPolicyProviderControlHandle;
9579
9580    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9581        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9582    }
9583
9584    fn control_handle(&self) -> Self::ControlHandle {
9585        NavigationPolicyProviderControlHandle { inner: self.inner.clone() }
9586    }
9587
9588    fn into_inner(
9589        self,
9590    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9591    {
9592        (self.inner, self.is_terminated)
9593    }
9594
9595    fn from_inner(
9596        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9597        is_terminated: bool,
9598    ) -> Self {
9599        Self { inner, is_terminated }
9600    }
9601}
9602
9603impl futures::Stream for NavigationPolicyProviderRequestStream {
9604    type Item = Result<NavigationPolicyProviderRequest, fidl::Error>;
9605
9606    fn poll_next(
9607        mut self: std::pin::Pin<&mut Self>,
9608        cx: &mut std::task::Context<'_>,
9609    ) -> std::task::Poll<Option<Self::Item>> {
9610        let this = &mut *self;
9611        if this.inner.check_shutdown(cx) {
9612            this.is_terminated = true;
9613            return std::task::Poll::Ready(None);
9614        }
9615        if this.is_terminated {
9616            panic!("polled NavigationPolicyProviderRequestStream after completion");
9617        }
9618        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9619            |bytes, handles| {
9620                match this.inner.channel().read_etc(cx, bytes, handles) {
9621                    std::task::Poll::Ready(Ok(())) => {}
9622                    std::task::Poll::Pending => return std::task::Poll::Pending,
9623                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9624                        this.is_terminated = true;
9625                        return std::task::Poll::Ready(None);
9626                    }
9627                    std::task::Poll::Ready(Err(e)) => {
9628                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9629                            e.into(),
9630                        ))));
9631                    }
9632                }
9633
9634                // A message has been received from the channel
9635                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9636
9637                std::task::Poll::Ready(Some(match header.ordinal {
9638                0x54446b50cf3512b6 => {
9639                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9640                    let mut req = fidl::new_empty!(NavigationPolicyProviderEvaluateRequestedNavigationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9641                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationPolicyProviderEvaluateRequestedNavigationRequest>(&header, _body_bytes, handles, &mut req)?;
9642                    let control_handle = NavigationPolicyProviderControlHandle {
9643                        inner: this.inner.clone(),
9644                    };
9645                    Ok(NavigationPolicyProviderRequest::EvaluateRequestedNavigation {requested_navigation: req.requested_navigation,
9646
9647                        responder: NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9648                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9649                            tx_id: header.tx_id,
9650                        },
9651                    })
9652                }
9653                _ => Err(fidl::Error::UnknownOrdinal {
9654                    ordinal: header.ordinal,
9655                    protocol_name: <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9656                }),
9657            }))
9658            },
9659        )
9660    }
9661}
9662
9663#[derive(Debug)]
9664pub enum NavigationPolicyProviderRequest {
9665    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9666    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9667    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9668    EvaluateRequestedNavigation {
9669        requested_navigation: RequestedNavigation,
9670        responder: NavigationPolicyProviderEvaluateRequestedNavigationResponder,
9671    },
9672}
9673
9674impl NavigationPolicyProviderRequest {
9675    #[allow(irrefutable_let_patterns)]
9676    pub fn into_evaluate_requested_navigation(
9677        self,
9678    ) -> Option<(RequestedNavigation, NavigationPolicyProviderEvaluateRequestedNavigationResponder)>
9679    {
9680        if let NavigationPolicyProviderRequest::EvaluateRequestedNavigation {
9681            requested_navigation,
9682            responder,
9683        } = self
9684        {
9685            Some((requested_navigation, responder))
9686        } else {
9687            None
9688        }
9689    }
9690
9691    /// Name of the method defined in FIDL
9692    pub fn method_name(&self) -> &'static str {
9693        match *self {
9694            NavigationPolicyProviderRequest::EvaluateRequestedNavigation { .. } => {
9695                "evaluate_requested_navigation"
9696            }
9697        }
9698    }
9699}
9700
9701#[derive(Debug, Clone)]
9702pub struct NavigationPolicyProviderControlHandle {
9703    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9704}
9705
9706impl fidl::endpoints::ControlHandle for NavigationPolicyProviderControlHandle {
9707    fn shutdown(&self) {
9708        self.inner.shutdown()
9709    }
9710
9711    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9712        self.inner.shutdown_with_epitaph(status)
9713    }
9714
9715    fn is_closed(&self) -> bool {
9716        self.inner.channel().is_closed()
9717    }
9718    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9719        self.inner.channel().on_closed()
9720    }
9721
9722    #[cfg(target_os = "fuchsia")]
9723    fn signal_peer(
9724        &self,
9725        clear_mask: zx::Signals,
9726        set_mask: zx::Signals,
9727    ) -> Result<(), zx_status::Status> {
9728        use fidl::Peered;
9729        self.inner.channel().signal_peer(clear_mask, set_mask)
9730    }
9731}
9732
9733impl NavigationPolicyProviderControlHandle {}
9734
9735#[must_use = "FIDL methods require a response to be sent"]
9736#[derive(Debug)]
9737pub struct NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9738    control_handle: std::mem::ManuallyDrop<NavigationPolicyProviderControlHandle>,
9739    tx_id: u32,
9740}
9741
9742/// Set the the channel to be shutdown (see [`NavigationPolicyProviderControlHandle::shutdown`])
9743/// if the responder is dropped without sending a response, so that the client
9744/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9745impl std::ops::Drop for NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9746    fn drop(&mut self) {
9747        self.control_handle.shutdown();
9748        // Safety: drops once, never accessed again
9749        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9750    }
9751}
9752
9753impl fidl::endpoints::Responder for NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9754    type ControlHandle = NavigationPolicyProviderControlHandle;
9755
9756    fn control_handle(&self) -> &NavigationPolicyProviderControlHandle {
9757        &self.control_handle
9758    }
9759
9760    fn drop_without_shutdown(mut self) {
9761        // Safety: drops once, never accessed again due to mem::forget
9762        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9763        // Prevent Drop from running (which would shut down the channel)
9764        std::mem::forget(self);
9765    }
9766}
9767
9768impl NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9769    /// Sends a response to the FIDL transaction.
9770    ///
9771    /// Sets the channel to shutdown if an error occurs.
9772    pub fn send(self, mut decision: NavigationDecision) -> Result<(), fidl::Error> {
9773        let _result = self.send_raw(decision);
9774        if _result.is_err() {
9775            self.control_handle.shutdown();
9776        }
9777        self.drop_without_shutdown();
9778        _result
9779    }
9780
9781    /// Similar to "send" but does not shutdown the channel if an error occurs.
9782    pub fn send_no_shutdown_on_err(
9783        self,
9784        mut decision: NavigationDecision,
9785    ) -> Result<(), fidl::Error> {
9786        let _result = self.send_raw(decision);
9787        self.drop_without_shutdown();
9788        _result
9789    }
9790
9791    fn send_raw(&self, mut decision: NavigationDecision) -> Result<(), fidl::Error> {
9792        self.control_handle
9793            .inner
9794            .send::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
9795                (&mut decision,),
9796                self.tx_id,
9797                0x54446b50cf3512b6,
9798                fidl::encoding::DynamicFlags::empty(),
9799            )
9800    }
9801}
9802
9803#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9804pub struct PopupFrameCreationListenerMarker;
9805
9806impl fidl::endpoints::ProtocolMarker for PopupFrameCreationListenerMarker {
9807    type Proxy = PopupFrameCreationListenerProxy;
9808    type RequestStream = PopupFrameCreationListenerRequestStream;
9809    #[cfg(target_os = "fuchsia")]
9810    type SynchronousProxy = PopupFrameCreationListenerSynchronousProxy;
9811
9812    const DEBUG_NAME: &'static str = "(anonymous) PopupFrameCreationListener";
9813}
9814
9815pub trait PopupFrameCreationListenerProxyInterface: Send + Sync {
9816    type OnPopupFrameCreatedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
9817        + Send;
9818    fn r#on_popup_frame_created(
9819        &self,
9820        frame: fidl::endpoints::ClientEnd<FrameMarker>,
9821        info: PopupFrameCreationInfo,
9822    ) -> Self::OnPopupFrameCreatedResponseFut;
9823}
9824#[derive(Debug)]
9825#[cfg(target_os = "fuchsia")]
9826pub struct PopupFrameCreationListenerSynchronousProxy {
9827    client: fidl::client::sync::Client,
9828}
9829
9830#[cfg(target_os = "fuchsia")]
9831impl fidl::endpoints::SynchronousProxy for PopupFrameCreationListenerSynchronousProxy {
9832    type Proxy = PopupFrameCreationListenerProxy;
9833    type Protocol = PopupFrameCreationListenerMarker;
9834
9835    fn from_channel(inner: fidl::Channel) -> Self {
9836        Self::new(inner)
9837    }
9838
9839    fn into_channel(self) -> fidl::Channel {
9840        self.client.into_channel()
9841    }
9842
9843    fn as_channel(&self) -> &fidl::Channel {
9844        self.client.as_channel()
9845    }
9846}
9847
9848#[cfg(target_os = "fuchsia")]
9849impl PopupFrameCreationListenerSynchronousProxy {
9850    pub fn new(channel: fidl::Channel) -> Self {
9851        Self { client: fidl::client::sync::Client::new(channel) }
9852    }
9853
9854    pub fn into_channel(self) -> fidl::Channel {
9855        self.client.into_channel()
9856    }
9857
9858    /// Waits until an event arrives and returns it. It is safe for other
9859    /// threads to make concurrent requests while waiting for an event.
9860    pub fn wait_for_event(
9861        &self,
9862        deadline: zx::MonotonicInstant,
9863    ) -> Result<PopupFrameCreationListenerEvent, fidl::Error> {
9864        PopupFrameCreationListenerEvent::decode(
9865            self.client.wait_for_event::<PopupFrameCreationListenerMarker>(deadline)?,
9866        )
9867    }
9868
9869    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9870    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9871    /// the acknowledgement callback is invoked.
9872    pub fn r#on_popup_frame_created(
9873        &self,
9874        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9875        mut info: PopupFrameCreationInfo,
9876        ___deadline: zx::MonotonicInstant,
9877    ) -> Result<(), fidl::Error> {
9878        let _response = self.client.send_query::<
9879            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
9880            fidl::encoding::EmptyPayload,
9881            PopupFrameCreationListenerMarker,
9882        >(
9883            (frame, &mut info,),
9884            0x19b212672dc41d51,
9885            fidl::encoding::DynamicFlags::empty(),
9886            ___deadline,
9887        )?;
9888        Ok(_response)
9889    }
9890}
9891
9892#[cfg(target_os = "fuchsia")]
9893impl From<PopupFrameCreationListenerSynchronousProxy> for zx::NullableHandle {
9894    fn from(value: PopupFrameCreationListenerSynchronousProxy) -> Self {
9895        value.into_channel().into()
9896    }
9897}
9898
9899#[cfg(target_os = "fuchsia")]
9900impl From<fidl::Channel> for PopupFrameCreationListenerSynchronousProxy {
9901    fn from(value: fidl::Channel) -> Self {
9902        Self::new(value)
9903    }
9904}
9905
9906#[cfg(target_os = "fuchsia")]
9907impl fidl::endpoints::FromClient for PopupFrameCreationListenerSynchronousProxy {
9908    type Protocol = PopupFrameCreationListenerMarker;
9909
9910    fn from_client(value: fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>) -> Self {
9911        Self::new(value.into_channel())
9912    }
9913}
9914
9915#[derive(Debug, Clone)]
9916pub struct PopupFrameCreationListenerProxy {
9917    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9918}
9919
9920impl fidl::endpoints::Proxy for PopupFrameCreationListenerProxy {
9921    type Protocol = PopupFrameCreationListenerMarker;
9922
9923    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9924        Self::new(inner)
9925    }
9926
9927    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9928        self.client.into_channel().map_err(|client| Self { client })
9929    }
9930
9931    fn as_channel(&self) -> &::fidl::AsyncChannel {
9932        self.client.as_channel()
9933    }
9934}
9935
9936impl PopupFrameCreationListenerProxy {
9937    /// Create a new Proxy for fuchsia.web/PopupFrameCreationListener.
9938    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9939        let protocol_name =
9940            <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9941        Self { client: fidl::client::Client::new(channel, protocol_name) }
9942    }
9943
9944    /// Get a Stream of events from the remote end of the protocol.
9945    ///
9946    /// # Panics
9947    ///
9948    /// Panics if the event stream was already taken.
9949    pub fn take_event_stream(&self) -> PopupFrameCreationListenerEventStream {
9950        PopupFrameCreationListenerEventStream { event_receiver: self.client.take_event_receiver() }
9951    }
9952
9953    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9954    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9955    /// the acknowledgement callback is invoked.
9956    pub fn r#on_popup_frame_created(
9957        &self,
9958        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9959        mut info: PopupFrameCreationInfo,
9960    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9961        PopupFrameCreationListenerProxyInterface::r#on_popup_frame_created(self, frame, info)
9962    }
9963}
9964
9965impl PopupFrameCreationListenerProxyInterface for PopupFrameCreationListenerProxy {
9966    type OnPopupFrameCreatedResponseFut =
9967        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9968    fn r#on_popup_frame_created(
9969        &self,
9970        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9971        mut info: PopupFrameCreationInfo,
9972    ) -> Self::OnPopupFrameCreatedResponseFut {
9973        fn _decode(
9974            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9975        ) -> Result<(), fidl::Error> {
9976            let _response = fidl::client::decode_transaction_body::<
9977                fidl::encoding::EmptyPayload,
9978                fidl::encoding::DefaultFuchsiaResourceDialect,
9979                0x19b212672dc41d51,
9980            >(_buf?)?;
9981            Ok(_response)
9982        }
9983        self.client
9984            .send_query_and_decode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, ()>(
9985                (frame, &mut info),
9986                0x19b212672dc41d51,
9987                fidl::encoding::DynamicFlags::empty(),
9988                _decode,
9989            )
9990    }
9991}
9992
9993pub struct PopupFrameCreationListenerEventStream {
9994    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9995}
9996
9997impl std::marker::Unpin for PopupFrameCreationListenerEventStream {}
9998
9999impl futures::stream::FusedStream for PopupFrameCreationListenerEventStream {
10000    fn is_terminated(&self) -> bool {
10001        self.event_receiver.is_terminated()
10002    }
10003}
10004
10005impl futures::Stream for PopupFrameCreationListenerEventStream {
10006    type Item = Result<PopupFrameCreationListenerEvent, fidl::Error>;
10007
10008    fn poll_next(
10009        mut self: std::pin::Pin<&mut Self>,
10010        cx: &mut std::task::Context<'_>,
10011    ) -> std::task::Poll<Option<Self::Item>> {
10012        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10013            &mut self.event_receiver,
10014            cx
10015        )?) {
10016            Some(buf) => std::task::Poll::Ready(Some(PopupFrameCreationListenerEvent::decode(buf))),
10017            None => std::task::Poll::Ready(None),
10018        }
10019    }
10020}
10021
10022#[derive(Debug)]
10023pub enum PopupFrameCreationListenerEvent {}
10024
10025impl PopupFrameCreationListenerEvent {
10026    /// Decodes a message buffer as a [`PopupFrameCreationListenerEvent`].
10027    fn decode(
10028        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10029    ) -> Result<PopupFrameCreationListenerEvent, fidl::Error> {
10030        let (bytes, _handles) = buf.split_mut();
10031        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10032        debug_assert_eq!(tx_header.tx_id, 0);
10033        match tx_header.ordinal {
10034            _ => Err(fidl::Error::UnknownOrdinal {
10035                ordinal: tx_header.ordinal,
10036                protocol_name: <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10037            })
10038        }
10039    }
10040}
10041
10042/// A Stream of incoming requests for fuchsia.web/PopupFrameCreationListener.
10043pub struct PopupFrameCreationListenerRequestStream {
10044    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10045    is_terminated: bool,
10046}
10047
10048impl std::marker::Unpin for PopupFrameCreationListenerRequestStream {}
10049
10050impl futures::stream::FusedStream for PopupFrameCreationListenerRequestStream {
10051    fn is_terminated(&self) -> bool {
10052        self.is_terminated
10053    }
10054}
10055
10056impl fidl::endpoints::RequestStream for PopupFrameCreationListenerRequestStream {
10057    type Protocol = PopupFrameCreationListenerMarker;
10058    type ControlHandle = PopupFrameCreationListenerControlHandle;
10059
10060    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10061        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10062    }
10063
10064    fn control_handle(&self) -> Self::ControlHandle {
10065        PopupFrameCreationListenerControlHandle { inner: self.inner.clone() }
10066    }
10067
10068    fn into_inner(
10069        self,
10070    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10071    {
10072        (self.inner, self.is_terminated)
10073    }
10074
10075    fn from_inner(
10076        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10077        is_terminated: bool,
10078    ) -> Self {
10079        Self { inner, is_terminated }
10080    }
10081}
10082
10083impl futures::Stream for PopupFrameCreationListenerRequestStream {
10084    type Item = Result<PopupFrameCreationListenerRequest, fidl::Error>;
10085
10086    fn poll_next(
10087        mut self: std::pin::Pin<&mut Self>,
10088        cx: &mut std::task::Context<'_>,
10089    ) -> std::task::Poll<Option<Self::Item>> {
10090        let this = &mut *self;
10091        if this.inner.check_shutdown(cx) {
10092            this.is_terminated = true;
10093            return std::task::Poll::Ready(None);
10094        }
10095        if this.is_terminated {
10096            panic!("polled PopupFrameCreationListenerRequestStream after completion");
10097        }
10098        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10099            |bytes, handles| {
10100                match this.inner.channel().read_etc(cx, bytes, handles) {
10101                    std::task::Poll::Ready(Ok(())) => {}
10102                    std::task::Poll::Pending => return std::task::Poll::Pending,
10103                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10104                        this.is_terminated = true;
10105                        return std::task::Poll::Ready(None);
10106                    }
10107                    std::task::Poll::Ready(Err(e)) => {
10108                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10109                            e.into(),
10110                        ))));
10111                    }
10112                }
10113
10114                // A message has been received from the channel
10115                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10116
10117                std::task::Poll::Ready(Some(match header.ordinal {
10118                0x19b212672dc41d51 => {
10119                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10120                    let mut req = fidl::new_empty!(PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
10121                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(&header, _body_bytes, handles, &mut req)?;
10122                    let control_handle = PopupFrameCreationListenerControlHandle {
10123                        inner: this.inner.clone(),
10124                    };
10125                    Ok(PopupFrameCreationListenerRequest::OnPopupFrameCreated {frame: req.frame,
10126info: req.info,
10127
10128                        responder: PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10129                            control_handle: std::mem::ManuallyDrop::new(control_handle),
10130                            tx_id: header.tx_id,
10131                        },
10132                    })
10133                }
10134                _ => Err(fidl::Error::UnknownOrdinal {
10135                    ordinal: header.ordinal,
10136                    protocol_name: <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10137                }),
10138            }))
10139            },
10140        )
10141    }
10142}
10143
10144#[derive(Debug)]
10145pub enum PopupFrameCreationListenerRequest {
10146    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
10147    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
10148    /// the acknowledgement callback is invoked.
10149    OnPopupFrameCreated {
10150        frame: fidl::endpoints::ClientEnd<FrameMarker>,
10151        info: PopupFrameCreationInfo,
10152        responder: PopupFrameCreationListenerOnPopupFrameCreatedResponder,
10153    },
10154}
10155
10156impl PopupFrameCreationListenerRequest {
10157    #[allow(irrefutable_let_patterns)]
10158    pub fn into_on_popup_frame_created(
10159        self,
10160    ) -> Option<(
10161        fidl::endpoints::ClientEnd<FrameMarker>,
10162        PopupFrameCreationInfo,
10163        PopupFrameCreationListenerOnPopupFrameCreatedResponder,
10164    )> {
10165        if let PopupFrameCreationListenerRequest::OnPopupFrameCreated { frame, info, responder } =
10166            self
10167        {
10168            Some((frame, info, responder))
10169        } else {
10170            None
10171        }
10172    }
10173
10174    /// Name of the method defined in FIDL
10175    pub fn method_name(&self) -> &'static str {
10176        match *self {
10177            PopupFrameCreationListenerRequest::OnPopupFrameCreated { .. } => {
10178                "on_popup_frame_created"
10179            }
10180        }
10181    }
10182}
10183
10184#[derive(Debug, Clone)]
10185pub struct PopupFrameCreationListenerControlHandle {
10186    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10187}
10188
10189impl fidl::endpoints::ControlHandle for PopupFrameCreationListenerControlHandle {
10190    fn shutdown(&self) {
10191        self.inner.shutdown()
10192    }
10193
10194    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10195        self.inner.shutdown_with_epitaph(status)
10196    }
10197
10198    fn is_closed(&self) -> bool {
10199        self.inner.channel().is_closed()
10200    }
10201    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10202        self.inner.channel().on_closed()
10203    }
10204
10205    #[cfg(target_os = "fuchsia")]
10206    fn signal_peer(
10207        &self,
10208        clear_mask: zx::Signals,
10209        set_mask: zx::Signals,
10210    ) -> Result<(), zx_status::Status> {
10211        use fidl::Peered;
10212        self.inner.channel().signal_peer(clear_mask, set_mask)
10213    }
10214}
10215
10216impl PopupFrameCreationListenerControlHandle {}
10217
10218#[must_use = "FIDL methods require a response to be sent"]
10219#[derive(Debug)]
10220pub struct PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10221    control_handle: std::mem::ManuallyDrop<PopupFrameCreationListenerControlHandle>,
10222    tx_id: u32,
10223}
10224
10225/// Set the the channel to be shutdown (see [`PopupFrameCreationListenerControlHandle::shutdown`])
10226/// if the responder is dropped without sending a response, so that the client
10227/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10228impl std::ops::Drop for PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10229    fn drop(&mut self) {
10230        self.control_handle.shutdown();
10231        // Safety: drops once, never accessed again
10232        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10233    }
10234}
10235
10236impl fidl::endpoints::Responder for PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10237    type ControlHandle = PopupFrameCreationListenerControlHandle;
10238
10239    fn control_handle(&self) -> &PopupFrameCreationListenerControlHandle {
10240        &self.control_handle
10241    }
10242
10243    fn drop_without_shutdown(mut self) {
10244        // Safety: drops once, never accessed again due to mem::forget
10245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10246        // Prevent Drop from running (which would shut down the channel)
10247        std::mem::forget(self);
10248    }
10249}
10250
10251impl PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10252    /// Sends a response to the FIDL transaction.
10253    ///
10254    /// Sets the channel to shutdown if an error occurs.
10255    pub fn send(self) -> Result<(), fidl::Error> {
10256        let _result = self.send_raw();
10257        if _result.is_err() {
10258            self.control_handle.shutdown();
10259        }
10260        self.drop_without_shutdown();
10261        _result
10262    }
10263
10264    /// Similar to "send" but does not shutdown the channel if an error occurs.
10265    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10266        let _result = self.send_raw();
10267        self.drop_without_shutdown();
10268        _result
10269    }
10270
10271    fn send_raw(&self) -> Result<(), fidl::Error> {
10272        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10273            (),
10274            self.tx_id,
10275            0x19b212672dc41d51,
10276            fidl::encoding::DynamicFlags::empty(),
10277        )
10278    }
10279}
10280
10281mod internal {
10282    use super::*;
10283
10284    impl fidl::encoding::ResourceTypeMarker for ContextCreateFrameRequest {
10285        type Borrowed<'a> = &'a mut Self;
10286        fn take_or_borrow<'a>(
10287            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10288        ) -> Self::Borrowed<'a> {
10289            value
10290        }
10291    }
10292
10293    unsafe impl fidl::encoding::TypeMarker for ContextCreateFrameRequest {
10294        type Owned = Self;
10295
10296        #[inline(always)]
10297        fn inline_align(_context: fidl::encoding::Context) -> usize {
10298            4
10299        }
10300
10301        #[inline(always)]
10302        fn inline_size(_context: fidl::encoding::Context) -> usize {
10303            4
10304        }
10305    }
10306
10307    unsafe impl
10308        fidl::encoding::Encode<
10309            ContextCreateFrameRequest,
10310            fidl::encoding::DefaultFuchsiaResourceDialect,
10311        > for &mut ContextCreateFrameRequest
10312    {
10313        #[inline]
10314        unsafe fn encode(
10315            self,
10316            encoder: &mut fidl::encoding::Encoder<
10317                '_,
10318                fidl::encoding::DefaultFuchsiaResourceDialect,
10319            >,
10320            offset: usize,
10321            _depth: fidl::encoding::Depth,
10322        ) -> fidl::Result<()> {
10323            encoder.debug_check_bounds::<ContextCreateFrameRequest>(offset);
10324            // Delegate to tuple encoding.
10325            fidl::encoding::Encode::<ContextCreateFrameRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10326                (
10327                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
10328                ),
10329                encoder, offset, _depth
10330            )
10331        }
10332    }
10333    unsafe impl<
10334        T0: fidl::encoding::Encode<
10335                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10336                fidl::encoding::DefaultFuchsiaResourceDialect,
10337            >,
10338    >
10339        fidl::encoding::Encode<
10340            ContextCreateFrameRequest,
10341            fidl::encoding::DefaultFuchsiaResourceDialect,
10342        > for (T0,)
10343    {
10344        #[inline]
10345        unsafe fn encode(
10346            self,
10347            encoder: &mut fidl::encoding::Encoder<
10348                '_,
10349                fidl::encoding::DefaultFuchsiaResourceDialect,
10350            >,
10351            offset: usize,
10352            depth: fidl::encoding::Depth,
10353        ) -> fidl::Result<()> {
10354            encoder.debug_check_bounds::<ContextCreateFrameRequest>(offset);
10355            // Zero out padding regions. There's no need to apply masks
10356            // because the unmasked parts will be overwritten by fields.
10357            // Write the fields.
10358            self.0.encode(encoder, offset + 0, depth)?;
10359            Ok(())
10360        }
10361    }
10362
10363    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10364        for ContextCreateFrameRequest
10365    {
10366        #[inline(always)]
10367        fn new_empty() -> Self {
10368            Self {
10369                frame: fidl::new_empty!(
10370                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10371                    fidl::encoding::DefaultFuchsiaResourceDialect
10372                ),
10373            }
10374        }
10375
10376        #[inline]
10377        unsafe fn decode(
10378            &mut self,
10379            decoder: &mut fidl::encoding::Decoder<
10380                '_,
10381                fidl::encoding::DefaultFuchsiaResourceDialect,
10382            >,
10383            offset: usize,
10384            _depth: fidl::encoding::Depth,
10385        ) -> fidl::Result<()> {
10386            decoder.debug_check_bounds::<Self>(offset);
10387            // Verify that padding bytes are zero.
10388            fidl::decode!(
10389                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10390                fidl::encoding::DefaultFuchsiaResourceDialect,
10391                &mut self.frame,
10392                decoder,
10393                offset + 0,
10394                _depth
10395            )?;
10396            Ok(())
10397        }
10398    }
10399
10400    impl fidl::encoding::ResourceTypeMarker for ContextCreateFrameWithParamsRequest {
10401        type Borrowed<'a> = &'a mut Self;
10402        fn take_or_borrow<'a>(
10403            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10404        ) -> Self::Borrowed<'a> {
10405            value
10406        }
10407    }
10408
10409    unsafe impl fidl::encoding::TypeMarker for ContextCreateFrameWithParamsRequest {
10410        type Owned = Self;
10411
10412        #[inline(always)]
10413        fn inline_align(_context: fidl::encoding::Context) -> usize {
10414            8
10415        }
10416
10417        #[inline(always)]
10418        fn inline_size(_context: fidl::encoding::Context) -> usize {
10419            24
10420        }
10421    }
10422
10423    unsafe impl
10424        fidl::encoding::Encode<
10425            ContextCreateFrameWithParamsRequest,
10426            fidl::encoding::DefaultFuchsiaResourceDialect,
10427        > for &mut ContextCreateFrameWithParamsRequest
10428    {
10429        #[inline]
10430        unsafe fn encode(
10431            self,
10432            encoder: &mut fidl::encoding::Encoder<
10433                '_,
10434                fidl::encoding::DefaultFuchsiaResourceDialect,
10435            >,
10436            offset: usize,
10437            _depth: fidl::encoding::Depth,
10438        ) -> fidl::Result<()> {
10439            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10440            // Delegate to tuple encoding.
10441            fidl::encoding::Encode::<ContextCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10442                (
10443                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10444                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
10445                ),
10446                encoder, offset, _depth
10447            )
10448        }
10449    }
10450    unsafe impl<
10451        T0: fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
10452        T1: fidl::encoding::Encode<
10453                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10454                fidl::encoding::DefaultFuchsiaResourceDialect,
10455            >,
10456    >
10457        fidl::encoding::Encode<
10458            ContextCreateFrameWithParamsRequest,
10459            fidl::encoding::DefaultFuchsiaResourceDialect,
10460        > for (T0, T1)
10461    {
10462        #[inline]
10463        unsafe fn encode(
10464            self,
10465            encoder: &mut fidl::encoding::Encoder<
10466                '_,
10467                fidl::encoding::DefaultFuchsiaResourceDialect,
10468            >,
10469            offset: usize,
10470            depth: fidl::encoding::Depth,
10471        ) -> fidl::Result<()> {
10472            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10473            // Zero out padding regions. There's no need to apply masks
10474            // because the unmasked parts will be overwritten by fields.
10475            unsafe {
10476                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10477                (ptr as *mut u64).write_unaligned(0);
10478            }
10479            // Write the fields.
10480            self.0.encode(encoder, offset + 0, depth)?;
10481            self.1.encode(encoder, offset + 16, depth)?;
10482            Ok(())
10483        }
10484    }
10485
10486    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10487        for ContextCreateFrameWithParamsRequest
10488    {
10489        #[inline(always)]
10490        fn new_empty() -> Self {
10491            Self {
10492                params: fidl::new_empty!(
10493                    CreateFrameParams,
10494                    fidl::encoding::DefaultFuchsiaResourceDialect
10495                ),
10496                frame: fidl::new_empty!(
10497                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10498                    fidl::encoding::DefaultFuchsiaResourceDialect
10499                ),
10500            }
10501        }
10502
10503        #[inline]
10504        unsafe fn decode(
10505            &mut self,
10506            decoder: &mut fidl::encoding::Decoder<
10507                '_,
10508                fidl::encoding::DefaultFuchsiaResourceDialect,
10509            >,
10510            offset: usize,
10511            _depth: fidl::encoding::Depth,
10512        ) -> fidl::Result<()> {
10513            decoder.debug_check_bounds::<Self>(offset);
10514            // Verify that padding bytes are zero.
10515            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10516            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10517            let mask = 0xffffffff00000000u64;
10518            let maskedval = padval & mask;
10519            if maskedval != 0 {
10520                return Err(fidl::Error::NonZeroPadding {
10521                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10522                });
10523            }
10524            fidl::decode!(
10525                CreateFrameParams,
10526                fidl::encoding::DefaultFuchsiaResourceDialect,
10527                &mut self.params,
10528                decoder,
10529                offset + 0,
10530                _depth
10531            )?;
10532            fidl::decode!(
10533                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10534                fidl::encoding::DefaultFuchsiaResourceDialect,
10535                &mut self.frame,
10536                decoder,
10537                offset + 16,
10538                _depth
10539            )?;
10540            Ok(())
10541        }
10542    }
10543
10544    impl fidl::encoding::ResourceTypeMarker for ContextGetCookieManagerRequest {
10545        type Borrowed<'a> = &'a mut Self;
10546        fn take_or_borrow<'a>(
10547            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10548        ) -> Self::Borrowed<'a> {
10549            value
10550        }
10551    }
10552
10553    unsafe impl fidl::encoding::TypeMarker for ContextGetCookieManagerRequest {
10554        type Owned = Self;
10555
10556        #[inline(always)]
10557        fn inline_align(_context: fidl::encoding::Context) -> usize {
10558            4
10559        }
10560
10561        #[inline(always)]
10562        fn inline_size(_context: fidl::encoding::Context) -> usize {
10563            4
10564        }
10565    }
10566
10567    unsafe impl
10568        fidl::encoding::Encode<
10569            ContextGetCookieManagerRequest,
10570            fidl::encoding::DefaultFuchsiaResourceDialect,
10571        > for &mut ContextGetCookieManagerRequest
10572    {
10573        #[inline]
10574        unsafe fn encode(
10575            self,
10576            encoder: &mut fidl::encoding::Encoder<
10577                '_,
10578                fidl::encoding::DefaultFuchsiaResourceDialect,
10579            >,
10580            offset: usize,
10581            _depth: fidl::encoding::Depth,
10582        ) -> fidl::Result<()> {
10583            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10584            // Delegate to tuple encoding.
10585            fidl::encoding::Encode::<ContextGetCookieManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10586                (
10587                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.manager),
10588                ),
10589                encoder, offset, _depth
10590            )
10591        }
10592    }
10593    unsafe impl<
10594        T0: fidl::encoding::Encode<
10595                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10596                fidl::encoding::DefaultFuchsiaResourceDialect,
10597            >,
10598    >
10599        fidl::encoding::Encode<
10600            ContextGetCookieManagerRequest,
10601            fidl::encoding::DefaultFuchsiaResourceDialect,
10602        > for (T0,)
10603    {
10604        #[inline]
10605        unsafe fn encode(
10606            self,
10607            encoder: &mut fidl::encoding::Encoder<
10608                '_,
10609                fidl::encoding::DefaultFuchsiaResourceDialect,
10610            >,
10611            offset: usize,
10612            depth: fidl::encoding::Depth,
10613        ) -> fidl::Result<()> {
10614            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10615            // Zero out padding regions. There's no need to apply masks
10616            // because the unmasked parts will be overwritten by fields.
10617            // Write the fields.
10618            self.0.encode(encoder, offset + 0, depth)?;
10619            Ok(())
10620        }
10621    }
10622
10623    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10624        for ContextGetCookieManagerRequest
10625    {
10626        #[inline(always)]
10627        fn new_empty() -> Self {
10628            Self {
10629                manager: fidl::new_empty!(
10630                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10631                    fidl::encoding::DefaultFuchsiaResourceDialect
10632                ),
10633            }
10634        }
10635
10636        #[inline]
10637        unsafe fn decode(
10638            &mut self,
10639            decoder: &mut fidl::encoding::Decoder<
10640                '_,
10641                fidl::encoding::DefaultFuchsiaResourceDialect,
10642            >,
10643            offset: usize,
10644            _depth: fidl::encoding::Depth,
10645        ) -> fidl::Result<()> {
10646            decoder.debug_check_bounds::<Self>(offset);
10647            // Verify that padding bytes are zero.
10648            fidl::decode!(
10649                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10650                fidl::encoding::DefaultFuchsiaResourceDialect,
10651                &mut self.manager,
10652                decoder,
10653                offset + 0,
10654                _depth
10655            )?;
10656            Ok(())
10657        }
10658    }
10659
10660    impl fidl::encoding::ResourceTypeMarker for ContextProviderCreateRequest {
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 ContextProviderCreateRequest {
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            24
10680        }
10681    }
10682
10683    unsafe impl
10684        fidl::encoding::Encode<
10685            ContextProviderCreateRequest,
10686            fidl::encoding::DefaultFuchsiaResourceDialect,
10687        > for &mut ContextProviderCreateRequest
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::<ContextProviderCreateRequest>(offset);
10700            // Delegate to tuple encoding.
10701            fidl::encoding::Encode::<ContextProviderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10702                (
10703                    <CreateContextParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10704                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.context),
10705                ),
10706                encoder, offset, _depth
10707            )
10708        }
10709    }
10710    unsafe impl<
10711        T0: fidl::encoding::Encode<CreateContextParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
10712        T1: fidl::encoding::Encode<
10713                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10714                fidl::encoding::DefaultFuchsiaResourceDialect,
10715            >,
10716    >
10717        fidl::encoding::Encode<
10718            ContextProviderCreateRequest,
10719            fidl::encoding::DefaultFuchsiaResourceDialect,
10720        > for (T0, T1)
10721    {
10722        #[inline]
10723        unsafe fn encode(
10724            self,
10725            encoder: &mut fidl::encoding::Encoder<
10726                '_,
10727                fidl::encoding::DefaultFuchsiaResourceDialect,
10728            >,
10729            offset: usize,
10730            depth: fidl::encoding::Depth,
10731        ) -> fidl::Result<()> {
10732            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10733            // Zero out padding regions. There's no need to apply masks
10734            // because the unmasked parts will be overwritten by fields.
10735            unsafe {
10736                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10737                (ptr as *mut u64).write_unaligned(0);
10738            }
10739            // Write the fields.
10740            self.0.encode(encoder, offset + 0, depth)?;
10741            self.1.encode(encoder, offset + 16, depth)?;
10742            Ok(())
10743        }
10744    }
10745
10746    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10747        for ContextProviderCreateRequest
10748    {
10749        #[inline(always)]
10750        fn new_empty() -> Self {
10751            Self {
10752                params: fidl::new_empty!(
10753                    CreateContextParams,
10754                    fidl::encoding::DefaultFuchsiaResourceDialect
10755                ),
10756                context: fidl::new_empty!(
10757                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10758                    fidl::encoding::DefaultFuchsiaResourceDialect
10759                ),
10760            }
10761        }
10762
10763        #[inline]
10764        unsafe fn decode(
10765            &mut self,
10766            decoder: &mut fidl::encoding::Decoder<
10767                '_,
10768                fidl::encoding::DefaultFuchsiaResourceDialect,
10769            >,
10770            offset: usize,
10771            _depth: fidl::encoding::Depth,
10772        ) -> fidl::Result<()> {
10773            decoder.debug_check_bounds::<Self>(offset);
10774            // Verify that padding bytes are zero.
10775            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10776            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10777            let mask = 0xffffffff00000000u64;
10778            let maskedval = padval & mask;
10779            if maskedval != 0 {
10780                return Err(fidl::Error::NonZeroPadding {
10781                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10782                });
10783            }
10784            fidl::decode!(
10785                CreateContextParams,
10786                fidl::encoding::DefaultFuchsiaResourceDialect,
10787                &mut self.params,
10788                decoder,
10789                offset + 0,
10790                _depth
10791            )?;
10792            fidl::decode!(
10793                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10794                fidl::encoding::DefaultFuchsiaResourceDialect,
10795                &mut self.context,
10796                decoder,
10797                offset + 16,
10798                _depth
10799            )?;
10800            Ok(())
10801        }
10802    }
10803
10804    impl fidl::encoding::ResourceTypeMarker for CookieManagerGetCookieListRequest {
10805        type Borrowed<'a> = &'a mut Self;
10806        fn take_or_borrow<'a>(
10807            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10808        ) -> Self::Borrowed<'a> {
10809            value
10810        }
10811    }
10812
10813    unsafe impl fidl::encoding::TypeMarker for CookieManagerGetCookieListRequest {
10814        type Owned = Self;
10815
10816        #[inline(always)]
10817        fn inline_align(_context: fidl::encoding::Context) -> usize {
10818            8
10819        }
10820
10821        #[inline(always)]
10822        fn inline_size(_context: fidl::encoding::Context) -> usize {
10823            40
10824        }
10825    }
10826
10827    unsafe impl
10828        fidl::encoding::Encode<
10829            CookieManagerGetCookieListRequest,
10830            fidl::encoding::DefaultFuchsiaResourceDialect,
10831        > for &mut CookieManagerGetCookieListRequest
10832    {
10833        #[inline]
10834        unsafe fn encode(
10835            self,
10836            encoder: &mut fidl::encoding::Encoder<
10837                '_,
10838                fidl::encoding::DefaultFuchsiaResourceDialect,
10839            >,
10840            offset: usize,
10841            _depth: fidl::encoding::Depth,
10842        ) -> fidl::Result<()> {
10843            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10844            // Delegate to tuple encoding.
10845            fidl::encoding::Encode::<CookieManagerGetCookieListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10846                (
10847                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
10848                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10849                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cookies),
10850                ),
10851                encoder, offset, _depth
10852            )
10853        }
10854    }
10855    unsafe impl<
10856        T0: fidl::encoding::Encode<
10857                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10858                fidl::encoding::DefaultFuchsiaResourceDialect,
10859            >,
10860        T1: fidl::encoding::Encode<
10861                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10862                fidl::encoding::DefaultFuchsiaResourceDialect,
10863            >,
10864        T2: fidl::encoding::Encode<
10865                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10866                fidl::encoding::DefaultFuchsiaResourceDialect,
10867            >,
10868    >
10869        fidl::encoding::Encode<
10870            CookieManagerGetCookieListRequest,
10871            fidl::encoding::DefaultFuchsiaResourceDialect,
10872        > for (T0, T1, T2)
10873    {
10874        #[inline]
10875        unsafe fn encode(
10876            self,
10877            encoder: &mut fidl::encoding::Encoder<
10878                '_,
10879                fidl::encoding::DefaultFuchsiaResourceDialect,
10880            >,
10881            offset: usize,
10882            depth: fidl::encoding::Depth,
10883        ) -> fidl::Result<()> {
10884            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10885            // Zero out padding regions. There's no need to apply masks
10886            // because the unmasked parts will be overwritten by fields.
10887            unsafe {
10888                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10889                (ptr as *mut u64).write_unaligned(0);
10890            }
10891            // Write the fields.
10892            self.0.encode(encoder, offset + 0, depth)?;
10893            self.1.encode(encoder, offset + 16, depth)?;
10894            self.2.encode(encoder, offset + 32, depth)?;
10895            Ok(())
10896        }
10897    }
10898
10899    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10900        for CookieManagerGetCookieListRequest
10901    {
10902        #[inline(always)]
10903        fn new_empty() -> Self {
10904            Self {
10905                url: fidl::new_empty!(
10906                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10907                    fidl::encoding::DefaultFuchsiaResourceDialect
10908                ),
10909                name: fidl::new_empty!(
10910                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10911                    fidl::encoding::DefaultFuchsiaResourceDialect
10912                ),
10913                cookies: fidl::new_empty!(
10914                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10915                    fidl::encoding::DefaultFuchsiaResourceDialect
10916                ),
10917            }
10918        }
10919
10920        #[inline]
10921        unsafe fn decode(
10922            &mut self,
10923            decoder: &mut fidl::encoding::Decoder<
10924                '_,
10925                fidl::encoding::DefaultFuchsiaResourceDialect,
10926            >,
10927            offset: usize,
10928            _depth: fidl::encoding::Depth,
10929        ) -> fidl::Result<()> {
10930            decoder.debug_check_bounds::<Self>(offset);
10931            // Verify that padding bytes are zero.
10932            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10933            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10934            let mask = 0xffffffff00000000u64;
10935            let maskedval = padval & mask;
10936            if maskedval != 0 {
10937                return Err(fidl::Error::NonZeroPadding {
10938                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10939                });
10940            }
10941            fidl::decode!(
10942                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10943                fidl::encoding::DefaultFuchsiaResourceDialect,
10944                &mut self.url,
10945                decoder,
10946                offset + 0,
10947                _depth
10948            )?;
10949            fidl::decode!(
10950                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10951                fidl::encoding::DefaultFuchsiaResourceDialect,
10952                &mut self.name,
10953                decoder,
10954                offset + 16,
10955                _depth
10956            )?;
10957            fidl::decode!(
10958                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10959                fidl::encoding::DefaultFuchsiaResourceDialect,
10960                &mut self.cookies,
10961                decoder,
10962                offset + 32,
10963                _depth
10964            )?;
10965            Ok(())
10966        }
10967    }
10968
10969    impl fidl::encoding::ResourceTypeMarker for CookieManagerObserveCookieChangesRequest {
10970        type Borrowed<'a> = &'a mut Self;
10971        fn take_or_borrow<'a>(
10972            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10973        ) -> Self::Borrowed<'a> {
10974            value
10975        }
10976    }
10977
10978    unsafe impl fidl::encoding::TypeMarker for CookieManagerObserveCookieChangesRequest {
10979        type Owned = Self;
10980
10981        #[inline(always)]
10982        fn inline_align(_context: fidl::encoding::Context) -> usize {
10983            8
10984        }
10985
10986        #[inline(always)]
10987        fn inline_size(_context: fidl::encoding::Context) -> usize {
10988            40
10989        }
10990    }
10991
10992    unsafe impl
10993        fidl::encoding::Encode<
10994            CookieManagerObserveCookieChangesRequest,
10995            fidl::encoding::DefaultFuchsiaResourceDialect,
10996        > for &mut CookieManagerObserveCookieChangesRequest
10997    {
10998        #[inline]
10999        unsafe fn encode(
11000            self,
11001            encoder: &mut fidl::encoding::Encoder<
11002                '_,
11003                fidl::encoding::DefaultFuchsiaResourceDialect,
11004            >,
11005            offset: usize,
11006            _depth: fidl::encoding::Depth,
11007        ) -> fidl::Result<()> {
11008            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
11009            // Delegate to tuple encoding.
11010            fidl::encoding::Encode::<CookieManagerObserveCookieChangesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11011                (
11012                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
11013                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
11014                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changes),
11015                ),
11016                encoder, offset, _depth
11017            )
11018        }
11019    }
11020    unsafe impl<
11021        T0: fidl::encoding::Encode<
11022                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11023                fidl::encoding::DefaultFuchsiaResourceDialect,
11024            >,
11025        T1: fidl::encoding::Encode<
11026                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11027                fidl::encoding::DefaultFuchsiaResourceDialect,
11028            >,
11029        T2: fidl::encoding::Encode<
11030                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11031                fidl::encoding::DefaultFuchsiaResourceDialect,
11032            >,
11033    >
11034        fidl::encoding::Encode<
11035            CookieManagerObserveCookieChangesRequest,
11036            fidl::encoding::DefaultFuchsiaResourceDialect,
11037        > for (T0, T1, T2)
11038    {
11039        #[inline]
11040        unsafe fn encode(
11041            self,
11042            encoder: &mut fidl::encoding::Encoder<
11043                '_,
11044                fidl::encoding::DefaultFuchsiaResourceDialect,
11045            >,
11046            offset: usize,
11047            depth: fidl::encoding::Depth,
11048        ) -> fidl::Result<()> {
11049            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
11050            // Zero out padding regions. There's no need to apply masks
11051            // because the unmasked parts will be overwritten by fields.
11052            unsafe {
11053                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
11054                (ptr as *mut u64).write_unaligned(0);
11055            }
11056            // Write the fields.
11057            self.0.encode(encoder, offset + 0, depth)?;
11058            self.1.encode(encoder, offset + 16, depth)?;
11059            self.2.encode(encoder, offset + 32, depth)?;
11060            Ok(())
11061        }
11062    }
11063
11064    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11065        for CookieManagerObserveCookieChangesRequest
11066    {
11067        #[inline(always)]
11068        fn new_empty() -> Self {
11069            Self {
11070                url: fidl::new_empty!(
11071                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11072                    fidl::encoding::DefaultFuchsiaResourceDialect
11073                ),
11074                name: fidl::new_empty!(
11075                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11076                    fidl::encoding::DefaultFuchsiaResourceDialect
11077                ),
11078                changes: fidl::new_empty!(
11079                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11080                    fidl::encoding::DefaultFuchsiaResourceDialect
11081                ),
11082            }
11083        }
11084
11085        #[inline]
11086        unsafe fn decode(
11087            &mut self,
11088            decoder: &mut fidl::encoding::Decoder<
11089                '_,
11090                fidl::encoding::DefaultFuchsiaResourceDialect,
11091            >,
11092            offset: usize,
11093            _depth: fidl::encoding::Depth,
11094        ) -> fidl::Result<()> {
11095            decoder.debug_check_bounds::<Self>(offset);
11096            // Verify that padding bytes are zero.
11097            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
11098            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11099            let mask = 0xffffffff00000000u64;
11100            let maskedval = padval & mask;
11101            if maskedval != 0 {
11102                return Err(fidl::Error::NonZeroPadding {
11103                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
11104                });
11105            }
11106            fidl::decode!(
11107                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11108                fidl::encoding::DefaultFuchsiaResourceDialect,
11109                &mut self.url,
11110                decoder,
11111                offset + 0,
11112                _depth
11113            )?;
11114            fidl::decode!(
11115                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11116                fidl::encoding::DefaultFuchsiaResourceDialect,
11117                &mut self.name,
11118                decoder,
11119                offset + 16,
11120                _depth
11121            )?;
11122            fidl::decode!(
11123                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11124                fidl::encoding::DefaultFuchsiaResourceDialect,
11125                &mut self.changes,
11126                decoder,
11127                offset + 32,
11128                _depth
11129            )?;
11130            Ok(())
11131        }
11132    }
11133
11134    impl fidl::encoding::ResourceTypeMarker for CookiesIteratorGetNextResponse {
11135        type Borrowed<'a> = &'a mut Self;
11136        fn take_or_borrow<'a>(
11137            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11138        ) -> Self::Borrowed<'a> {
11139            value
11140        }
11141    }
11142
11143    unsafe impl fidl::encoding::TypeMarker for CookiesIteratorGetNextResponse {
11144        type Owned = Self;
11145
11146        #[inline(always)]
11147        fn inline_align(_context: fidl::encoding::Context) -> usize {
11148            8
11149        }
11150
11151        #[inline(always)]
11152        fn inline_size(_context: fidl::encoding::Context) -> usize {
11153            16
11154        }
11155    }
11156
11157    unsafe impl
11158        fidl::encoding::Encode<
11159            CookiesIteratorGetNextResponse,
11160            fidl::encoding::DefaultFuchsiaResourceDialect,
11161        > for &mut CookiesIteratorGetNextResponse
11162    {
11163        #[inline]
11164        unsafe fn encode(
11165            self,
11166            encoder: &mut fidl::encoding::Encoder<
11167                '_,
11168                fidl::encoding::DefaultFuchsiaResourceDialect,
11169            >,
11170            offset: usize,
11171            _depth: fidl::encoding::Depth,
11172        ) -> fidl::Result<()> {
11173            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11174            // Delegate to tuple encoding.
11175            fidl::encoding::Encode::<CookiesIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11176                (
11177                    <fidl::encoding::UnboundedVector<Cookie> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changed_cookies),
11178                ),
11179                encoder, offset, _depth
11180            )
11181        }
11182    }
11183    unsafe impl<
11184        T0: fidl::encoding::Encode<
11185                fidl::encoding::UnboundedVector<Cookie>,
11186                fidl::encoding::DefaultFuchsiaResourceDialect,
11187            >,
11188    >
11189        fidl::encoding::Encode<
11190            CookiesIteratorGetNextResponse,
11191            fidl::encoding::DefaultFuchsiaResourceDialect,
11192        > for (T0,)
11193    {
11194        #[inline]
11195        unsafe fn encode(
11196            self,
11197            encoder: &mut fidl::encoding::Encoder<
11198                '_,
11199                fidl::encoding::DefaultFuchsiaResourceDialect,
11200            >,
11201            offset: usize,
11202            depth: fidl::encoding::Depth,
11203        ) -> fidl::Result<()> {
11204            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11205            // Zero out padding regions. There's no need to apply masks
11206            // because the unmasked parts will be overwritten by fields.
11207            // Write the fields.
11208            self.0.encode(encoder, offset + 0, depth)?;
11209            Ok(())
11210        }
11211    }
11212
11213    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11214        for CookiesIteratorGetNextResponse
11215    {
11216        #[inline(always)]
11217        fn new_empty() -> Self {
11218            Self {
11219                changed_cookies: fidl::new_empty!(
11220                    fidl::encoding::UnboundedVector<Cookie>,
11221                    fidl::encoding::DefaultFuchsiaResourceDialect
11222                ),
11223            }
11224        }
11225
11226        #[inline]
11227        unsafe fn decode(
11228            &mut self,
11229            decoder: &mut fidl::encoding::Decoder<
11230                '_,
11231                fidl::encoding::DefaultFuchsiaResourceDialect,
11232            >,
11233            offset: usize,
11234            _depth: fidl::encoding::Depth,
11235        ) -> fidl::Result<()> {
11236            decoder.debug_check_bounds::<Self>(offset);
11237            // Verify that padding bytes are zero.
11238            fidl::decode!(
11239                fidl::encoding::UnboundedVector<Cookie>,
11240                fidl::encoding::DefaultFuchsiaResourceDialect,
11241                &mut self.changed_cookies,
11242                decoder,
11243                offset + 0,
11244                _depth
11245            )?;
11246            Ok(())
11247        }
11248    }
11249
11250    impl fidl::encoding::ResourceTypeMarker for DebugEnableDevToolsRequest {
11251        type Borrowed<'a> = &'a mut Self;
11252        fn take_or_borrow<'a>(
11253            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11254        ) -> Self::Borrowed<'a> {
11255            value
11256        }
11257    }
11258
11259    unsafe impl fidl::encoding::TypeMarker for DebugEnableDevToolsRequest {
11260        type Owned = Self;
11261
11262        #[inline(always)]
11263        fn inline_align(_context: fidl::encoding::Context) -> usize {
11264            4
11265        }
11266
11267        #[inline(always)]
11268        fn inline_size(_context: fidl::encoding::Context) -> usize {
11269            4
11270        }
11271    }
11272
11273    unsafe impl
11274        fidl::encoding::Encode<
11275            DebugEnableDevToolsRequest,
11276            fidl::encoding::DefaultFuchsiaResourceDialect,
11277        > for &mut DebugEnableDevToolsRequest
11278    {
11279        #[inline]
11280        unsafe fn encode(
11281            self,
11282            encoder: &mut fidl::encoding::Encoder<
11283                '_,
11284                fidl::encoding::DefaultFuchsiaResourceDialect,
11285            >,
11286            offset: usize,
11287            _depth: fidl::encoding::Depth,
11288        ) -> fidl::Result<()> {
11289            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11290            // Delegate to tuple encoding.
11291            fidl::encoding::Encode::<DebugEnableDevToolsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11292                (
11293                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
11294                ),
11295                encoder, offset, _depth
11296            )
11297        }
11298    }
11299    unsafe impl<
11300        T0: fidl::encoding::Encode<
11301                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11302                fidl::encoding::DefaultFuchsiaResourceDialect,
11303            >,
11304    >
11305        fidl::encoding::Encode<
11306            DebugEnableDevToolsRequest,
11307            fidl::encoding::DefaultFuchsiaResourceDialect,
11308        > for (T0,)
11309    {
11310        #[inline]
11311        unsafe fn encode(
11312            self,
11313            encoder: &mut fidl::encoding::Encoder<
11314                '_,
11315                fidl::encoding::DefaultFuchsiaResourceDialect,
11316            >,
11317            offset: usize,
11318            depth: fidl::encoding::Depth,
11319        ) -> fidl::Result<()> {
11320            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11321            // Zero out padding regions. There's no need to apply masks
11322            // because the unmasked parts will be overwritten by fields.
11323            // Write the fields.
11324            self.0.encode(encoder, offset + 0, depth)?;
11325            Ok(())
11326        }
11327    }
11328
11329    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11330        for DebugEnableDevToolsRequest
11331    {
11332        #[inline(always)]
11333        fn new_empty() -> Self {
11334            Self {
11335                listener: fidl::new_empty!(
11336                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11337                    fidl::encoding::DefaultFuchsiaResourceDialect
11338                ),
11339            }
11340        }
11341
11342        #[inline]
11343        unsafe fn decode(
11344            &mut self,
11345            decoder: &mut fidl::encoding::Decoder<
11346                '_,
11347                fidl::encoding::DefaultFuchsiaResourceDialect,
11348            >,
11349            offset: usize,
11350            _depth: fidl::encoding::Depth,
11351        ) -> fidl::Result<()> {
11352            decoder.debug_check_bounds::<Self>(offset);
11353            // Verify that padding bytes are zero.
11354            fidl::decode!(
11355                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11356                fidl::encoding::DefaultFuchsiaResourceDialect,
11357                &mut self.listener,
11358                decoder,
11359                offset + 0,
11360                _depth
11361            )?;
11362            Ok(())
11363        }
11364    }
11365
11366    impl fidl::encoding::ResourceTypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11367        type Borrowed<'a> = &'a mut Self;
11368        fn take_or_borrow<'a>(
11369            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11370        ) -> Self::Borrowed<'a> {
11371            value
11372        }
11373    }
11374
11375    unsafe impl fidl::encoding::TypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11376        type Owned = Self;
11377
11378        #[inline(always)]
11379        fn inline_align(_context: fidl::encoding::Context) -> usize {
11380            4
11381        }
11382
11383        #[inline(always)]
11384        fn inline_size(_context: fidl::encoding::Context) -> usize {
11385            4
11386        }
11387    }
11388
11389    unsafe impl
11390        fidl::encoding::Encode<
11391            DevToolsListenerOnContextDevToolsAvailableRequest,
11392            fidl::encoding::DefaultFuchsiaResourceDialect,
11393        > for &mut DevToolsListenerOnContextDevToolsAvailableRequest
11394    {
11395        #[inline]
11396        unsafe fn encode(
11397            self,
11398            encoder: &mut fidl::encoding::Encoder<
11399                '_,
11400                fidl::encoding::DefaultFuchsiaResourceDialect,
11401            >,
11402            offset: usize,
11403            _depth: fidl::encoding::Depth,
11404        ) -> fidl::Result<()> {
11405            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11406            // Delegate to tuple encoding.
11407            fidl::encoding::Encode::<
11408                DevToolsListenerOnContextDevToolsAvailableRequest,
11409                fidl::encoding::DefaultFuchsiaResourceDialect,
11410            >::encode(
11411                (<fidl::encoding::Endpoint<
11412                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11413                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11414                    &mut self.listener
11415                ),),
11416                encoder,
11417                offset,
11418                _depth,
11419            )
11420        }
11421    }
11422    unsafe impl<
11423        T0: fidl::encoding::Encode<
11424                fidl::encoding::Endpoint<
11425                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11426                >,
11427                fidl::encoding::DefaultFuchsiaResourceDialect,
11428            >,
11429    >
11430        fidl::encoding::Encode<
11431            DevToolsListenerOnContextDevToolsAvailableRequest,
11432            fidl::encoding::DefaultFuchsiaResourceDialect,
11433        > for (T0,)
11434    {
11435        #[inline]
11436        unsafe fn encode(
11437            self,
11438            encoder: &mut fidl::encoding::Encoder<
11439                '_,
11440                fidl::encoding::DefaultFuchsiaResourceDialect,
11441            >,
11442            offset: usize,
11443            depth: fidl::encoding::Depth,
11444        ) -> fidl::Result<()> {
11445            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11446            // Zero out padding regions. There's no need to apply masks
11447            // because the unmasked parts will be overwritten by fields.
11448            // Write the fields.
11449            self.0.encode(encoder, offset + 0, depth)?;
11450            Ok(())
11451        }
11452    }
11453
11454    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11455        for DevToolsListenerOnContextDevToolsAvailableRequest
11456    {
11457        #[inline(always)]
11458        fn new_empty() -> Self {
11459            Self {
11460                listener: fidl::new_empty!(
11461                    fidl::encoding::Endpoint<
11462                        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11463                    >,
11464                    fidl::encoding::DefaultFuchsiaResourceDialect
11465                ),
11466            }
11467        }
11468
11469        #[inline]
11470        unsafe fn decode(
11471            &mut self,
11472            decoder: &mut fidl::encoding::Decoder<
11473                '_,
11474                fidl::encoding::DefaultFuchsiaResourceDialect,
11475            >,
11476            offset: usize,
11477            _depth: fidl::encoding::Depth,
11478        ) -> fidl::Result<()> {
11479            decoder.debug_check_bounds::<Self>(offset);
11480            // Verify that padding bytes are zero.
11481            fidl::decode!(
11482                fidl::encoding::Endpoint<
11483                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11484                >,
11485                fidl::encoding::DefaultFuchsiaResourceDialect,
11486                &mut self.listener,
11487                decoder,
11488                offset + 0,
11489                _depth
11490            )?;
11491            Ok(())
11492        }
11493    }
11494
11495    impl fidl::encoding::ResourceTypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11496        type Borrowed<'a> = &'a mut Self;
11497        fn take_or_borrow<'a>(
11498            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11499        ) -> Self::Borrowed<'a> {
11500            value
11501        }
11502    }
11503
11504    unsafe impl fidl::encoding::TypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11505        type Owned = Self;
11506
11507        #[inline(always)]
11508        fn inline_align(_context: fidl::encoding::Context) -> usize {
11509            8
11510        }
11511
11512        #[inline(always)]
11513        fn inline_size(_context: fidl::encoding::Context) -> usize {
11514            40
11515        }
11516    }
11517
11518    unsafe impl
11519        fidl::encoding::Encode<
11520            FrameAddBeforeLoadJavaScriptRequest,
11521            fidl::encoding::DefaultFuchsiaResourceDialect,
11522        > for &mut FrameAddBeforeLoadJavaScriptRequest
11523    {
11524        #[inline]
11525        unsafe fn encode(
11526            self,
11527            encoder: &mut fidl::encoding::Encoder<
11528                '_,
11529                fidl::encoding::DefaultFuchsiaResourceDialect,
11530            >,
11531            offset: usize,
11532            _depth: fidl::encoding::Depth,
11533        ) -> fidl::Result<()> {
11534            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11535            // Delegate to tuple encoding.
11536            fidl::encoding::Encode::<FrameAddBeforeLoadJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11537                (
11538                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
11539                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
11540                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
11541                ),
11542                encoder, offset, _depth
11543            )
11544        }
11545    }
11546    unsafe impl<
11547        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
11548        T1: fidl::encoding::Encode<
11549                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11550                fidl::encoding::DefaultFuchsiaResourceDialect,
11551            >,
11552        T2: fidl::encoding::Encode<
11553                fidl_fuchsia_mem::Buffer,
11554                fidl::encoding::DefaultFuchsiaResourceDialect,
11555            >,
11556    >
11557        fidl::encoding::Encode<
11558            FrameAddBeforeLoadJavaScriptRequest,
11559            fidl::encoding::DefaultFuchsiaResourceDialect,
11560        > for (T0, T1, T2)
11561    {
11562        #[inline]
11563        unsafe fn encode(
11564            self,
11565            encoder: &mut fidl::encoding::Encoder<
11566                '_,
11567                fidl::encoding::DefaultFuchsiaResourceDialect,
11568            >,
11569            offset: usize,
11570            depth: fidl::encoding::Depth,
11571        ) -> fidl::Result<()> {
11572            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11573            // Zero out padding regions. There's no need to apply masks
11574            // because the unmasked parts will be overwritten by fields.
11575            // Write the fields.
11576            self.0.encode(encoder, offset + 0, depth)?;
11577            self.1.encode(encoder, offset + 8, depth)?;
11578            self.2.encode(encoder, offset + 24, depth)?;
11579            Ok(())
11580        }
11581    }
11582
11583    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11584        for FrameAddBeforeLoadJavaScriptRequest
11585    {
11586        #[inline(always)]
11587        fn new_empty() -> Self {
11588            Self {
11589                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
11590                origins: fidl::new_empty!(
11591                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11592                    fidl::encoding::DefaultFuchsiaResourceDialect
11593                ),
11594                script: fidl::new_empty!(
11595                    fidl_fuchsia_mem::Buffer,
11596                    fidl::encoding::DefaultFuchsiaResourceDialect
11597                ),
11598            }
11599        }
11600
11601        #[inline]
11602        unsafe fn decode(
11603            &mut self,
11604            decoder: &mut fidl::encoding::Decoder<
11605                '_,
11606                fidl::encoding::DefaultFuchsiaResourceDialect,
11607            >,
11608            offset: usize,
11609            _depth: fidl::encoding::Depth,
11610        ) -> fidl::Result<()> {
11611            decoder.debug_check_bounds::<Self>(offset);
11612            // Verify that padding bytes are zero.
11613            fidl::decode!(
11614                u64,
11615                fidl::encoding::DefaultFuchsiaResourceDialect,
11616                &mut self.id,
11617                decoder,
11618                offset + 0,
11619                _depth
11620            )?;
11621            fidl::decode!(
11622                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11623                fidl::encoding::DefaultFuchsiaResourceDialect,
11624                &mut self.origins,
11625                decoder,
11626                offset + 8,
11627                _depth
11628            )?;
11629            fidl::decode!(
11630                fidl_fuchsia_mem::Buffer,
11631                fidl::encoding::DefaultFuchsiaResourceDialect,
11632                &mut self.script,
11633                decoder,
11634                offset + 24,
11635                _depth
11636            )?;
11637            Ok(())
11638        }
11639    }
11640
11641    impl fidl::encoding::ResourceTypeMarker for FrameCreateView2Request {
11642        type Borrowed<'a> = &'a mut Self;
11643        fn take_or_borrow<'a>(
11644            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11645        ) -> Self::Borrowed<'a> {
11646            value
11647        }
11648    }
11649
11650    unsafe impl fidl::encoding::TypeMarker for FrameCreateView2Request {
11651        type Owned = Self;
11652
11653        #[inline(always)]
11654        fn inline_align(_context: fidl::encoding::Context) -> usize {
11655            8
11656        }
11657
11658        #[inline(always)]
11659        fn inline_size(_context: fidl::encoding::Context) -> usize {
11660            16
11661        }
11662    }
11663
11664    unsafe impl
11665        fidl::encoding::Encode<
11666            FrameCreateView2Request,
11667            fidl::encoding::DefaultFuchsiaResourceDialect,
11668        > for &mut FrameCreateView2Request
11669    {
11670        #[inline]
11671        unsafe fn encode(
11672            self,
11673            encoder: &mut fidl::encoding::Encoder<
11674                '_,
11675                fidl::encoding::DefaultFuchsiaResourceDialect,
11676            >,
11677            offset: usize,
11678            _depth: fidl::encoding::Depth,
11679        ) -> fidl::Result<()> {
11680            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11681            // Delegate to tuple encoding.
11682            fidl::encoding::Encode::<
11683                FrameCreateView2Request,
11684                fidl::encoding::DefaultFuchsiaResourceDialect,
11685            >::encode(
11686                (<CreateView2Args as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11687                    &mut self.args,
11688                ),),
11689                encoder,
11690                offset,
11691                _depth,
11692            )
11693        }
11694    }
11695    unsafe impl<
11696        T0: fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>,
11697    >
11698        fidl::encoding::Encode<
11699            FrameCreateView2Request,
11700            fidl::encoding::DefaultFuchsiaResourceDialect,
11701        > for (T0,)
11702    {
11703        #[inline]
11704        unsafe fn encode(
11705            self,
11706            encoder: &mut fidl::encoding::Encoder<
11707                '_,
11708                fidl::encoding::DefaultFuchsiaResourceDialect,
11709            >,
11710            offset: usize,
11711            depth: fidl::encoding::Depth,
11712        ) -> fidl::Result<()> {
11713            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11714            // Zero out padding regions. There's no need to apply masks
11715            // because the unmasked parts will be overwritten by fields.
11716            // Write the fields.
11717            self.0.encode(encoder, offset + 0, depth)?;
11718            Ok(())
11719        }
11720    }
11721
11722    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11723        for FrameCreateView2Request
11724    {
11725        #[inline(always)]
11726        fn new_empty() -> Self {
11727            Self {
11728                args: fidl::new_empty!(
11729                    CreateView2Args,
11730                    fidl::encoding::DefaultFuchsiaResourceDialect
11731                ),
11732            }
11733        }
11734
11735        #[inline]
11736        unsafe fn decode(
11737            &mut self,
11738            decoder: &mut fidl::encoding::Decoder<
11739                '_,
11740                fidl::encoding::DefaultFuchsiaResourceDialect,
11741            >,
11742            offset: usize,
11743            _depth: fidl::encoding::Depth,
11744        ) -> fidl::Result<()> {
11745            decoder.debug_check_bounds::<Self>(offset);
11746            // Verify that padding bytes are zero.
11747            fidl::decode!(
11748                CreateView2Args,
11749                fidl::encoding::DefaultFuchsiaResourceDialect,
11750                &mut self.args,
11751                decoder,
11752                offset + 0,
11753                _depth
11754            )?;
11755            Ok(())
11756        }
11757    }
11758
11759    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewRequest {
11760        type Borrowed<'a> = &'a mut Self;
11761        fn take_or_borrow<'a>(
11762            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11763        ) -> Self::Borrowed<'a> {
11764            value
11765        }
11766    }
11767
11768    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewRequest {
11769        type Owned = Self;
11770
11771        #[inline(always)]
11772        fn inline_align(_context: fidl::encoding::Context) -> usize {
11773            4
11774        }
11775
11776        #[inline(always)]
11777        fn inline_size(_context: fidl::encoding::Context) -> usize {
11778            4
11779        }
11780    }
11781
11782    unsafe impl
11783        fidl::encoding::Encode<
11784            FrameCreateViewRequest,
11785            fidl::encoding::DefaultFuchsiaResourceDialect,
11786        > for &mut FrameCreateViewRequest
11787    {
11788        #[inline]
11789        unsafe fn encode(
11790            self,
11791            encoder: &mut fidl::encoding::Encoder<
11792                '_,
11793                fidl::encoding::DefaultFuchsiaResourceDialect,
11794            >,
11795            offset: usize,
11796            _depth: fidl::encoding::Depth,
11797        ) -> fidl::Result<()> {
11798            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11799            // Delegate to tuple encoding.
11800            fidl::encoding::Encode::<FrameCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11801                (
11802                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11803                ),
11804                encoder, offset, _depth
11805            )
11806        }
11807    }
11808    unsafe impl<
11809        T0: fidl::encoding::Encode<
11810                fidl_fuchsia_ui_views::ViewToken,
11811                fidl::encoding::DefaultFuchsiaResourceDialect,
11812            >,
11813    >
11814        fidl::encoding::Encode<
11815            FrameCreateViewRequest,
11816            fidl::encoding::DefaultFuchsiaResourceDialect,
11817        > for (T0,)
11818    {
11819        #[inline]
11820        unsafe fn encode(
11821            self,
11822            encoder: &mut fidl::encoding::Encoder<
11823                '_,
11824                fidl::encoding::DefaultFuchsiaResourceDialect,
11825            >,
11826            offset: usize,
11827            depth: fidl::encoding::Depth,
11828        ) -> fidl::Result<()> {
11829            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11830            // Zero out padding regions. There's no need to apply masks
11831            // because the unmasked parts will be overwritten by fields.
11832            // Write the fields.
11833            self.0.encode(encoder, offset + 0, depth)?;
11834            Ok(())
11835        }
11836    }
11837
11838    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11839        for FrameCreateViewRequest
11840    {
11841        #[inline(always)]
11842        fn new_empty() -> Self {
11843            Self {
11844                view_token: fidl::new_empty!(
11845                    fidl_fuchsia_ui_views::ViewToken,
11846                    fidl::encoding::DefaultFuchsiaResourceDialect
11847                ),
11848            }
11849        }
11850
11851        #[inline]
11852        unsafe fn decode(
11853            &mut self,
11854            decoder: &mut fidl::encoding::Decoder<
11855                '_,
11856                fidl::encoding::DefaultFuchsiaResourceDialect,
11857            >,
11858            offset: usize,
11859            _depth: fidl::encoding::Depth,
11860        ) -> fidl::Result<()> {
11861            decoder.debug_check_bounds::<Self>(offset);
11862            // Verify that padding bytes are zero.
11863            fidl::decode!(
11864                fidl_fuchsia_ui_views::ViewToken,
11865                fidl::encoding::DefaultFuchsiaResourceDialect,
11866                &mut self.view_token,
11867                decoder,
11868                offset + 0,
11869                _depth
11870            )?;
11871            Ok(())
11872        }
11873    }
11874
11875    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewWithViewRefRequest {
11876        type Borrowed<'a> = &'a mut Self;
11877        fn take_or_borrow<'a>(
11878            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11879        ) -> Self::Borrowed<'a> {
11880            value
11881        }
11882    }
11883
11884    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewWithViewRefRequest {
11885        type Owned = Self;
11886
11887        #[inline(always)]
11888        fn inline_align(_context: fidl::encoding::Context) -> usize {
11889            4
11890        }
11891
11892        #[inline(always)]
11893        fn inline_size(_context: fidl::encoding::Context) -> usize {
11894            12
11895        }
11896    }
11897
11898    unsafe impl
11899        fidl::encoding::Encode<
11900            FrameCreateViewWithViewRefRequest,
11901            fidl::encoding::DefaultFuchsiaResourceDialect,
11902        > for &mut FrameCreateViewWithViewRefRequest
11903    {
11904        #[inline]
11905        unsafe fn encode(
11906            self,
11907            encoder: &mut fidl::encoding::Encoder<
11908                '_,
11909                fidl::encoding::DefaultFuchsiaResourceDialect,
11910            >,
11911            offset: usize,
11912            _depth: fidl::encoding::Depth,
11913        ) -> fidl::Result<()> {
11914            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11915            // Delegate to tuple encoding.
11916            fidl::encoding::Encode::<FrameCreateViewWithViewRefRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11917                (
11918                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11919                    <fidl_fuchsia_ui_views::ViewRefControl as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref_control),
11920                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
11921                ),
11922                encoder, offset, _depth
11923            )
11924        }
11925    }
11926    unsafe impl<
11927        T0: fidl::encoding::Encode<
11928                fidl_fuchsia_ui_views::ViewToken,
11929                fidl::encoding::DefaultFuchsiaResourceDialect,
11930            >,
11931        T1: fidl::encoding::Encode<
11932                fidl_fuchsia_ui_views::ViewRefControl,
11933                fidl::encoding::DefaultFuchsiaResourceDialect,
11934            >,
11935        T2: fidl::encoding::Encode<
11936                fidl_fuchsia_ui_views::ViewRef,
11937                fidl::encoding::DefaultFuchsiaResourceDialect,
11938            >,
11939    >
11940        fidl::encoding::Encode<
11941            FrameCreateViewWithViewRefRequest,
11942            fidl::encoding::DefaultFuchsiaResourceDialect,
11943        > for (T0, T1, T2)
11944    {
11945        #[inline]
11946        unsafe fn encode(
11947            self,
11948            encoder: &mut fidl::encoding::Encoder<
11949                '_,
11950                fidl::encoding::DefaultFuchsiaResourceDialect,
11951            >,
11952            offset: usize,
11953            depth: fidl::encoding::Depth,
11954        ) -> fidl::Result<()> {
11955            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11956            // Zero out padding regions. There's no need to apply masks
11957            // because the unmasked parts will be overwritten by fields.
11958            // Write the fields.
11959            self.0.encode(encoder, offset + 0, depth)?;
11960            self.1.encode(encoder, offset + 4, depth)?;
11961            self.2.encode(encoder, offset + 8, depth)?;
11962            Ok(())
11963        }
11964    }
11965
11966    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11967        for FrameCreateViewWithViewRefRequest
11968    {
11969        #[inline(always)]
11970        fn new_empty() -> Self {
11971            Self {
11972                view_token: fidl::new_empty!(
11973                    fidl_fuchsia_ui_views::ViewToken,
11974                    fidl::encoding::DefaultFuchsiaResourceDialect
11975                ),
11976                view_ref_control: fidl::new_empty!(
11977                    fidl_fuchsia_ui_views::ViewRefControl,
11978                    fidl::encoding::DefaultFuchsiaResourceDialect
11979                ),
11980                view_ref: fidl::new_empty!(
11981                    fidl_fuchsia_ui_views::ViewRef,
11982                    fidl::encoding::DefaultFuchsiaResourceDialect
11983                ),
11984            }
11985        }
11986
11987        #[inline]
11988        unsafe fn decode(
11989            &mut self,
11990            decoder: &mut fidl::encoding::Decoder<
11991                '_,
11992                fidl::encoding::DefaultFuchsiaResourceDialect,
11993            >,
11994            offset: usize,
11995            _depth: fidl::encoding::Depth,
11996        ) -> fidl::Result<()> {
11997            decoder.debug_check_bounds::<Self>(offset);
11998            // Verify that padding bytes are zero.
11999            fidl::decode!(
12000                fidl_fuchsia_ui_views::ViewToken,
12001                fidl::encoding::DefaultFuchsiaResourceDialect,
12002                &mut self.view_token,
12003                decoder,
12004                offset + 0,
12005                _depth
12006            )?;
12007            fidl::decode!(
12008                fidl_fuchsia_ui_views::ViewRefControl,
12009                fidl::encoding::DefaultFuchsiaResourceDialect,
12010                &mut self.view_ref_control,
12011                decoder,
12012                offset + 4,
12013                _depth
12014            )?;
12015            fidl::decode!(
12016                fidl_fuchsia_ui_views::ViewRef,
12017                fidl::encoding::DefaultFuchsiaResourceDialect,
12018                &mut self.view_ref,
12019                decoder,
12020                offset + 8,
12021                _depth
12022            )?;
12023            Ok(())
12024        }
12025    }
12026
12027    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptNoResultRequest {
12028        type Borrowed<'a> = &'a mut Self;
12029        fn take_or_borrow<'a>(
12030            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12031        ) -> Self::Borrowed<'a> {
12032            value
12033        }
12034    }
12035
12036    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptNoResultRequest {
12037        type Owned = Self;
12038
12039        #[inline(always)]
12040        fn inline_align(_context: fidl::encoding::Context) -> usize {
12041            8
12042        }
12043
12044        #[inline(always)]
12045        fn inline_size(_context: fidl::encoding::Context) -> usize {
12046            32
12047        }
12048    }
12049
12050    unsafe impl
12051        fidl::encoding::Encode<
12052            FrameExecuteJavaScriptNoResultRequest,
12053            fidl::encoding::DefaultFuchsiaResourceDialect,
12054        > for &mut FrameExecuteJavaScriptNoResultRequest
12055    {
12056        #[inline]
12057        unsafe fn encode(
12058            self,
12059            encoder: &mut fidl::encoding::Encoder<
12060                '_,
12061                fidl::encoding::DefaultFuchsiaResourceDialect,
12062            >,
12063            offset: usize,
12064            _depth: fidl::encoding::Depth,
12065        ) -> fidl::Result<()> {
12066            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
12067            // Delegate to tuple encoding.
12068            fidl::encoding::Encode::<FrameExecuteJavaScriptNoResultRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12069                (
12070                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12071                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12072                ),
12073                encoder, offset, _depth
12074            )
12075        }
12076    }
12077    unsafe impl<
12078        T0: fidl::encoding::Encode<
12079                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12080                fidl::encoding::DefaultFuchsiaResourceDialect,
12081            >,
12082        T1: fidl::encoding::Encode<
12083                fidl_fuchsia_mem::Buffer,
12084                fidl::encoding::DefaultFuchsiaResourceDialect,
12085            >,
12086    >
12087        fidl::encoding::Encode<
12088            FrameExecuteJavaScriptNoResultRequest,
12089            fidl::encoding::DefaultFuchsiaResourceDialect,
12090        > for (T0, T1)
12091    {
12092        #[inline]
12093        unsafe fn encode(
12094            self,
12095            encoder: &mut fidl::encoding::Encoder<
12096                '_,
12097                fidl::encoding::DefaultFuchsiaResourceDialect,
12098            >,
12099            offset: usize,
12100            depth: fidl::encoding::Depth,
12101        ) -> fidl::Result<()> {
12102            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
12103            // Zero out padding regions. There's no need to apply masks
12104            // because the unmasked parts will be overwritten by fields.
12105            // Write the fields.
12106            self.0.encode(encoder, offset + 0, depth)?;
12107            self.1.encode(encoder, offset + 16, depth)?;
12108            Ok(())
12109        }
12110    }
12111
12112    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12113        for FrameExecuteJavaScriptNoResultRequest
12114    {
12115        #[inline(always)]
12116        fn new_empty() -> Self {
12117            Self {
12118                origins: fidl::new_empty!(
12119                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12120                    fidl::encoding::DefaultFuchsiaResourceDialect
12121                ),
12122                script: fidl::new_empty!(
12123                    fidl_fuchsia_mem::Buffer,
12124                    fidl::encoding::DefaultFuchsiaResourceDialect
12125                ),
12126            }
12127        }
12128
12129        #[inline]
12130        unsafe fn decode(
12131            &mut self,
12132            decoder: &mut fidl::encoding::Decoder<
12133                '_,
12134                fidl::encoding::DefaultFuchsiaResourceDialect,
12135            >,
12136            offset: usize,
12137            _depth: fidl::encoding::Depth,
12138        ) -> fidl::Result<()> {
12139            decoder.debug_check_bounds::<Self>(offset);
12140            // Verify that padding bytes are zero.
12141            fidl::decode!(
12142                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12143                fidl::encoding::DefaultFuchsiaResourceDialect,
12144                &mut self.origins,
12145                decoder,
12146                offset + 0,
12147                _depth
12148            )?;
12149            fidl::decode!(
12150                fidl_fuchsia_mem::Buffer,
12151                fidl::encoding::DefaultFuchsiaResourceDialect,
12152                &mut self.script,
12153                decoder,
12154                offset + 16,
12155                _depth
12156            )?;
12157            Ok(())
12158        }
12159    }
12160
12161    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptRequest {
12162        type Borrowed<'a> = &'a mut Self;
12163        fn take_or_borrow<'a>(
12164            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12165        ) -> Self::Borrowed<'a> {
12166            value
12167        }
12168    }
12169
12170    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptRequest {
12171        type Owned = Self;
12172
12173        #[inline(always)]
12174        fn inline_align(_context: fidl::encoding::Context) -> usize {
12175            8
12176        }
12177
12178        #[inline(always)]
12179        fn inline_size(_context: fidl::encoding::Context) -> usize {
12180            32
12181        }
12182    }
12183
12184    unsafe impl
12185        fidl::encoding::Encode<
12186            FrameExecuteJavaScriptRequest,
12187            fidl::encoding::DefaultFuchsiaResourceDialect,
12188        > for &mut FrameExecuteJavaScriptRequest
12189    {
12190        #[inline]
12191        unsafe fn encode(
12192            self,
12193            encoder: &mut fidl::encoding::Encoder<
12194                '_,
12195                fidl::encoding::DefaultFuchsiaResourceDialect,
12196            >,
12197            offset: usize,
12198            _depth: fidl::encoding::Depth,
12199        ) -> fidl::Result<()> {
12200            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12201            // Delegate to tuple encoding.
12202            fidl::encoding::Encode::<FrameExecuteJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12203                (
12204                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12205                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12206                ),
12207                encoder, offset, _depth
12208            )
12209        }
12210    }
12211    unsafe impl<
12212        T0: fidl::encoding::Encode<
12213                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12214                fidl::encoding::DefaultFuchsiaResourceDialect,
12215            >,
12216        T1: fidl::encoding::Encode<
12217                fidl_fuchsia_mem::Buffer,
12218                fidl::encoding::DefaultFuchsiaResourceDialect,
12219            >,
12220    >
12221        fidl::encoding::Encode<
12222            FrameExecuteJavaScriptRequest,
12223            fidl::encoding::DefaultFuchsiaResourceDialect,
12224        > for (T0, T1)
12225    {
12226        #[inline]
12227        unsafe fn encode(
12228            self,
12229            encoder: &mut fidl::encoding::Encoder<
12230                '_,
12231                fidl::encoding::DefaultFuchsiaResourceDialect,
12232            >,
12233            offset: usize,
12234            depth: fidl::encoding::Depth,
12235        ) -> fidl::Result<()> {
12236            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12237            // Zero out padding regions. There's no need to apply masks
12238            // because the unmasked parts will be overwritten by fields.
12239            // Write the fields.
12240            self.0.encode(encoder, offset + 0, depth)?;
12241            self.1.encode(encoder, offset + 16, depth)?;
12242            Ok(())
12243        }
12244    }
12245
12246    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12247        for FrameExecuteJavaScriptRequest
12248    {
12249        #[inline(always)]
12250        fn new_empty() -> Self {
12251            Self {
12252                origins: fidl::new_empty!(
12253                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12254                    fidl::encoding::DefaultFuchsiaResourceDialect
12255                ),
12256                script: fidl::new_empty!(
12257                    fidl_fuchsia_mem::Buffer,
12258                    fidl::encoding::DefaultFuchsiaResourceDialect
12259                ),
12260            }
12261        }
12262
12263        #[inline]
12264        unsafe fn decode(
12265            &mut self,
12266            decoder: &mut fidl::encoding::Decoder<
12267                '_,
12268                fidl::encoding::DefaultFuchsiaResourceDialect,
12269            >,
12270            offset: usize,
12271            _depth: fidl::encoding::Depth,
12272        ) -> fidl::Result<()> {
12273            decoder.debug_check_bounds::<Self>(offset);
12274            // Verify that padding bytes are zero.
12275            fidl::decode!(
12276                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12277                fidl::encoding::DefaultFuchsiaResourceDialect,
12278                &mut self.origins,
12279                decoder,
12280                offset + 0,
12281                _depth
12282            )?;
12283            fidl::decode!(
12284                fidl_fuchsia_mem::Buffer,
12285                fidl::encoding::DefaultFuchsiaResourceDialect,
12286                &mut self.script,
12287                decoder,
12288                offset + 16,
12289                _depth
12290            )?;
12291            Ok(())
12292        }
12293    }
12294
12295    impl fidl::encoding::ResourceTypeMarker for FrameGetMediaPlayerRequest {
12296        type Borrowed<'a> = &'a mut Self;
12297        fn take_or_borrow<'a>(
12298            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12299        ) -> Self::Borrowed<'a> {
12300            value
12301        }
12302    }
12303
12304    unsafe impl fidl::encoding::TypeMarker for FrameGetMediaPlayerRequest {
12305        type Owned = Self;
12306
12307        #[inline(always)]
12308        fn inline_align(_context: fidl::encoding::Context) -> usize {
12309            4
12310        }
12311
12312        #[inline(always)]
12313        fn inline_size(_context: fidl::encoding::Context) -> usize {
12314            4
12315        }
12316    }
12317
12318    unsafe impl
12319        fidl::encoding::Encode<
12320            FrameGetMediaPlayerRequest,
12321            fidl::encoding::DefaultFuchsiaResourceDialect,
12322        > for &mut FrameGetMediaPlayerRequest
12323    {
12324        #[inline]
12325        unsafe fn encode(
12326            self,
12327            encoder: &mut fidl::encoding::Encoder<
12328                '_,
12329                fidl::encoding::DefaultFuchsiaResourceDialect,
12330            >,
12331            offset: usize,
12332            _depth: fidl::encoding::Depth,
12333        ) -> fidl::Result<()> {
12334            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12335            // Delegate to tuple encoding.
12336            fidl::encoding::Encode::<
12337                FrameGetMediaPlayerRequest,
12338                fidl::encoding::DefaultFuchsiaResourceDialect,
12339            >::encode(
12340                (<fidl::encoding::Endpoint<
12341                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12342                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12343                    &mut self.player
12344                ),),
12345                encoder,
12346                offset,
12347                _depth,
12348            )
12349        }
12350    }
12351    unsafe impl<
12352        T0: fidl::encoding::Encode<
12353                fidl::encoding::Endpoint<
12354                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12355                >,
12356                fidl::encoding::DefaultFuchsiaResourceDialect,
12357            >,
12358    >
12359        fidl::encoding::Encode<
12360            FrameGetMediaPlayerRequest,
12361            fidl::encoding::DefaultFuchsiaResourceDialect,
12362        > for (T0,)
12363    {
12364        #[inline]
12365        unsafe fn encode(
12366            self,
12367            encoder: &mut fidl::encoding::Encoder<
12368                '_,
12369                fidl::encoding::DefaultFuchsiaResourceDialect,
12370            >,
12371            offset: usize,
12372            depth: fidl::encoding::Depth,
12373        ) -> fidl::Result<()> {
12374            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12375            // Zero out padding regions. There's no need to apply masks
12376            // because the unmasked parts will be overwritten by fields.
12377            // Write the fields.
12378            self.0.encode(encoder, offset + 0, depth)?;
12379            Ok(())
12380        }
12381    }
12382
12383    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12384        for FrameGetMediaPlayerRequest
12385    {
12386        #[inline(always)]
12387        fn new_empty() -> Self {
12388            Self {
12389                player: fidl::new_empty!(
12390                    fidl::encoding::Endpoint<
12391                        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12392                    >,
12393                    fidl::encoding::DefaultFuchsiaResourceDialect
12394                ),
12395            }
12396        }
12397
12398        #[inline]
12399        unsafe fn decode(
12400            &mut self,
12401            decoder: &mut fidl::encoding::Decoder<
12402                '_,
12403                fidl::encoding::DefaultFuchsiaResourceDialect,
12404            >,
12405            offset: usize,
12406            _depth: fidl::encoding::Depth,
12407        ) -> fidl::Result<()> {
12408            decoder.debug_check_bounds::<Self>(offset);
12409            // Verify that padding bytes are zero.
12410            fidl::decode!(
12411                fidl::encoding::Endpoint<
12412                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12413                >,
12414                fidl::encoding::DefaultFuchsiaResourceDialect,
12415                &mut self.player,
12416                decoder,
12417                offset + 0,
12418                _depth
12419            )?;
12420            Ok(())
12421        }
12422    }
12423
12424    impl fidl::encoding::ResourceTypeMarker for FrameGetNavigationControllerRequest {
12425        type Borrowed<'a> = &'a mut Self;
12426        fn take_or_borrow<'a>(
12427            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12428        ) -> Self::Borrowed<'a> {
12429            value
12430        }
12431    }
12432
12433    unsafe impl fidl::encoding::TypeMarker for FrameGetNavigationControllerRequest {
12434        type Owned = Self;
12435
12436        #[inline(always)]
12437        fn inline_align(_context: fidl::encoding::Context) -> usize {
12438            4
12439        }
12440
12441        #[inline(always)]
12442        fn inline_size(_context: fidl::encoding::Context) -> usize {
12443            4
12444        }
12445    }
12446
12447    unsafe impl
12448        fidl::encoding::Encode<
12449            FrameGetNavigationControllerRequest,
12450            fidl::encoding::DefaultFuchsiaResourceDialect,
12451        > for &mut FrameGetNavigationControllerRequest
12452    {
12453        #[inline]
12454        unsafe fn encode(
12455            self,
12456            encoder: &mut fidl::encoding::Encoder<
12457                '_,
12458                fidl::encoding::DefaultFuchsiaResourceDialect,
12459            >,
12460            offset: usize,
12461            _depth: fidl::encoding::Depth,
12462        ) -> fidl::Result<()> {
12463            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12464            // Delegate to tuple encoding.
12465            fidl::encoding::Encode::<
12466                FrameGetNavigationControllerRequest,
12467                fidl::encoding::DefaultFuchsiaResourceDialect,
12468            >::encode(
12469                (
12470                    <fidl::encoding::Endpoint<
12471                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12472                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12473                        &mut self.controller
12474                    ),
12475                ),
12476                encoder,
12477                offset,
12478                _depth,
12479            )
12480        }
12481    }
12482    unsafe impl<
12483        T0: fidl::encoding::Encode<
12484                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12485                fidl::encoding::DefaultFuchsiaResourceDialect,
12486            >,
12487    >
12488        fidl::encoding::Encode<
12489            FrameGetNavigationControllerRequest,
12490            fidl::encoding::DefaultFuchsiaResourceDialect,
12491        > for (T0,)
12492    {
12493        #[inline]
12494        unsafe fn encode(
12495            self,
12496            encoder: &mut fidl::encoding::Encoder<
12497                '_,
12498                fidl::encoding::DefaultFuchsiaResourceDialect,
12499            >,
12500            offset: usize,
12501            depth: fidl::encoding::Depth,
12502        ) -> fidl::Result<()> {
12503            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12504            // Zero out padding regions. There's no need to apply masks
12505            // because the unmasked parts will be overwritten by fields.
12506            // Write the fields.
12507            self.0.encode(encoder, offset + 0, depth)?;
12508            Ok(())
12509        }
12510    }
12511
12512    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12513        for FrameGetNavigationControllerRequest
12514    {
12515        #[inline(always)]
12516        fn new_empty() -> Self {
12517            Self {
12518                controller: fidl::new_empty!(
12519                    fidl::encoding::Endpoint<
12520                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12521                    >,
12522                    fidl::encoding::DefaultFuchsiaResourceDialect
12523                ),
12524            }
12525        }
12526
12527        #[inline]
12528        unsafe fn decode(
12529            &mut self,
12530            decoder: &mut fidl::encoding::Decoder<
12531                '_,
12532                fidl::encoding::DefaultFuchsiaResourceDialect,
12533            >,
12534            offset: usize,
12535            _depth: fidl::encoding::Depth,
12536        ) -> fidl::Result<()> {
12537            decoder.debug_check_bounds::<Self>(offset);
12538            // Verify that padding bytes are zero.
12539            fidl::decode!(
12540                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12541                fidl::encoding::DefaultFuchsiaResourceDialect,
12542                &mut self.controller,
12543                decoder,
12544                offset + 0,
12545                _depth
12546            )?;
12547            Ok(())
12548        }
12549    }
12550
12551    impl fidl::encoding::ResourceTypeMarker for FrameHostCreateFrameWithParamsRequest {
12552        type Borrowed<'a> = &'a mut Self;
12553        fn take_or_borrow<'a>(
12554            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12555        ) -> Self::Borrowed<'a> {
12556            value
12557        }
12558    }
12559
12560    unsafe impl fidl::encoding::TypeMarker for FrameHostCreateFrameWithParamsRequest {
12561        type Owned = Self;
12562
12563        #[inline(always)]
12564        fn inline_align(_context: fidl::encoding::Context) -> usize {
12565            8
12566        }
12567
12568        #[inline(always)]
12569        fn inline_size(_context: fidl::encoding::Context) -> usize {
12570            24
12571        }
12572    }
12573
12574    unsafe impl
12575        fidl::encoding::Encode<
12576            FrameHostCreateFrameWithParamsRequest,
12577            fidl::encoding::DefaultFuchsiaResourceDialect,
12578        > for &mut FrameHostCreateFrameWithParamsRequest
12579    {
12580        #[inline]
12581        unsafe fn encode(
12582            self,
12583            encoder: &mut fidl::encoding::Encoder<
12584                '_,
12585                fidl::encoding::DefaultFuchsiaResourceDialect,
12586            >,
12587            offset: usize,
12588            _depth: fidl::encoding::Depth,
12589        ) -> fidl::Result<()> {
12590            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12591            // Delegate to tuple encoding.
12592            fidl::encoding::Encode::<FrameHostCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12593                (
12594                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
12595                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
12596                ),
12597                encoder, offset, _depth
12598            )
12599        }
12600    }
12601    unsafe impl<
12602        T0: fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
12603        T1: fidl::encoding::Encode<
12604                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12605                fidl::encoding::DefaultFuchsiaResourceDialect,
12606            >,
12607    >
12608        fidl::encoding::Encode<
12609            FrameHostCreateFrameWithParamsRequest,
12610            fidl::encoding::DefaultFuchsiaResourceDialect,
12611        > for (T0, T1)
12612    {
12613        #[inline]
12614        unsafe fn encode(
12615            self,
12616            encoder: &mut fidl::encoding::Encoder<
12617                '_,
12618                fidl::encoding::DefaultFuchsiaResourceDialect,
12619            >,
12620            offset: usize,
12621            depth: fidl::encoding::Depth,
12622        ) -> fidl::Result<()> {
12623            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12624            // Zero out padding regions. There's no need to apply masks
12625            // because the unmasked parts will be overwritten by fields.
12626            unsafe {
12627                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
12628                (ptr as *mut u64).write_unaligned(0);
12629            }
12630            // Write the fields.
12631            self.0.encode(encoder, offset + 0, depth)?;
12632            self.1.encode(encoder, offset + 16, depth)?;
12633            Ok(())
12634        }
12635    }
12636
12637    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12638        for FrameHostCreateFrameWithParamsRequest
12639    {
12640        #[inline(always)]
12641        fn new_empty() -> Self {
12642            Self {
12643                params: fidl::new_empty!(
12644                    CreateFrameParams,
12645                    fidl::encoding::DefaultFuchsiaResourceDialect
12646                ),
12647                frame: fidl::new_empty!(
12648                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12649                    fidl::encoding::DefaultFuchsiaResourceDialect
12650                ),
12651            }
12652        }
12653
12654        #[inline]
12655        unsafe fn decode(
12656            &mut self,
12657            decoder: &mut fidl::encoding::Decoder<
12658                '_,
12659                fidl::encoding::DefaultFuchsiaResourceDialect,
12660            >,
12661            offset: usize,
12662            _depth: fidl::encoding::Depth,
12663        ) -> fidl::Result<()> {
12664            decoder.debug_check_bounds::<Self>(offset);
12665            // Verify that padding bytes are zero.
12666            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
12667            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12668            let mask = 0xffffffff00000000u64;
12669            let maskedval = padval & mask;
12670            if maskedval != 0 {
12671                return Err(fidl::Error::NonZeroPadding {
12672                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
12673                });
12674            }
12675            fidl::decode!(
12676                CreateFrameParams,
12677                fidl::encoding::DefaultFuchsiaResourceDialect,
12678                &mut self.params,
12679                decoder,
12680                offset + 0,
12681                _depth
12682            )?;
12683            fidl::decode!(
12684                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12685                fidl::encoding::DefaultFuchsiaResourceDialect,
12686                &mut self.frame,
12687                decoder,
12688                offset + 16,
12689                _depth
12690            )?;
12691            Ok(())
12692        }
12693    }
12694
12695    impl fidl::encoding::ResourceTypeMarker for FramePostMessageRequest {
12696        type Borrowed<'a> = &'a mut Self;
12697        fn take_or_borrow<'a>(
12698            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12699        ) -> Self::Borrowed<'a> {
12700            value
12701        }
12702    }
12703
12704    unsafe impl fidl::encoding::TypeMarker for FramePostMessageRequest {
12705        type Owned = Self;
12706
12707        #[inline(always)]
12708        fn inline_align(_context: fidl::encoding::Context) -> usize {
12709            8
12710        }
12711
12712        #[inline(always)]
12713        fn inline_size(_context: fidl::encoding::Context) -> usize {
12714            32
12715        }
12716    }
12717
12718    unsafe impl
12719        fidl::encoding::Encode<
12720            FramePostMessageRequest,
12721            fidl::encoding::DefaultFuchsiaResourceDialect,
12722        > for &mut FramePostMessageRequest
12723    {
12724        #[inline]
12725        unsafe fn encode(
12726            self,
12727            encoder: &mut fidl::encoding::Encoder<
12728                '_,
12729                fidl::encoding::DefaultFuchsiaResourceDialect,
12730            >,
12731            offset: usize,
12732            _depth: fidl::encoding::Depth,
12733        ) -> fidl::Result<()> {
12734            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12735            // Delegate to tuple encoding.
12736            fidl::encoding::Encode::<FramePostMessageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12737                (
12738                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.target_origin),
12739                    <WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.message),
12740                ),
12741                encoder, offset, _depth
12742            )
12743        }
12744    }
12745    unsafe impl<
12746        T0: fidl::encoding::Encode<
12747                fidl::encoding::BoundedString<65536>,
12748                fidl::encoding::DefaultFuchsiaResourceDialect,
12749            >,
12750        T1: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
12751    >
12752        fidl::encoding::Encode<
12753            FramePostMessageRequest,
12754            fidl::encoding::DefaultFuchsiaResourceDialect,
12755        > for (T0, T1)
12756    {
12757        #[inline]
12758        unsafe fn encode(
12759            self,
12760            encoder: &mut fidl::encoding::Encoder<
12761                '_,
12762                fidl::encoding::DefaultFuchsiaResourceDialect,
12763            >,
12764            offset: usize,
12765            depth: fidl::encoding::Depth,
12766        ) -> fidl::Result<()> {
12767            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12768            // Zero out padding regions. There's no need to apply masks
12769            // because the unmasked parts will be overwritten by fields.
12770            // Write the fields.
12771            self.0.encode(encoder, offset + 0, depth)?;
12772            self.1.encode(encoder, offset + 16, depth)?;
12773            Ok(())
12774        }
12775    }
12776
12777    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12778        for FramePostMessageRequest
12779    {
12780        #[inline(always)]
12781        fn new_empty() -> Self {
12782            Self {
12783                target_origin: fidl::new_empty!(
12784                    fidl::encoding::BoundedString<65536>,
12785                    fidl::encoding::DefaultFuchsiaResourceDialect
12786                ),
12787                message: fidl::new_empty!(
12788                    WebMessage,
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::BoundedString<65536>,
12808                fidl::encoding::DefaultFuchsiaResourceDialect,
12809                &mut self.target_origin,
12810                decoder,
12811                offset + 0,
12812                _depth
12813            )?;
12814            fidl::decode!(
12815                WebMessage,
12816                fidl::encoding::DefaultFuchsiaResourceDialect,
12817                &mut self.message,
12818                decoder,
12819                offset + 16,
12820                _depth
12821            )?;
12822            Ok(())
12823        }
12824    }
12825
12826    impl fidl::encoding::ResourceTypeMarker for FrameSetConsoleLogSinkRequest {
12827        type Borrowed<'a> = &'a mut Self;
12828        fn take_or_borrow<'a>(
12829            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12830        ) -> Self::Borrowed<'a> {
12831            value
12832        }
12833    }
12834
12835    unsafe impl fidl::encoding::TypeMarker for FrameSetConsoleLogSinkRequest {
12836        type Owned = Self;
12837
12838        #[inline(always)]
12839        fn inline_align(_context: fidl::encoding::Context) -> usize {
12840            4
12841        }
12842
12843        #[inline(always)]
12844        fn inline_size(_context: fidl::encoding::Context) -> usize {
12845            4
12846        }
12847    }
12848
12849    unsafe impl
12850        fidl::encoding::Encode<
12851            FrameSetConsoleLogSinkRequest,
12852            fidl::encoding::DefaultFuchsiaResourceDialect,
12853        > for &mut FrameSetConsoleLogSinkRequest
12854    {
12855        #[inline]
12856        unsafe fn encode(
12857            self,
12858            encoder: &mut fidl::encoding::Encoder<
12859                '_,
12860                fidl::encoding::DefaultFuchsiaResourceDialect,
12861            >,
12862            offset: usize,
12863            _depth: fidl::encoding::Depth,
12864        ) -> fidl::Result<()> {
12865            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12866            // Delegate to tuple encoding.
12867            fidl::encoding::Encode::<
12868                FrameSetConsoleLogSinkRequest,
12869                fidl::encoding::DefaultFuchsiaResourceDialect,
12870            >::encode(
12871                (<fidl::encoding::Optional<
12872                    fidl::encoding::Endpoint<
12873                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12874                    >,
12875                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12876                    &mut self.sink
12877                ),),
12878                encoder,
12879                offset,
12880                _depth,
12881            )
12882        }
12883    }
12884    unsafe impl<
12885        T0: fidl::encoding::Encode<
12886                fidl::encoding::Optional<
12887                    fidl::encoding::Endpoint<
12888                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12889                    >,
12890                >,
12891                fidl::encoding::DefaultFuchsiaResourceDialect,
12892            >,
12893    >
12894        fidl::encoding::Encode<
12895            FrameSetConsoleLogSinkRequest,
12896            fidl::encoding::DefaultFuchsiaResourceDialect,
12897        > for (T0,)
12898    {
12899        #[inline]
12900        unsafe fn encode(
12901            self,
12902            encoder: &mut fidl::encoding::Encoder<
12903                '_,
12904                fidl::encoding::DefaultFuchsiaResourceDialect,
12905            >,
12906            offset: usize,
12907            depth: fidl::encoding::Depth,
12908        ) -> fidl::Result<()> {
12909            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12910            // Zero out padding regions. There's no need to apply masks
12911            // because the unmasked parts will be overwritten by fields.
12912            // Write the fields.
12913            self.0.encode(encoder, offset + 0, depth)?;
12914            Ok(())
12915        }
12916    }
12917
12918    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12919        for FrameSetConsoleLogSinkRequest
12920    {
12921        #[inline(always)]
12922        fn new_empty() -> Self {
12923            Self {
12924                sink: fidl::new_empty!(
12925                    fidl::encoding::Optional<
12926                        fidl::encoding::Endpoint<
12927                            fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12928                        >,
12929                    >,
12930                    fidl::encoding::DefaultFuchsiaResourceDialect
12931                ),
12932            }
12933        }
12934
12935        #[inline]
12936        unsafe fn decode(
12937            &mut self,
12938            decoder: &mut fidl::encoding::Decoder<
12939                '_,
12940                fidl::encoding::DefaultFuchsiaResourceDialect,
12941            >,
12942            offset: usize,
12943            _depth: fidl::encoding::Depth,
12944        ) -> fidl::Result<()> {
12945            decoder.debug_check_bounds::<Self>(offset);
12946            // Verify that padding bytes are zero.
12947            fidl::decode!(
12948                fidl::encoding::Optional<
12949                    fidl::encoding::Endpoint<
12950                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12951                    >,
12952                >,
12953                fidl::encoding::DefaultFuchsiaResourceDialect,
12954                &mut self.sink,
12955                decoder,
12956                offset + 0,
12957                _depth
12958            )?;
12959            Ok(())
12960        }
12961    }
12962
12963    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListener2Request {
12964        type Borrowed<'a> = &'a mut Self;
12965        fn take_or_borrow<'a>(
12966            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12967        ) -> Self::Borrowed<'a> {
12968            value
12969        }
12970    }
12971
12972    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListener2Request {
12973        type Owned = Self;
12974
12975        #[inline(always)]
12976        fn inline_align(_context: fidl::encoding::Context) -> usize {
12977            8
12978        }
12979
12980        #[inline(always)]
12981        fn inline_size(_context: fidl::encoding::Context) -> usize {
12982            16
12983        }
12984    }
12985
12986    unsafe impl
12987        fidl::encoding::Encode<
12988            FrameSetNavigationEventListener2Request,
12989            fidl::encoding::DefaultFuchsiaResourceDialect,
12990        > for &mut FrameSetNavigationEventListener2Request
12991    {
12992        #[inline]
12993        unsafe fn encode(
12994            self,
12995            encoder: &mut fidl::encoding::Encoder<
12996                '_,
12997                fidl::encoding::DefaultFuchsiaResourceDialect,
12998            >,
12999            offset: usize,
13000            _depth: fidl::encoding::Depth,
13001        ) -> fidl::Result<()> {
13002            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
13003            // Delegate to tuple encoding.
13004            fidl::encoding::Encode::<
13005                FrameSetNavigationEventListener2Request,
13006                fidl::encoding::DefaultFuchsiaResourceDialect,
13007            >::encode(
13008                (
13009                    <fidl::encoding::Optional<
13010                        fidl::encoding::Endpoint<
13011                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13012                        >,
13013                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13014                        &mut self.listener
13015                    ),
13016                    <NavigationEventListenerFlags as fidl::encoding::ValueTypeMarker>::borrow(
13017                        &self.flags,
13018                    ),
13019                ),
13020                encoder,
13021                offset,
13022                _depth,
13023            )
13024        }
13025    }
13026    unsafe impl<
13027        T0: fidl::encoding::Encode<
13028                fidl::encoding::Optional<
13029                    fidl::encoding::Endpoint<
13030                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13031                    >,
13032                >,
13033                fidl::encoding::DefaultFuchsiaResourceDialect,
13034            >,
13035        T1: fidl::encoding::Encode<
13036                NavigationEventListenerFlags,
13037                fidl::encoding::DefaultFuchsiaResourceDialect,
13038            >,
13039    >
13040        fidl::encoding::Encode<
13041            FrameSetNavigationEventListener2Request,
13042            fidl::encoding::DefaultFuchsiaResourceDialect,
13043        > for (T0, T1)
13044    {
13045        #[inline]
13046        unsafe fn encode(
13047            self,
13048            encoder: &mut fidl::encoding::Encoder<
13049                '_,
13050                fidl::encoding::DefaultFuchsiaResourceDialect,
13051            >,
13052            offset: usize,
13053            depth: fidl::encoding::Depth,
13054        ) -> fidl::Result<()> {
13055            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
13056            // Zero out padding regions. There's no need to apply masks
13057            // because the unmasked parts will be overwritten by fields.
13058            unsafe {
13059                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
13060                (ptr as *mut u64).write_unaligned(0);
13061            }
13062            // Write the fields.
13063            self.0.encode(encoder, offset + 0, depth)?;
13064            self.1.encode(encoder, offset + 8, depth)?;
13065            Ok(())
13066        }
13067    }
13068
13069    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13070        for FrameSetNavigationEventListener2Request
13071    {
13072        #[inline(always)]
13073        fn new_empty() -> Self {
13074            Self {
13075                listener: fidl::new_empty!(
13076                    fidl::encoding::Optional<
13077                        fidl::encoding::Endpoint<
13078                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13079                        >,
13080                    >,
13081                    fidl::encoding::DefaultFuchsiaResourceDialect
13082                ),
13083                flags: fidl::new_empty!(
13084                    NavigationEventListenerFlags,
13085                    fidl::encoding::DefaultFuchsiaResourceDialect
13086                ),
13087            }
13088        }
13089
13090        #[inline]
13091        unsafe fn decode(
13092            &mut self,
13093            decoder: &mut fidl::encoding::Decoder<
13094                '_,
13095                fidl::encoding::DefaultFuchsiaResourceDialect,
13096            >,
13097            offset: usize,
13098            _depth: fidl::encoding::Depth,
13099        ) -> fidl::Result<()> {
13100            decoder.debug_check_bounds::<Self>(offset);
13101            // Verify that padding bytes are zero.
13102            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
13103            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13104            let mask = 0xffffffff00000000u64;
13105            let maskedval = padval & mask;
13106            if maskedval != 0 {
13107                return Err(fidl::Error::NonZeroPadding {
13108                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
13109                });
13110            }
13111            fidl::decode!(
13112                fidl::encoding::Optional<
13113                    fidl::encoding::Endpoint<
13114                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13115                    >,
13116                >,
13117                fidl::encoding::DefaultFuchsiaResourceDialect,
13118                &mut self.listener,
13119                decoder,
13120                offset + 0,
13121                _depth
13122            )?;
13123            fidl::decode!(
13124                NavigationEventListenerFlags,
13125                fidl::encoding::DefaultFuchsiaResourceDialect,
13126                &mut self.flags,
13127                decoder,
13128                offset + 8,
13129                _depth
13130            )?;
13131            Ok(())
13132        }
13133    }
13134
13135    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListenerRequest {
13136        type Borrowed<'a> = &'a mut Self;
13137        fn take_or_borrow<'a>(
13138            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13139        ) -> Self::Borrowed<'a> {
13140            value
13141        }
13142    }
13143
13144    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListenerRequest {
13145        type Owned = Self;
13146
13147        #[inline(always)]
13148        fn inline_align(_context: fidl::encoding::Context) -> usize {
13149            4
13150        }
13151
13152        #[inline(always)]
13153        fn inline_size(_context: fidl::encoding::Context) -> usize {
13154            4
13155        }
13156    }
13157
13158    unsafe impl
13159        fidl::encoding::Encode<
13160            FrameSetNavigationEventListenerRequest,
13161            fidl::encoding::DefaultFuchsiaResourceDialect,
13162        > for &mut FrameSetNavigationEventListenerRequest
13163    {
13164        #[inline]
13165        unsafe fn encode(
13166            self,
13167            encoder: &mut fidl::encoding::Encoder<
13168                '_,
13169                fidl::encoding::DefaultFuchsiaResourceDialect,
13170            >,
13171            offset: usize,
13172            _depth: fidl::encoding::Depth,
13173        ) -> fidl::Result<()> {
13174            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13175            // Delegate to tuple encoding.
13176            fidl::encoding::Encode::<
13177                FrameSetNavigationEventListenerRequest,
13178                fidl::encoding::DefaultFuchsiaResourceDialect,
13179            >::encode(
13180                (<fidl::encoding::Optional<
13181                    fidl::encoding::Endpoint<
13182                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13183                    >,
13184                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13185                    &mut self.listener
13186                ),),
13187                encoder,
13188                offset,
13189                _depth,
13190            )
13191        }
13192    }
13193    unsafe impl<
13194        T0: fidl::encoding::Encode<
13195                fidl::encoding::Optional<
13196                    fidl::encoding::Endpoint<
13197                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13198                    >,
13199                >,
13200                fidl::encoding::DefaultFuchsiaResourceDialect,
13201            >,
13202    >
13203        fidl::encoding::Encode<
13204            FrameSetNavigationEventListenerRequest,
13205            fidl::encoding::DefaultFuchsiaResourceDialect,
13206        > for (T0,)
13207    {
13208        #[inline]
13209        unsafe fn encode(
13210            self,
13211            encoder: &mut fidl::encoding::Encoder<
13212                '_,
13213                fidl::encoding::DefaultFuchsiaResourceDialect,
13214            >,
13215            offset: usize,
13216            depth: fidl::encoding::Depth,
13217        ) -> fidl::Result<()> {
13218            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13219            // Zero out padding regions. There's no need to apply masks
13220            // because the unmasked parts will be overwritten by fields.
13221            // Write the fields.
13222            self.0.encode(encoder, offset + 0, depth)?;
13223            Ok(())
13224        }
13225    }
13226
13227    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13228        for FrameSetNavigationEventListenerRequest
13229    {
13230        #[inline(always)]
13231        fn new_empty() -> Self {
13232            Self {
13233                listener: fidl::new_empty!(
13234                    fidl::encoding::Optional<
13235                        fidl::encoding::Endpoint<
13236                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13237                        >,
13238                    >,
13239                    fidl::encoding::DefaultFuchsiaResourceDialect
13240                ),
13241            }
13242        }
13243
13244        #[inline]
13245        unsafe fn decode(
13246            &mut self,
13247            decoder: &mut fidl::encoding::Decoder<
13248                '_,
13249                fidl::encoding::DefaultFuchsiaResourceDialect,
13250            >,
13251            offset: usize,
13252            _depth: fidl::encoding::Depth,
13253        ) -> fidl::Result<()> {
13254            decoder.debug_check_bounds::<Self>(offset);
13255            // Verify that padding bytes are zero.
13256            fidl::decode!(
13257                fidl::encoding::Optional<
13258                    fidl::encoding::Endpoint<
13259                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13260                    >,
13261                >,
13262                fidl::encoding::DefaultFuchsiaResourceDialect,
13263                &mut self.listener,
13264                decoder,
13265                offset + 0,
13266                _depth
13267            )?;
13268            Ok(())
13269        }
13270    }
13271
13272    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationPolicyProviderRequest {
13273        type Borrowed<'a> = &'a mut Self;
13274        fn take_or_borrow<'a>(
13275            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13276        ) -> Self::Borrowed<'a> {
13277            value
13278        }
13279    }
13280
13281    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationPolicyProviderRequest {
13282        type Owned = Self;
13283
13284        #[inline(always)]
13285        fn inline_align(_context: fidl::encoding::Context) -> usize {
13286            8
13287        }
13288
13289        #[inline(always)]
13290        fn inline_size(_context: fidl::encoding::Context) -> usize {
13291            24
13292        }
13293    }
13294
13295    unsafe impl
13296        fidl::encoding::Encode<
13297            FrameSetNavigationPolicyProviderRequest,
13298            fidl::encoding::DefaultFuchsiaResourceDialect,
13299        > for &mut FrameSetNavigationPolicyProviderRequest
13300    {
13301        #[inline]
13302        unsafe fn encode(
13303            self,
13304            encoder: &mut fidl::encoding::Encoder<
13305                '_,
13306                fidl::encoding::DefaultFuchsiaResourceDialect,
13307            >,
13308            offset: usize,
13309            _depth: fidl::encoding::Depth,
13310        ) -> fidl::Result<()> {
13311            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13312            // Delegate to tuple encoding.
13313            fidl::encoding::Encode::<
13314                FrameSetNavigationPolicyProviderRequest,
13315                fidl::encoding::DefaultFuchsiaResourceDialect,
13316            >::encode(
13317                (
13318                    <NavigationPolicyProviderParams as fidl::encoding::ValueTypeMarker>::borrow(
13319                        &self.params,
13320                    ),
13321                    <fidl::encoding::Endpoint<
13322                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13323                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13324                        &mut self.provider
13325                    ),
13326                ),
13327                encoder,
13328                offset,
13329                _depth,
13330            )
13331        }
13332    }
13333    unsafe impl<
13334        T0: fidl::encoding::Encode<
13335                NavigationPolicyProviderParams,
13336                fidl::encoding::DefaultFuchsiaResourceDialect,
13337            >,
13338        T1: fidl::encoding::Encode<
13339                fidl::encoding::Endpoint<
13340                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13341                >,
13342                fidl::encoding::DefaultFuchsiaResourceDialect,
13343            >,
13344    >
13345        fidl::encoding::Encode<
13346            FrameSetNavigationPolicyProviderRequest,
13347            fidl::encoding::DefaultFuchsiaResourceDialect,
13348        > for (T0, T1)
13349    {
13350        #[inline]
13351        unsafe fn encode(
13352            self,
13353            encoder: &mut fidl::encoding::Encoder<
13354                '_,
13355                fidl::encoding::DefaultFuchsiaResourceDialect,
13356            >,
13357            offset: usize,
13358            depth: fidl::encoding::Depth,
13359        ) -> fidl::Result<()> {
13360            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13361            // Zero out padding regions. There's no need to apply masks
13362            // because the unmasked parts will be overwritten by fields.
13363            unsafe {
13364                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
13365                (ptr as *mut u64).write_unaligned(0);
13366            }
13367            // Write the fields.
13368            self.0.encode(encoder, offset + 0, depth)?;
13369            self.1.encode(encoder, offset + 16, depth)?;
13370            Ok(())
13371        }
13372    }
13373
13374    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13375        for FrameSetNavigationPolicyProviderRequest
13376    {
13377        #[inline(always)]
13378        fn new_empty() -> Self {
13379            Self {
13380                params: fidl::new_empty!(
13381                    NavigationPolicyProviderParams,
13382                    fidl::encoding::DefaultFuchsiaResourceDialect
13383                ),
13384                provider: fidl::new_empty!(
13385                    fidl::encoding::Endpoint<
13386                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13387                    >,
13388                    fidl::encoding::DefaultFuchsiaResourceDialect
13389                ),
13390            }
13391        }
13392
13393        #[inline]
13394        unsafe fn decode(
13395            &mut self,
13396            decoder: &mut fidl::encoding::Decoder<
13397                '_,
13398                fidl::encoding::DefaultFuchsiaResourceDialect,
13399            >,
13400            offset: usize,
13401            _depth: fidl::encoding::Depth,
13402        ) -> fidl::Result<()> {
13403            decoder.debug_check_bounds::<Self>(offset);
13404            // Verify that padding bytes are zero.
13405            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
13406            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13407            let mask = 0xffffffff00000000u64;
13408            let maskedval = padval & mask;
13409            if maskedval != 0 {
13410                return Err(fidl::Error::NonZeroPadding {
13411                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
13412                });
13413            }
13414            fidl::decode!(
13415                NavigationPolicyProviderParams,
13416                fidl::encoding::DefaultFuchsiaResourceDialect,
13417                &mut self.params,
13418                decoder,
13419                offset + 0,
13420                _depth
13421            )?;
13422            fidl::decode!(
13423                fidl::encoding::Endpoint<
13424                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13425                >,
13426                fidl::encoding::DefaultFuchsiaResourceDialect,
13427                &mut self.provider,
13428                decoder,
13429                offset + 16,
13430                _depth
13431            )?;
13432            Ok(())
13433        }
13434    }
13435
13436    impl fidl::encoding::ResourceTypeMarker for FrameSetPopupFrameCreationListenerRequest {
13437        type Borrowed<'a> = &'a mut Self;
13438        fn take_or_borrow<'a>(
13439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13440        ) -> Self::Borrowed<'a> {
13441            value
13442        }
13443    }
13444
13445    unsafe impl fidl::encoding::TypeMarker for FrameSetPopupFrameCreationListenerRequest {
13446        type Owned = Self;
13447
13448        #[inline(always)]
13449        fn inline_align(_context: fidl::encoding::Context) -> usize {
13450            4
13451        }
13452
13453        #[inline(always)]
13454        fn inline_size(_context: fidl::encoding::Context) -> usize {
13455            4
13456        }
13457    }
13458
13459    unsafe impl
13460        fidl::encoding::Encode<
13461            FrameSetPopupFrameCreationListenerRequest,
13462            fidl::encoding::DefaultFuchsiaResourceDialect,
13463        > for &mut FrameSetPopupFrameCreationListenerRequest
13464    {
13465        #[inline]
13466        unsafe fn encode(
13467            self,
13468            encoder: &mut fidl::encoding::Encoder<
13469                '_,
13470                fidl::encoding::DefaultFuchsiaResourceDialect,
13471            >,
13472            offset: usize,
13473            _depth: fidl::encoding::Depth,
13474        ) -> fidl::Result<()> {
13475            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13476            // Delegate to tuple encoding.
13477            fidl::encoding::Encode::<
13478                FrameSetPopupFrameCreationListenerRequest,
13479                fidl::encoding::DefaultFuchsiaResourceDialect,
13480            >::encode(
13481                (<fidl::encoding::Optional<
13482                    fidl::encoding::Endpoint<
13483                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13484                    >,
13485                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13486                    &mut self.listener
13487                ),),
13488                encoder,
13489                offset,
13490                _depth,
13491            )
13492        }
13493    }
13494    unsafe impl<
13495        T0: fidl::encoding::Encode<
13496                fidl::encoding::Optional<
13497                    fidl::encoding::Endpoint<
13498                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13499                    >,
13500                >,
13501                fidl::encoding::DefaultFuchsiaResourceDialect,
13502            >,
13503    >
13504        fidl::encoding::Encode<
13505            FrameSetPopupFrameCreationListenerRequest,
13506            fidl::encoding::DefaultFuchsiaResourceDialect,
13507        > for (T0,)
13508    {
13509        #[inline]
13510        unsafe fn encode(
13511            self,
13512            encoder: &mut fidl::encoding::Encoder<
13513                '_,
13514                fidl::encoding::DefaultFuchsiaResourceDialect,
13515            >,
13516            offset: usize,
13517            depth: fidl::encoding::Depth,
13518        ) -> fidl::Result<()> {
13519            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13520            // Zero out padding regions. There's no need to apply masks
13521            // because the unmasked parts will be overwritten by fields.
13522            // Write the fields.
13523            self.0.encode(encoder, offset + 0, depth)?;
13524            Ok(())
13525        }
13526    }
13527
13528    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13529        for FrameSetPopupFrameCreationListenerRequest
13530    {
13531        #[inline(always)]
13532        fn new_empty() -> Self {
13533            Self {
13534                listener: fidl::new_empty!(
13535                    fidl::encoding::Optional<
13536                        fidl::encoding::Endpoint<
13537                            fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13538                        >,
13539                    >,
13540                    fidl::encoding::DefaultFuchsiaResourceDialect
13541                ),
13542            }
13543        }
13544
13545        #[inline]
13546        unsafe fn decode(
13547            &mut self,
13548            decoder: &mut fidl::encoding::Decoder<
13549                '_,
13550                fidl::encoding::DefaultFuchsiaResourceDialect,
13551            >,
13552            offset: usize,
13553            _depth: fidl::encoding::Depth,
13554        ) -> fidl::Result<()> {
13555            decoder.debug_check_bounds::<Self>(offset);
13556            // Verify that padding bytes are zero.
13557            fidl::decode!(
13558                fidl::encoding::Optional<
13559                    fidl::encoding::Endpoint<
13560                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13561                    >,
13562                >,
13563                fidl::encoding::DefaultFuchsiaResourceDialect,
13564                &mut self.listener,
13565                decoder,
13566                offset + 0,
13567                _depth
13568            )?;
13569            Ok(())
13570        }
13571    }
13572
13573    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptResponse {
13574        type Borrowed<'a> = &'a mut Self;
13575        fn take_or_borrow<'a>(
13576            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13577        ) -> Self::Borrowed<'a> {
13578            value
13579        }
13580    }
13581
13582    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptResponse {
13583        type Owned = Self;
13584
13585        #[inline(always)]
13586        fn inline_align(_context: fidl::encoding::Context) -> usize {
13587            8
13588        }
13589
13590        #[inline(always)]
13591        fn inline_size(_context: fidl::encoding::Context) -> usize {
13592            16
13593        }
13594    }
13595
13596    unsafe impl
13597        fidl::encoding::Encode<
13598            FrameExecuteJavaScriptResponse,
13599            fidl::encoding::DefaultFuchsiaResourceDialect,
13600        > for &mut FrameExecuteJavaScriptResponse
13601    {
13602        #[inline]
13603        unsafe fn encode(
13604            self,
13605            encoder: &mut fidl::encoding::Encoder<
13606                '_,
13607                fidl::encoding::DefaultFuchsiaResourceDialect,
13608            >,
13609            offset: usize,
13610            _depth: fidl::encoding::Depth,
13611        ) -> fidl::Result<()> {
13612            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13613            // Delegate to tuple encoding.
13614            fidl::encoding::Encode::<
13615                FrameExecuteJavaScriptResponse,
13616                fidl::encoding::DefaultFuchsiaResourceDialect,
13617            >::encode(
13618                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13619                    &mut self.result,
13620                ),),
13621                encoder,
13622                offset,
13623                _depth,
13624            )
13625        }
13626    }
13627    unsafe impl<
13628        T0: fidl::encoding::Encode<
13629                fidl_fuchsia_mem::Buffer,
13630                fidl::encoding::DefaultFuchsiaResourceDialect,
13631            >,
13632    >
13633        fidl::encoding::Encode<
13634            FrameExecuteJavaScriptResponse,
13635            fidl::encoding::DefaultFuchsiaResourceDialect,
13636        > for (T0,)
13637    {
13638        #[inline]
13639        unsafe fn encode(
13640            self,
13641            encoder: &mut fidl::encoding::Encoder<
13642                '_,
13643                fidl::encoding::DefaultFuchsiaResourceDialect,
13644            >,
13645            offset: usize,
13646            depth: fidl::encoding::Depth,
13647        ) -> fidl::Result<()> {
13648            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13649            // Zero out padding regions. There's no need to apply masks
13650            // because the unmasked parts will be overwritten by fields.
13651            // Write the fields.
13652            self.0.encode(encoder, offset + 0, depth)?;
13653            Ok(())
13654        }
13655    }
13656
13657    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13658        for FrameExecuteJavaScriptResponse
13659    {
13660        #[inline(always)]
13661        fn new_empty() -> Self {
13662            Self {
13663                result: fidl::new_empty!(
13664                    fidl_fuchsia_mem::Buffer,
13665                    fidl::encoding::DefaultFuchsiaResourceDialect
13666                ),
13667            }
13668        }
13669
13670        #[inline]
13671        unsafe fn decode(
13672            &mut self,
13673            decoder: &mut fidl::encoding::Decoder<
13674                '_,
13675                fidl::encoding::DefaultFuchsiaResourceDialect,
13676            >,
13677            offset: usize,
13678            _depth: fidl::encoding::Depth,
13679        ) -> fidl::Result<()> {
13680            decoder.debug_check_bounds::<Self>(offset);
13681            // Verify that padding bytes are zero.
13682            fidl::decode!(
13683                fidl_fuchsia_mem::Buffer,
13684                fidl::encoding::DefaultFuchsiaResourceDialect,
13685                &mut self.result,
13686                decoder,
13687                offset + 0,
13688                _depth
13689            )?;
13690            Ok(())
13691        }
13692    }
13693
13694    impl fidl::encoding::ResourceTypeMarker for MessagePortPostMessageRequest {
13695        type Borrowed<'a> = &'a mut Self;
13696        fn take_or_borrow<'a>(
13697            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13698        ) -> Self::Borrowed<'a> {
13699            value
13700        }
13701    }
13702
13703    unsafe impl fidl::encoding::TypeMarker for MessagePortPostMessageRequest {
13704        type Owned = Self;
13705
13706        #[inline(always)]
13707        fn inline_align(_context: fidl::encoding::Context) -> usize {
13708            8
13709        }
13710
13711        #[inline(always)]
13712        fn inline_size(_context: fidl::encoding::Context) -> usize {
13713            16
13714        }
13715    }
13716
13717    unsafe impl
13718        fidl::encoding::Encode<
13719            MessagePortPostMessageRequest,
13720            fidl::encoding::DefaultFuchsiaResourceDialect,
13721        > for &mut MessagePortPostMessageRequest
13722    {
13723        #[inline]
13724        unsafe fn encode(
13725            self,
13726            encoder: &mut fidl::encoding::Encoder<
13727                '_,
13728                fidl::encoding::DefaultFuchsiaResourceDialect,
13729            >,
13730            offset: usize,
13731            _depth: fidl::encoding::Depth,
13732        ) -> fidl::Result<()> {
13733            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13734            // Delegate to tuple encoding.
13735            fidl::encoding::Encode::<
13736                MessagePortPostMessageRequest,
13737                fidl::encoding::DefaultFuchsiaResourceDialect,
13738            >::encode(
13739                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13740                    &mut self.message,
13741                ),),
13742                encoder,
13743                offset,
13744                _depth,
13745            )
13746        }
13747    }
13748    unsafe impl<
13749        T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
13750    >
13751        fidl::encoding::Encode<
13752            MessagePortPostMessageRequest,
13753            fidl::encoding::DefaultFuchsiaResourceDialect,
13754        > for (T0,)
13755    {
13756        #[inline]
13757        unsafe fn encode(
13758            self,
13759            encoder: &mut fidl::encoding::Encoder<
13760                '_,
13761                fidl::encoding::DefaultFuchsiaResourceDialect,
13762            >,
13763            offset: usize,
13764            depth: fidl::encoding::Depth,
13765        ) -> fidl::Result<()> {
13766            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13767            // Zero out padding regions. There's no need to apply masks
13768            // because the unmasked parts will be overwritten by fields.
13769            // Write the fields.
13770            self.0.encode(encoder, offset + 0, depth)?;
13771            Ok(())
13772        }
13773    }
13774
13775    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13776        for MessagePortPostMessageRequest
13777    {
13778        #[inline(always)]
13779        fn new_empty() -> Self {
13780            Self {
13781                message: fidl::new_empty!(
13782                    WebMessage,
13783                    fidl::encoding::DefaultFuchsiaResourceDialect
13784                ),
13785            }
13786        }
13787
13788        #[inline]
13789        unsafe fn decode(
13790            &mut self,
13791            decoder: &mut fidl::encoding::Decoder<
13792                '_,
13793                fidl::encoding::DefaultFuchsiaResourceDialect,
13794            >,
13795            offset: usize,
13796            _depth: fidl::encoding::Depth,
13797        ) -> fidl::Result<()> {
13798            decoder.debug_check_bounds::<Self>(offset);
13799            // Verify that padding bytes are zero.
13800            fidl::decode!(
13801                WebMessage,
13802                fidl::encoding::DefaultFuchsiaResourceDialect,
13803                &mut self.message,
13804                decoder,
13805                offset + 0,
13806                _depth
13807            )?;
13808            Ok(())
13809        }
13810    }
13811
13812    impl fidl::encoding::ResourceTypeMarker for MessagePortReceiveMessageResponse {
13813        type Borrowed<'a> = &'a mut Self;
13814        fn take_or_borrow<'a>(
13815            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13816        ) -> Self::Borrowed<'a> {
13817            value
13818        }
13819    }
13820
13821    unsafe impl fidl::encoding::TypeMarker for MessagePortReceiveMessageResponse {
13822        type Owned = Self;
13823
13824        #[inline(always)]
13825        fn inline_align(_context: fidl::encoding::Context) -> usize {
13826            8
13827        }
13828
13829        #[inline(always)]
13830        fn inline_size(_context: fidl::encoding::Context) -> usize {
13831            16
13832        }
13833    }
13834
13835    unsafe impl
13836        fidl::encoding::Encode<
13837            MessagePortReceiveMessageResponse,
13838            fidl::encoding::DefaultFuchsiaResourceDialect,
13839        > for &mut MessagePortReceiveMessageResponse
13840    {
13841        #[inline]
13842        unsafe fn encode(
13843            self,
13844            encoder: &mut fidl::encoding::Encoder<
13845                '_,
13846                fidl::encoding::DefaultFuchsiaResourceDialect,
13847            >,
13848            offset: usize,
13849            _depth: fidl::encoding::Depth,
13850        ) -> fidl::Result<()> {
13851            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13852            // Delegate to tuple encoding.
13853            fidl::encoding::Encode::<
13854                MessagePortReceiveMessageResponse,
13855                fidl::encoding::DefaultFuchsiaResourceDialect,
13856            >::encode(
13857                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13858                    &mut self.message,
13859                ),),
13860                encoder,
13861                offset,
13862                _depth,
13863            )
13864        }
13865    }
13866    unsafe impl<
13867        T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
13868    >
13869        fidl::encoding::Encode<
13870            MessagePortReceiveMessageResponse,
13871            fidl::encoding::DefaultFuchsiaResourceDialect,
13872        > for (T0,)
13873    {
13874        #[inline]
13875        unsafe fn encode(
13876            self,
13877            encoder: &mut fidl::encoding::Encoder<
13878                '_,
13879                fidl::encoding::DefaultFuchsiaResourceDialect,
13880            >,
13881            offset: usize,
13882            depth: fidl::encoding::Depth,
13883        ) -> fidl::Result<()> {
13884            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13885            // Zero out padding regions. There's no need to apply masks
13886            // because the unmasked parts will be overwritten by fields.
13887            // Write the fields.
13888            self.0.encode(encoder, offset + 0, depth)?;
13889            Ok(())
13890        }
13891    }
13892
13893    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13894        for MessagePortReceiveMessageResponse
13895    {
13896        #[inline(always)]
13897        fn new_empty() -> Self {
13898            Self {
13899                message: fidl::new_empty!(
13900                    WebMessage,
13901                    fidl::encoding::DefaultFuchsiaResourceDialect
13902                ),
13903            }
13904        }
13905
13906        #[inline]
13907        unsafe fn decode(
13908            &mut self,
13909            decoder: &mut fidl::encoding::Decoder<
13910                '_,
13911                fidl::encoding::DefaultFuchsiaResourceDialect,
13912            >,
13913            offset: usize,
13914            _depth: fidl::encoding::Depth,
13915        ) -> fidl::Result<()> {
13916            decoder.debug_check_bounds::<Self>(offset);
13917            // Verify that padding bytes are zero.
13918            fidl::decode!(
13919                WebMessage,
13920                fidl::encoding::DefaultFuchsiaResourceDialect,
13921                &mut self.message,
13922                decoder,
13923                offset + 0,
13924                _depth
13925            )?;
13926            Ok(())
13927        }
13928    }
13929
13930    impl fidl::encoding::ResourceTypeMarker for NavigationControllerLoadUrlRequest {
13931        type Borrowed<'a> = &'a mut Self;
13932        fn take_or_borrow<'a>(
13933            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13934        ) -> Self::Borrowed<'a> {
13935            value
13936        }
13937    }
13938
13939    unsafe impl fidl::encoding::TypeMarker for NavigationControllerLoadUrlRequest {
13940        type Owned = Self;
13941
13942        #[inline(always)]
13943        fn inline_align(_context: fidl::encoding::Context) -> usize {
13944            8
13945        }
13946
13947        #[inline(always)]
13948        fn inline_size(_context: fidl::encoding::Context) -> usize {
13949            32
13950        }
13951    }
13952
13953    unsafe impl
13954        fidl::encoding::Encode<
13955            NavigationControllerLoadUrlRequest,
13956            fidl::encoding::DefaultFuchsiaResourceDialect,
13957        > for &mut NavigationControllerLoadUrlRequest
13958    {
13959        #[inline]
13960        unsafe fn encode(
13961            self,
13962            encoder: &mut fidl::encoding::Encoder<
13963                '_,
13964                fidl::encoding::DefaultFuchsiaResourceDialect,
13965            >,
13966            offset: usize,
13967            _depth: fidl::encoding::Depth,
13968        ) -> fidl::Result<()> {
13969            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13970            // Delegate to tuple encoding.
13971            fidl::encoding::Encode::<NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13972                (
13973                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
13974                    <LoadUrlParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
13975                ),
13976                encoder, offset, _depth
13977            )
13978        }
13979    }
13980    unsafe impl<
13981        T0: fidl::encoding::Encode<
13982                fidl::encoding::BoundedString<65536>,
13983                fidl::encoding::DefaultFuchsiaResourceDialect,
13984            >,
13985        T1: fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
13986    >
13987        fidl::encoding::Encode<
13988            NavigationControllerLoadUrlRequest,
13989            fidl::encoding::DefaultFuchsiaResourceDialect,
13990        > for (T0, T1)
13991    {
13992        #[inline]
13993        unsafe fn encode(
13994            self,
13995            encoder: &mut fidl::encoding::Encoder<
13996                '_,
13997                fidl::encoding::DefaultFuchsiaResourceDialect,
13998            >,
13999            offset: usize,
14000            depth: fidl::encoding::Depth,
14001        ) -> fidl::Result<()> {
14002            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
14003            // Zero out padding regions. There's no need to apply masks
14004            // because the unmasked parts will be overwritten by fields.
14005            // Write the fields.
14006            self.0.encode(encoder, offset + 0, depth)?;
14007            self.1.encode(encoder, offset + 16, depth)?;
14008            Ok(())
14009        }
14010    }
14011
14012    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14013        for NavigationControllerLoadUrlRequest
14014    {
14015        #[inline(always)]
14016        fn new_empty() -> Self {
14017            Self {
14018                url: fidl::new_empty!(
14019                    fidl::encoding::BoundedString<65536>,
14020                    fidl::encoding::DefaultFuchsiaResourceDialect
14021                ),
14022                params: fidl::new_empty!(
14023                    LoadUrlParams,
14024                    fidl::encoding::DefaultFuchsiaResourceDialect
14025                ),
14026            }
14027        }
14028
14029        #[inline]
14030        unsafe fn decode(
14031            &mut self,
14032            decoder: &mut fidl::encoding::Decoder<
14033                '_,
14034                fidl::encoding::DefaultFuchsiaResourceDialect,
14035            >,
14036            offset: usize,
14037            _depth: fidl::encoding::Depth,
14038        ) -> fidl::Result<()> {
14039            decoder.debug_check_bounds::<Self>(offset);
14040            // Verify that padding bytes are zero.
14041            fidl::decode!(
14042                fidl::encoding::BoundedString<65536>,
14043                fidl::encoding::DefaultFuchsiaResourceDialect,
14044                &mut self.url,
14045                decoder,
14046                offset + 0,
14047                _depth
14048            )?;
14049            fidl::decode!(
14050                LoadUrlParams,
14051                fidl::encoding::DefaultFuchsiaResourceDialect,
14052                &mut self.params,
14053                decoder,
14054                offset + 16,
14055                _depth
14056            )?;
14057            Ok(())
14058        }
14059    }
14060
14061    impl fidl::encoding::ResourceTypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
14062        type Borrowed<'a> = &'a mut Self;
14063        fn take_or_borrow<'a>(
14064            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14065        ) -> Self::Borrowed<'a> {
14066            value
14067        }
14068    }
14069
14070    unsafe impl fidl::encoding::TypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
14071        type Owned = Self;
14072
14073        #[inline(always)]
14074        fn inline_align(_context: fidl::encoding::Context) -> usize {
14075            8
14076        }
14077
14078        #[inline(always)]
14079        fn inline_size(_context: fidl::encoding::Context) -> usize {
14080            16
14081        }
14082    }
14083
14084    unsafe impl
14085        fidl::encoding::Encode<
14086            NavigationEventListenerOnNavigationStateChangedRequest,
14087            fidl::encoding::DefaultFuchsiaResourceDialect,
14088        > for &mut NavigationEventListenerOnNavigationStateChangedRequest
14089    {
14090        #[inline]
14091        unsafe fn encode(
14092            self,
14093            encoder: &mut fidl::encoding::Encoder<
14094                '_,
14095                fidl::encoding::DefaultFuchsiaResourceDialect,
14096            >,
14097            offset: usize,
14098            _depth: fidl::encoding::Depth,
14099        ) -> fidl::Result<()> {
14100            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
14101                offset,
14102            );
14103            // Delegate to tuple encoding.
14104            fidl::encoding::Encode::<
14105                NavigationEventListenerOnNavigationStateChangedRequest,
14106                fidl::encoding::DefaultFuchsiaResourceDialect,
14107            >::encode(
14108                (<NavigationState as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14109                    &mut self.change,
14110                ),),
14111                encoder,
14112                offset,
14113                _depth,
14114            )
14115        }
14116    }
14117    unsafe impl<
14118        T0: fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>,
14119    >
14120        fidl::encoding::Encode<
14121            NavigationEventListenerOnNavigationStateChangedRequest,
14122            fidl::encoding::DefaultFuchsiaResourceDialect,
14123        > for (T0,)
14124    {
14125        #[inline]
14126        unsafe fn encode(
14127            self,
14128            encoder: &mut fidl::encoding::Encoder<
14129                '_,
14130                fidl::encoding::DefaultFuchsiaResourceDialect,
14131            >,
14132            offset: usize,
14133            depth: fidl::encoding::Depth,
14134        ) -> fidl::Result<()> {
14135            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
14136                offset,
14137            );
14138            // Zero out padding regions. There's no need to apply masks
14139            // because the unmasked parts will be overwritten by fields.
14140            // Write the fields.
14141            self.0.encode(encoder, offset + 0, depth)?;
14142            Ok(())
14143        }
14144    }
14145
14146    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14147        for NavigationEventListenerOnNavigationStateChangedRequest
14148    {
14149        #[inline(always)]
14150        fn new_empty() -> Self {
14151            Self {
14152                change: fidl::new_empty!(
14153                    NavigationState,
14154                    fidl::encoding::DefaultFuchsiaResourceDialect
14155                ),
14156            }
14157        }
14158
14159        #[inline]
14160        unsafe fn decode(
14161            &mut self,
14162            decoder: &mut fidl::encoding::Decoder<
14163                '_,
14164                fidl::encoding::DefaultFuchsiaResourceDialect,
14165            >,
14166            offset: usize,
14167            _depth: fidl::encoding::Depth,
14168        ) -> fidl::Result<()> {
14169            decoder.debug_check_bounds::<Self>(offset);
14170            // Verify that padding bytes are zero.
14171            fidl::decode!(
14172                NavigationState,
14173                fidl::encoding::DefaultFuchsiaResourceDialect,
14174                &mut self.change,
14175                decoder,
14176                offset + 0,
14177                _depth
14178            )?;
14179            Ok(())
14180        }
14181    }
14182
14183    impl fidl::encoding::ResourceTypeMarker
14184        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14185    {
14186        type Borrowed<'a> = &'a mut Self;
14187        fn take_or_borrow<'a>(
14188            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14189        ) -> Self::Borrowed<'a> {
14190            value
14191        }
14192    }
14193
14194    unsafe impl fidl::encoding::TypeMarker
14195        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14196    {
14197        type Owned = Self;
14198
14199        #[inline(always)]
14200        fn inline_align(_context: fidl::encoding::Context) -> usize {
14201            8
14202        }
14203
14204        #[inline(always)]
14205        fn inline_size(_context: fidl::encoding::Context) -> usize {
14206            16
14207        }
14208    }
14209
14210    unsafe impl
14211        fidl::encoding::Encode<
14212            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14213            fidl::encoding::DefaultFuchsiaResourceDialect,
14214        > for &mut NavigationPolicyProviderEvaluateRequestedNavigationResponse
14215    {
14216        #[inline]
14217        unsafe fn encode(
14218            self,
14219            encoder: &mut fidl::encoding::Encoder<
14220                '_,
14221                fidl::encoding::DefaultFuchsiaResourceDialect,
14222            >,
14223            offset: usize,
14224            _depth: fidl::encoding::Depth,
14225        ) -> fidl::Result<()> {
14226            encoder
14227                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14228                    offset,
14229                );
14230            // Delegate to tuple encoding.
14231            fidl::encoding::Encode::<
14232                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14233                fidl::encoding::DefaultFuchsiaResourceDialect,
14234            >::encode(
14235                (<NavigationDecision as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14236                    &mut self.decision,
14237                ),),
14238                encoder,
14239                offset,
14240                _depth,
14241            )
14242        }
14243    }
14244    unsafe impl<
14245        T0: fidl::encoding::Encode<NavigationDecision, fidl::encoding::DefaultFuchsiaResourceDialect>,
14246    >
14247        fidl::encoding::Encode<
14248            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14249            fidl::encoding::DefaultFuchsiaResourceDialect,
14250        > for (T0,)
14251    {
14252        #[inline]
14253        unsafe fn encode(
14254            self,
14255            encoder: &mut fidl::encoding::Encoder<
14256                '_,
14257                fidl::encoding::DefaultFuchsiaResourceDialect,
14258            >,
14259            offset: usize,
14260            depth: fidl::encoding::Depth,
14261        ) -> fidl::Result<()> {
14262            encoder
14263                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14264                    offset,
14265                );
14266            // Zero out padding regions. There's no need to apply masks
14267            // because the unmasked parts will be overwritten by fields.
14268            // Write the fields.
14269            self.0.encode(encoder, offset + 0, depth)?;
14270            Ok(())
14271        }
14272    }
14273
14274    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14275        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14276    {
14277        #[inline(always)]
14278        fn new_empty() -> Self {
14279            Self {
14280                decision: fidl::new_empty!(
14281                    NavigationDecision,
14282                    fidl::encoding::DefaultFuchsiaResourceDialect
14283                ),
14284            }
14285        }
14286
14287        #[inline]
14288        unsafe fn decode(
14289            &mut self,
14290            decoder: &mut fidl::encoding::Decoder<
14291                '_,
14292                fidl::encoding::DefaultFuchsiaResourceDialect,
14293            >,
14294            offset: usize,
14295            _depth: fidl::encoding::Depth,
14296        ) -> fidl::Result<()> {
14297            decoder.debug_check_bounds::<Self>(offset);
14298            // Verify that padding bytes are zero.
14299            fidl::decode!(
14300                NavigationDecision,
14301                fidl::encoding::DefaultFuchsiaResourceDialect,
14302                &mut self.decision,
14303                decoder,
14304                offset + 0,
14305                _depth
14306            )?;
14307            Ok(())
14308        }
14309    }
14310
14311    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14312        type Borrowed<'a> = &'a mut Self;
14313        fn take_or_borrow<'a>(
14314            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14315        ) -> Self::Borrowed<'a> {
14316            value
14317        }
14318    }
14319
14320    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14321        type Owned = Self;
14322
14323        #[inline(always)]
14324        fn inline_align(_context: fidl::encoding::Context) -> usize {
14325            8
14326        }
14327
14328        #[inline(always)]
14329        fn inline_size(_context: fidl::encoding::Context) -> usize {
14330            24
14331        }
14332    }
14333
14334    unsafe impl
14335        fidl::encoding::Encode<
14336            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14337            fidl::encoding::DefaultFuchsiaResourceDialect,
14338        > for &mut PopupFrameCreationListenerOnPopupFrameCreatedRequest
14339    {
14340        #[inline]
14341        unsafe fn encode(
14342            self,
14343            encoder: &mut fidl::encoding::Encoder<
14344                '_,
14345                fidl::encoding::DefaultFuchsiaResourceDialect,
14346            >,
14347            offset: usize,
14348            _depth: fidl::encoding::Depth,
14349        ) -> fidl::Result<()> {
14350            encoder
14351                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14352            // Delegate to tuple encoding.
14353            fidl::encoding::Encode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14354                (
14355                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
14356                    <PopupFrameCreationInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.info),
14357                ),
14358                encoder, offset, _depth
14359            )
14360        }
14361    }
14362    unsafe impl<
14363        T0: fidl::encoding::Encode<
14364                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14365                fidl::encoding::DefaultFuchsiaResourceDialect,
14366            >,
14367        T1: fidl::encoding::Encode<
14368                PopupFrameCreationInfo,
14369                fidl::encoding::DefaultFuchsiaResourceDialect,
14370            >,
14371    >
14372        fidl::encoding::Encode<
14373            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14374            fidl::encoding::DefaultFuchsiaResourceDialect,
14375        > for (T0, T1)
14376    {
14377        #[inline]
14378        unsafe fn encode(
14379            self,
14380            encoder: &mut fidl::encoding::Encoder<
14381                '_,
14382                fidl::encoding::DefaultFuchsiaResourceDialect,
14383            >,
14384            offset: usize,
14385            depth: fidl::encoding::Depth,
14386        ) -> fidl::Result<()> {
14387            encoder
14388                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14389            // Zero out padding regions. There's no need to apply masks
14390            // because the unmasked parts will be overwritten by fields.
14391            unsafe {
14392                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
14393                (ptr as *mut u64).write_unaligned(0);
14394            }
14395            // Write the fields.
14396            self.0.encode(encoder, offset + 0, depth)?;
14397            self.1.encode(encoder, offset + 8, depth)?;
14398            Ok(())
14399        }
14400    }
14401
14402    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14403        for PopupFrameCreationListenerOnPopupFrameCreatedRequest
14404    {
14405        #[inline(always)]
14406        fn new_empty() -> Self {
14407            Self {
14408                frame: fidl::new_empty!(
14409                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14410                    fidl::encoding::DefaultFuchsiaResourceDialect
14411                ),
14412                info: fidl::new_empty!(
14413                    PopupFrameCreationInfo,
14414                    fidl::encoding::DefaultFuchsiaResourceDialect
14415                ),
14416            }
14417        }
14418
14419        #[inline]
14420        unsafe fn decode(
14421            &mut self,
14422            decoder: &mut fidl::encoding::Decoder<
14423                '_,
14424                fidl::encoding::DefaultFuchsiaResourceDialect,
14425            >,
14426            offset: usize,
14427            _depth: fidl::encoding::Depth,
14428        ) -> fidl::Result<()> {
14429            decoder.debug_check_bounds::<Self>(offset);
14430            // Verify that padding bytes are zero.
14431            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
14432            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14433            let mask = 0xffffffff00000000u64;
14434            let maskedval = padval & mask;
14435            if maskedval != 0 {
14436                return Err(fidl::Error::NonZeroPadding {
14437                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
14438                });
14439            }
14440            fidl::decode!(
14441                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14442                fidl::encoding::DefaultFuchsiaResourceDialect,
14443                &mut self.frame,
14444                decoder,
14445                offset + 0,
14446                _depth
14447            )?;
14448            fidl::decode!(
14449                PopupFrameCreationInfo,
14450                fidl::encoding::DefaultFuchsiaResourceDialect,
14451                &mut self.info,
14452                decoder,
14453                offset + 8,
14454                _depth
14455            )?;
14456            Ok(())
14457        }
14458    }
14459
14460    impl ContentDirectoryProvider {
14461        #[inline(always)]
14462        fn max_ordinal_present(&self) -> u64 {
14463            if let Some(_) = self.directory {
14464                return 2;
14465            }
14466            if let Some(_) = self.name {
14467                return 1;
14468            }
14469            0
14470        }
14471    }
14472
14473    impl fidl::encoding::ResourceTypeMarker for ContentDirectoryProvider {
14474        type Borrowed<'a> = &'a mut Self;
14475        fn take_or_borrow<'a>(
14476            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14477        ) -> Self::Borrowed<'a> {
14478            value
14479        }
14480    }
14481
14482    unsafe impl fidl::encoding::TypeMarker for ContentDirectoryProvider {
14483        type Owned = Self;
14484
14485        #[inline(always)]
14486        fn inline_align(_context: fidl::encoding::Context) -> usize {
14487            8
14488        }
14489
14490        #[inline(always)]
14491        fn inline_size(_context: fidl::encoding::Context) -> usize {
14492            16
14493        }
14494    }
14495
14496    unsafe impl
14497        fidl::encoding::Encode<
14498            ContentDirectoryProvider,
14499            fidl::encoding::DefaultFuchsiaResourceDialect,
14500        > for &mut ContentDirectoryProvider
14501    {
14502        unsafe fn encode(
14503            self,
14504            encoder: &mut fidl::encoding::Encoder<
14505                '_,
14506                fidl::encoding::DefaultFuchsiaResourceDialect,
14507            >,
14508            offset: usize,
14509            mut depth: fidl::encoding::Depth,
14510        ) -> fidl::Result<()> {
14511            encoder.debug_check_bounds::<ContentDirectoryProvider>(offset);
14512            // Vector header
14513            let max_ordinal: u64 = self.max_ordinal_present();
14514            encoder.write_num(max_ordinal, offset);
14515            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14516            // Calling encoder.out_of_line_offset(0) is not allowed.
14517            if max_ordinal == 0 {
14518                return Ok(());
14519            }
14520            depth.increment()?;
14521            let envelope_size = 8;
14522            let bytes_len = max_ordinal as usize * envelope_size;
14523            #[allow(unused_variables)]
14524            let offset = encoder.out_of_line_offset(bytes_len);
14525            let mut _prev_end_offset: usize = 0;
14526            if 1 > max_ordinal {
14527                return Ok(());
14528            }
14529
14530            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14531            // are envelope_size bytes.
14532            let cur_offset: usize = (1 - 1) * envelope_size;
14533
14534            // Zero reserved fields.
14535            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14536
14537            // Safety:
14538            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14539            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14540            //   envelope_size bytes, there is always sufficient room.
14541            fidl::encoding::encode_in_envelope_optional::<
14542                fidl::encoding::BoundedString<255>,
14543                fidl::encoding::DefaultFuchsiaResourceDialect,
14544            >(
14545                self.name.as_ref().map(
14546                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
14547                ),
14548                encoder,
14549                offset + cur_offset,
14550                depth,
14551            )?;
14552
14553            _prev_end_offset = cur_offset + envelope_size;
14554            if 2 > max_ordinal {
14555                return Ok(());
14556            }
14557
14558            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14559            // are envelope_size bytes.
14560            let cur_offset: usize = (2 - 1) * envelope_size;
14561
14562            // Zero reserved fields.
14563            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14564
14565            // Safety:
14566            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14567            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14568            //   envelope_size bytes, there is always sufficient room.
14569            fidl::encoding::encode_in_envelope_optional::<
14570                fidl::encoding::Endpoint<
14571                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14572                >,
14573                fidl::encoding::DefaultFuchsiaResourceDialect,
14574            >(
14575                self.directory.as_mut().map(
14576                    <fidl::encoding::Endpoint<
14577                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14578                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14579                ),
14580                encoder,
14581                offset + cur_offset,
14582                depth,
14583            )?;
14584
14585            _prev_end_offset = cur_offset + envelope_size;
14586
14587            Ok(())
14588        }
14589    }
14590
14591    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14592        for ContentDirectoryProvider
14593    {
14594        #[inline(always)]
14595        fn new_empty() -> Self {
14596            Self::default()
14597        }
14598
14599        unsafe fn decode(
14600            &mut self,
14601            decoder: &mut fidl::encoding::Decoder<
14602                '_,
14603                fidl::encoding::DefaultFuchsiaResourceDialect,
14604            >,
14605            offset: usize,
14606            mut depth: fidl::encoding::Depth,
14607        ) -> fidl::Result<()> {
14608            decoder.debug_check_bounds::<Self>(offset);
14609            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14610                None => return Err(fidl::Error::NotNullable),
14611                Some(len) => len,
14612            };
14613            // Calling decoder.out_of_line_offset(0) is not allowed.
14614            if len == 0 {
14615                return Ok(());
14616            };
14617            depth.increment()?;
14618            let envelope_size = 8;
14619            let bytes_len = len * envelope_size;
14620            let offset = decoder.out_of_line_offset(bytes_len)?;
14621            // Decode the envelope for each type.
14622            let mut _next_ordinal_to_read = 0;
14623            let mut next_offset = offset;
14624            let end_offset = offset + bytes_len;
14625            _next_ordinal_to_read += 1;
14626            if next_offset >= end_offset {
14627                return Ok(());
14628            }
14629
14630            // Decode unknown envelopes for gaps in ordinals.
14631            while _next_ordinal_to_read < 1 {
14632                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14633                _next_ordinal_to_read += 1;
14634                next_offset += envelope_size;
14635            }
14636
14637            let next_out_of_line = decoder.next_out_of_line();
14638            let handles_before = decoder.remaining_handles();
14639            if let Some((inlined, num_bytes, num_handles)) =
14640                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14641            {
14642                let member_inline_size =
14643                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
14644                        decoder.context,
14645                    );
14646                if inlined != (member_inline_size <= 4) {
14647                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14648                }
14649                let inner_offset;
14650                let mut inner_depth = depth.clone();
14651                if inlined {
14652                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14653                    inner_offset = next_offset;
14654                } else {
14655                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14656                    inner_depth.increment()?;
14657                }
14658                let val_ref = self.name.get_or_insert_with(|| {
14659                    fidl::new_empty!(
14660                        fidl::encoding::BoundedString<255>,
14661                        fidl::encoding::DefaultFuchsiaResourceDialect
14662                    )
14663                });
14664                fidl::decode!(
14665                    fidl::encoding::BoundedString<255>,
14666                    fidl::encoding::DefaultFuchsiaResourceDialect,
14667                    val_ref,
14668                    decoder,
14669                    inner_offset,
14670                    inner_depth
14671                )?;
14672                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14673                {
14674                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14675                }
14676                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14677                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14678                }
14679            }
14680
14681            next_offset += envelope_size;
14682            _next_ordinal_to_read += 1;
14683            if next_offset >= end_offset {
14684                return Ok(());
14685            }
14686
14687            // Decode unknown envelopes for gaps in ordinals.
14688            while _next_ordinal_to_read < 2 {
14689                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14690                _next_ordinal_to_read += 1;
14691                next_offset += envelope_size;
14692            }
14693
14694            let next_out_of_line = decoder.next_out_of_line();
14695            let handles_before = decoder.remaining_handles();
14696            if let Some((inlined, num_bytes, num_handles)) =
14697                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14698            {
14699                let member_inline_size = <fidl::encoding::Endpoint<
14700                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14701                > as fidl::encoding::TypeMarker>::inline_size(
14702                    decoder.context
14703                );
14704                if inlined != (member_inline_size <= 4) {
14705                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14706                }
14707                let inner_offset;
14708                let mut inner_depth = depth.clone();
14709                if inlined {
14710                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14711                    inner_offset = next_offset;
14712                } else {
14713                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14714                    inner_depth.increment()?;
14715                }
14716                let val_ref = self.directory.get_or_insert_with(|| {
14717                    fidl::new_empty!(
14718                        fidl::encoding::Endpoint<
14719                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14720                        >,
14721                        fidl::encoding::DefaultFuchsiaResourceDialect
14722                    )
14723                });
14724                fidl::decode!(
14725                    fidl::encoding::Endpoint<
14726                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14727                    >,
14728                    fidl::encoding::DefaultFuchsiaResourceDialect,
14729                    val_ref,
14730                    decoder,
14731                    inner_offset,
14732                    inner_depth
14733                )?;
14734                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14735                {
14736                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14737                }
14738                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14739                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14740                }
14741            }
14742
14743            next_offset += envelope_size;
14744
14745            // Decode the remaining unknown envelopes.
14746            while next_offset < end_offset {
14747                _next_ordinal_to_read += 1;
14748                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14749                next_offset += envelope_size;
14750            }
14751
14752            Ok(())
14753        }
14754    }
14755
14756    impl Cookie {
14757        #[inline(always)]
14758        fn max_ordinal_present(&self) -> u64 {
14759            if let Some(_) = self.value {
14760                return 2;
14761            }
14762            if let Some(_) = self.id {
14763                return 1;
14764            }
14765            0
14766        }
14767    }
14768
14769    impl fidl::encoding::ResourceTypeMarker for Cookie {
14770        type Borrowed<'a> = &'a mut Self;
14771        fn take_or_borrow<'a>(
14772            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14773        ) -> Self::Borrowed<'a> {
14774            value
14775        }
14776    }
14777
14778    unsafe impl fidl::encoding::TypeMarker for Cookie {
14779        type Owned = Self;
14780
14781        #[inline(always)]
14782        fn inline_align(_context: fidl::encoding::Context) -> usize {
14783            8
14784        }
14785
14786        #[inline(always)]
14787        fn inline_size(_context: fidl::encoding::Context) -> usize {
14788            16
14789        }
14790    }
14791
14792    unsafe impl fidl::encoding::Encode<Cookie, fidl::encoding::DefaultFuchsiaResourceDialect>
14793        for &mut Cookie
14794    {
14795        unsafe fn encode(
14796            self,
14797            encoder: &mut fidl::encoding::Encoder<
14798                '_,
14799                fidl::encoding::DefaultFuchsiaResourceDialect,
14800            >,
14801            offset: usize,
14802            mut depth: fidl::encoding::Depth,
14803        ) -> fidl::Result<()> {
14804            encoder.debug_check_bounds::<Cookie>(offset);
14805            // Vector header
14806            let max_ordinal: u64 = self.max_ordinal_present();
14807            encoder.write_num(max_ordinal, offset);
14808            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14809            // Calling encoder.out_of_line_offset(0) is not allowed.
14810            if max_ordinal == 0 {
14811                return Ok(());
14812            }
14813            depth.increment()?;
14814            let envelope_size = 8;
14815            let bytes_len = max_ordinal as usize * envelope_size;
14816            #[allow(unused_variables)]
14817            let offset = encoder.out_of_line_offset(bytes_len);
14818            let mut _prev_end_offset: usize = 0;
14819            if 1 > max_ordinal {
14820                return Ok(());
14821            }
14822
14823            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14824            // are envelope_size bytes.
14825            let cur_offset: usize = (1 - 1) * envelope_size;
14826
14827            // Zero reserved fields.
14828            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14829
14830            // Safety:
14831            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14832            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14833            //   envelope_size bytes, there is always sufficient room.
14834            fidl::encoding::encode_in_envelope_optional::<
14835                CookieId,
14836                fidl::encoding::DefaultFuchsiaResourceDialect,
14837            >(
14838                self.id.as_ref().map(<CookieId as fidl::encoding::ValueTypeMarker>::borrow),
14839                encoder,
14840                offset + cur_offset,
14841                depth,
14842            )?;
14843
14844            _prev_end_offset = cur_offset + envelope_size;
14845            if 2 > max_ordinal {
14846                return Ok(());
14847            }
14848
14849            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14850            // are envelope_size bytes.
14851            let cur_offset: usize = (2 - 1) * envelope_size;
14852
14853            // Zero reserved fields.
14854            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14855
14856            // Safety:
14857            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14858            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14859            //   envelope_size bytes, there is always sufficient room.
14860            fidl::encoding::encode_in_envelope_optional::<
14861                fidl::encoding::UnboundedString,
14862                fidl::encoding::DefaultFuchsiaResourceDialect,
14863            >(
14864                self.value.as_ref().map(
14865                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
14866                ),
14867                encoder,
14868                offset + cur_offset,
14869                depth,
14870            )?;
14871
14872            _prev_end_offset = cur_offset + envelope_size;
14873
14874            Ok(())
14875        }
14876    }
14877
14878    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Cookie {
14879        #[inline(always)]
14880        fn new_empty() -> Self {
14881            Self::default()
14882        }
14883
14884        unsafe fn decode(
14885            &mut self,
14886            decoder: &mut fidl::encoding::Decoder<
14887                '_,
14888                fidl::encoding::DefaultFuchsiaResourceDialect,
14889            >,
14890            offset: usize,
14891            mut depth: fidl::encoding::Depth,
14892        ) -> fidl::Result<()> {
14893            decoder.debug_check_bounds::<Self>(offset);
14894            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14895                None => return Err(fidl::Error::NotNullable),
14896                Some(len) => len,
14897            };
14898            // Calling decoder.out_of_line_offset(0) is not allowed.
14899            if len == 0 {
14900                return Ok(());
14901            };
14902            depth.increment()?;
14903            let envelope_size = 8;
14904            let bytes_len = len * envelope_size;
14905            let offset = decoder.out_of_line_offset(bytes_len)?;
14906            // Decode the envelope for each type.
14907            let mut _next_ordinal_to_read = 0;
14908            let mut next_offset = offset;
14909            let end_offset = offset + bytes_len;
14910            _next_ordinal_to_read += 1;
14911            if next_offset >= end_offset {
14912                return Ok(());
14913            }
14914
14915            // Decode unknown envelopes for gaps in ordinals.
14916            while _next_ordinal_to_read < 1 {
14917                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14918                _next_ordinal_to_read += 1;
14919                next_offset += envelope_size;
14920            }
14921
14922            let next_out_of_line = decoder.next_out_of_line();
14923            let handles_before = decoder.remaining_handles();
14924            if let Some((inlined, num_bytes, num_handles)) =
14925                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14926            {
14927                let member_inline_size =
14928                    <CookieId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14929                if inlined != (member_inline_size <= 4) {
14930                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14931                }
14932                let inner_offset;
14933                let mut inner_depth = depth.clone();
14934                if inlined {
14935                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14936                    inner_offset = next_offset;
14937                } else {
14938                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14939                    inner_depth.increment()?;
14940                }
14941                let val_ref = self.id.get_or_insert_with(|| {
14942                    fidl::new_empty!(CookieId, fidl::encoding::DefaultFuchsiaResourceDialect)
14943                });
14944                fidl::decode!(
14945                    CookieId,
14946                    fidl::encoding::DefaultFuchsiaResourceDialect,
14947                    val_ref,
14948                    decoder,
14949                    inner_offset,
14950                    inner_depth
14951                )?;
14952                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14953                {
14954                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14955                }
14956                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14957                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14958                }
14959            }
14960
14961            next_offset += envelope_size;
14962            _next_ordinal_to_read += 1;
14963            if next_offset >= end_offset {
14964                return Ok(());
14965            }
14966
14967            // Decode unknown envelopes for gaps in ordinals.
14968            while _next_ordinal_to_read < 2 {
14969                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14970                _next_ordinal_to_read += 1;
14971                next_offset += envelope_size;
14972            }
14973
14974            let next_out_of_line = decoder.next_out_of_line();
14975            let handles_before = decoder.remaining_handles();
14976            if let Some((inlined, num_bytes, num_handles)) =
14977                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14978            {
14979                let member_inline_size =
14980                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
14981                        decoder.context,
14982                    );
14983                if inlined != (member_inline_size <= 4) {
14984                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14985                }
14986                let inner_offset;
14987                let mut inner_depth = depth.clone();
14988                if inlined {
14989                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14990                    inner_offset = next_offset;
14991                } else {
14992                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14993                    inner_depth.increment()?;
14994                }
14995                let val_ref = self.value.get_or_insert_with(|| {
14996                    fidl::new_empty!(
14997                        fidl::encoding::UnboundedString,
14998                        fidl::encoding::DefaultFuchsiaResourceDialect
14999                    )
15000                });
15001                fidl::decode!(
15002                    fidl::encoding::UnboundedString,
15003                    fidl::encoding::DefaultFuchsiaResourceDialect,
15004                    val_ref,
15005                    decoder,
15006                    inner_offset,
15007                    inner_depth
15008                )?;
15009                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15010                {
15011                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15012                }
15013                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15014                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15015                }
15016            }
15017
15018            next_offset += envelope_size;
15019
15020            // Decode the remaining unknown envelopes.
15021            while next_offset < end_offset {
15022                _next_ordinal_to_read += 1;
15023                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15024                next_offset += envelope_size;
15025            }
15026
15027            Ok(())
15028        }
15029    }
15030
15031    impl CreateContextParams {
15032        #[inline(always)]
15033        fn max_ordinal_present(&self) -> u64 {
15034            if let Some(_) = self.data_quota_bytes {
15035                return 13;
15036            }
15037            if let Some(_) = self.cdm_data_quota_bytes {
15038                return 12;
15039            }
15040            if let Some(_) = self.cdm_data_directory {
15041                return 11;
15042            }
15043            if let Some(_) = self.cors_exempt_headers {
15044                return 10;
15045            }
15046            if let Some(_) = self.unsafely_treat_insecure_origins_as_secure {
15047                return 9;
15048            }
15049            if let Some(_) = self.playready_key_system {
15050                return 8;
15051            }
15052            if let Some(_) = self.features {
15053                return 7;
15054            }
15055            if let Some(_) = self.content_directories {
15056                return 6;
15057            }
15058            if let Some(_) = self.remote_debugging_port {
15059                return 5;
15060            }
15061            if let Some(_) = self.user_agent_version {
15062                return 4;
15063            }
15064            if let Some(_) = self.user_agent_product {
15065                return 3;
15066            }
15067            if let Some(_) = self.data_directory {
15068                return 2;
15069            }
15070            if let Some(_) = self.service_directory {
15071                return 1;
15072            }
15073            0
15074        }
15075    }
15076
15077    impl fidl::encoding::ResourceTypeMarker for CreateContextParams {
15078        type Borrowed<'a> = &'a mut Self;
15079        fn take_or_borrow<'a>(
15080            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15081        ) -> Self::Borrowed<'a> {
15082            value
15083        }
15084    }
15085
15086    unsafe impl fidl::encoding::TypeMarker for CreateContextParams {
15087        type Owned = Self;
15088
15089        #[inline(always)]
15090        fn inline_align(_context: fidl::encoding::Context) -> usize {
15091            8
15092        }
15093
15094        #[inline(always)]
15095        fn inline_size(_context: fidl::encoding::Context) -> usize {
15096            16
15097        }
15098    }
15099
15100    unsafe impl
15101        fidl::encoding::Encode<CreateContextParams, fidl::encoding::DefaultFuchsiaResourceDialect>
15102        for &mut CreateContextParams
15103    {
15104        unsafe fn encode(
15105            self,
15106            encoder: &mut fidl::encoding::Encoder<
15107                '_,
15108                fidl::encoding::DefaultFuchsiaResourceDialect,
15109            >,
15110            offset: usize,
15111            mut depth: fidl::encoding::Depth,
15112        ) -> fidl::Result<()> {
15113            encoder.debug_check_bounds::<CreateContextParams>(offset);
15114            // Vector header
15115            let max_ordinal: u64 = self.max_ordinal_present();
15116            encoder.write_num(max_ordinal, offset);
15117            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15118            // Calling encoder.out_of_line_offset(0) is not allowed.
15119            if max_ordinal == 0 {
15120                return Ok(());
15121            }
15122            depth.increment()?;
15123            let envelope_size = 8;
15124            let bytes_len = max_ordinal as usize * envelope_size;
15125            #[allow(unused_variables)]
15126            let offset = encoder.out_of_line_offset(bytes_len);
15127            let mut _prev_end_offset: usize = 0;
15128            if 1 > max_ordinal {
15129                return Ok(());
15130            }
15131
15132            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15133            // are envelope_size bytes.
15134            let cur_offset: usize = (1 - 1) * envelope_size;
15135
15136            // Zero reserved fields.
15137            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15138
15139            // Safety:
15140            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15141            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15142            //   envelope_size bytes, there is always sufficient room.
15143            fidl::encoding::encode_in_envelope_optional::<
15144                fidl::encoding::Endpoint<
15145                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15146                >,
15147                fidl::encoding::DefaultFuchsiaResourceDialect,
15148            >(
15149                self.service_directory.as_mut().map(
15150                    <fidl::encoding::Endpoint<
15151                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15152                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15153                ),
15154                encoder,
15155                offset + cur_offset,
15156                depth,
15157            )?;
15158
15159            _prev_end_offset = cur_offset + envelope_size;
15160            if 2 > max_ordinal {
15161                return Ok(());
15162            }
15163
15164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15165            // are envelope_size bytes.
15166            let cur_offset: usize = (2 - 1) * envelope_size;
15167
15168            // Zero reserved fields.
15169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15170
15171            // Safety:
15172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15174            //   envelope_size bytes, there is always sufficient room.
15175            fidl::encoding::encode_in_envelope_optional::<
15176                fidl::encoding::Endpoint<
15177                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15178                >,
15179                fidl::encoding::DefaultFuchsiaResourceDialect,
15180            >(
15181                self.data_directory.as_mut().map(
15182                    <fidl::encoding::Endpoint<
15183                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15184                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15185                ),
15186                encoder,
15187                offset + cur_offset,
15188                depth,
15189            )?;
15190
15191            _prev_end_offset = cur_offset + envelope_size;
15192            if 3 > max_ordinal {
15193                return Ok(());
15194            }
15195
15196            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15197            // are envelope_size bytes.
15198            let cur_offset: usize = (3 - 1) * envelope_size;
15199
15200            // Zero reserved fields.
15201            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15202
15203            // Safety:
15204            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15205            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15206            //   envelope_size bytes, there is always sufficient room.
15207            fidl::encoding::encode_in_envelope_optional::<
15208                fidl::encoding::BoundedString<128>,
15209                fidl::encoding::DefaultFuchsiaResourceDialect,
15210            >(
15211                self.user_agent_product.as_ref().map(
15212                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15213                ),
15214                encoder,
15215                offset + cur_offset,
15216                depth,
15217            )?;
15218
15219            _prev_end_offset = cur_offset + envelope_size;
15220            if 4 > max_ordinal {
15221                return Ok(());
15222            }
15223
15224            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15225            // are envelope_size bytes.
15226            let cur_offset: usize = (4 - 1) * envelope_size;
15227
15228            // Zero reserved fields.
15229            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15230
15231            // Safety:
15232            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15233            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15234            //   envelope_size bytes, there is always sufficient room.
15235            fidl::encoding::encode_in_envelope_optional::<
15236                fidl::encoding::BoundedString<128>,
15237                fidl::encoding::DefaultFuchsiaResourceDialect,
15238            >(
15239                self.user_agent_version.as_ref().map(
15240                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15241                ),
15242                encoder,
15243                offset + cur_offset,
15244                depth,
15245            )?;
15246
15247            _prev_end_offset = cur_offset + envelope_size;
15248            if 5 > max_ordinal {
15249                return Ok(());
15250            }
15251
15252            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15253            // are envelope_size bytes.
15254            let cur_offset: usize = (5 - 1) * envelope_size;
15255
15256            // Zero reserved fields.
15257            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15258
15259            // Safety:
15260            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15261            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15262            //   envelope_size bytes, there is always sufficient room.
15263            fidl::encoding::encode_in_envelope_optional::<
15264                u16,
15265                fidl::encoding::DefaultFuchsiaResourceDialect,
15266            >(
15267                self.remote_debugging_port
15268                    .as_ref()
15269                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
15270                encoder,
15271                offset + cur_offset,
15272                depth,
15273            )?;
15274
15275            _prev_end_offset = cur_offset + envelope_size;
15276            if 6 > max_ordinal {
15277                return Ok(());
15278            }
15279
15280            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15281            // are envelope_size bytes.
15282            let cur_offset: usize = (6 - 1) * envelope_size;
15283
15284            // Zero reserved fields.
15285            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15286
15287            // Safety:
15288            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15289            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15290            //   envelope_size bytes, there is always sufficient room.
15291            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15292            self.content_directories.as_mut().map(<fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15293            encoder, offset + cur_offset, depth
15294        )?;
15295
15296            _prev_end_offset = cur_offset + envelope_size;
15297            if 7 > max_ordinal {
15298                return Ok(());
15299            }
15300
15301            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15302            // are envelope_size bytes.
15303            let cur_offset: usize = (7 - 1) * envelope_size;
15304
15305            // Zero reserved fields.
15306            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15307
15308            // Safety:
15309            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15310            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15311            //   envelope_size bytes, there is always sufficient room.
15312            fidl::encoding::encode_in_envelope_optional::<
15313                ContextFeatureFlags,
15314                fidl::encoding::DefaultFuchsiaResourceDialect,
15315            >(
15316                self.features
15317                    .as_ref()
15318                    .map(<ContextFeatureFlags as fidl::encoding::ValueTypeMarker>::borrow),
15319                encoder,
15320                offset + cur_offset,
15321                depth,
15322            )?;
15323
15324            _prev_end_offset = cur_offset + envelope_size;
15325            if 8 > max_ordinal {
15326                return Ok(());
15327            }
15328
15329            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15330            // are envelope_size bytes.
15331            let cur_offset: usize = (8 - 1) * envelope_size;
15332
15333            // Zero reserved fields.
15334            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15335
15336            // Safety:
15337            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15338            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15339            //   envelope_size bytes, there is always sufficient room.
15340            fidl::encoding::encode_in_envelope_optional::<
15341                fidl::encoding::BoundedString<128>,
15342                fidl::encoding::DefaultFuchsiaResourceDialect,
15343            >(
15344                self.playready_key_system.as_ref().map(
15345                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15346                ),
15347                encoder,
15348                offset + cur_offset,
15349                depth,
15350            )?;
15351
15352            _prev_end_offset = cur_offset + envelope_size;
15353            if 9 > max_ordinal {
15354                return Ok(());
15355            }
15356
15357            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15358            // are envelope_size bytes.
15359            let cur_offset: usize = (9 - 1) * envelope_size;
15360
15361            // Zero reserved fields.
15362            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15363
15364            // Safety:
15365            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15366            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15367            //   envelope_size bytes, there is always sufficient room.
15368            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15369            self.unsafely_treat_insecure_origins_as_secure.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100> as fidl::encoding::ValueTypeMarker>::borrow),
15370            encoder, offset + cur_offset, depth
15371        )?;
15372
15373            _prev_end_offset = cur_offset + envelope_size;
15374            if 10 > max_ordinal {
15375                return Ok(());
15376            }
15377
15378            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15379            // are envelope_size bytes.
15380            let cur_offset: usize = (10 - 1) * envelope_size;
15381
15382            // Zero reserved fields.
15383            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15384
15385            // Safety:
15386            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15387            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15388            //   envelope_size bytes, there is always sufficient room.
15389            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15390            self.cors_exempt_headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow),
15391            encoder, offset + cur_offset, depth
15392        )?;
15393
15394            _prev_end_offset = cur_offset + envelope_size;
15395            if 11 > max_ordinal {
15396                return Ok(());
15397            }
15398
15399            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15400            // are envelope_size bytes.
15401            let cur_offset: usize = (11 - 1) * envelope_size;
15402
15403            // Zero reserved fields.
15404            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15405
15406            // Safety:
15407            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15408            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15409            //   envelope_size bytes, there is always sufficient room.
15410            fidl::encoding::encode_in_envelope_optional::<
15411                fidl::encoding::Endpoint<
15412                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15413                >,
15414                fidl::encoding::DefaultFuchsiaResourceDialect,
15415            >(
15416                self.cdm_data_directory.as_mut().map(
15417                    <fidl::encoding::Endpoint<
15418                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15419                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15420                ),
15421                encoder,
15422                offset + cur_offset,
15423                depth,
15424            )?;
15425
15426            _prev_end_offset = cur_offset + envelope_size;
15427            if 12 > max_ordinal {
15428                return Ok(());
15429            }
15430
15431            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15432            // are envelope_size bytes.
15433            let cur_offset: usize = (12 - 1) * envelope_size;
15434
15435            // Zero reserved fields.
15436            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15437
15438            // Safety:
15439            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15440            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15441            //   envelope_size bytes, there is always sufficient room.
15442            fidl::encoding::encode_in_envelope_optional::<
15443                u64,
15444                fidl::encoding::DefaultFuchsiaResourceDialect,
15445            >(
15446                self.cdm_data_quota_bytes
15447                    .as_ref()
15448                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15449                encoder,
15450                offset + cur_offset,
15451                depth,
15452            )?;
15453
15454            _prev_end_offset = cur_offset + envelope_size;
15455            if 13 > max_ordinal {
15456                return Ok(());
15457            }
15458
15459            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15460            // are envelope_size bytes.
15461            let cur_offset: usize = (13 - 1) * envelope_size;
15462
15463            // Zero reserved fields.
15464            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15465
15466            // Safety:
15467            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15468            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15469            //   envelope_size bytes, there is always sufficient room.
15470            fidl::encoding::encode_in_envelope_optional::<
15471                u64,
15472                fidl::encoding::DefaultFuchsiaResourceDialect,
15473            >(
15474                self.data_quota_bytes
15475                    .as_ref()
15476                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15477                encoder,
15478                offset + cur_offset,
15479                depth,
15480            )?;
15481
15482            _prev_end_offset = cur_offset + envelope_size;
15483
15484            Ok(())
15485        }
15486    }
15487
15488    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15489        for CreateContextParams
15490    {
15491        #[inline(always)]
15492        fn new_empty() -> Self {
15493            Self::default()
15494        }
15495
15496        unsafe fn decode(
15497            &mut self,
15498            decoder: &mut fidl::encoding::Decoder<
15499                '_,
15500                fidl::encoding::DefaultFuchsiaResourceDialect,
15501            >,
15502            offset: usize,
15503            mut depth: fidl::encoding::Depth,
15504        ) -> fidl::Result<()> {
15505            decoder.debug_check_bounds::<Self>(offset);
15506            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15507                None => return Err(fidl::Error::NotNullable),
15508                Some(len) => len,
15509            };
15510            // Calling decoder.out_of_line_offset(0) is not allowed.
15511            if len == 0 {
15512                return Ok(());
15513            };
15514            depth.increment()?;
15515            let envelope_size = 8;
15516            let bytes_len = len * envelope_size;
15517            let offset = decoder.out_of_line_offset(bytes_len)?;
15518            // Decode the envelope for each type.
15519            let mut _next_ordinal_to_read = 0;
15520            let mut next_offset = offset;
15521            let end_offset = offset + bytes_len;
15522            _next_ordinal_to_read += 1;
15523            if next_offset >= end_offset {
15524                return Ok(());
15525            }
15526
15527            // Decode unknown envelopes for gaps in ordinals.
15528            while _next_ordinal_to_read < 1 {
15529                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15530                _next_ordinal_to_read += 1;
15531                next_offset += envelope_size;
15532            }
15533
15534            let next_out_of_line = decoder.next_out_of_line();
15535            let handles_before = decoder.remaining_handles();
15536            if let Some((inlined, num_bytes, num_handles)) =
15537                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15538            {
15539                let member_inline_size = <fidl::encoding::Endpoint<
15540                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15541                > as fidl::encoding::TypeMarker>::inline_size(
15542                    decoder.context
15543                );
15544                if inlined != (member_inline_size <= 4) {
15545                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15546                }
15547                let inner_offset;
15548                let mut inner_depth = depth.clone();
15549                if inlined {
15550                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15551                    inner_offset = next_offset;
15552                } else {
15553                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15554                    inner_depth.increment()?;
15555                }
15556                let val_ref = self.service_directory.get_or_insert_with(|| {
15557                    fidl::new_empty!(
15558                        fidl::encoding::Endpoint<
15559                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15560                        >,
15561                        fidl::encoding::DefaultFuchsiaResourceDialect
15562                    )
15563                });
15564                fidl::decode!(
15565                    fidl::encoding::Endpoint<
15566                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15567                    >,
15568                    fidl::encoding::DefaultFuchsiaResourceDialect,
15569                    val_ref,
15570                    decoder,
15571                    inner_offset,
15572                    inner_depth
15573                )?;
15574                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15575                {
15576                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15577                }
15578                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15579                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15580                }
15581            }
15582
15583            next_offset += envelope_size;
15584            _next_ordinal_to_read += 1;
15585            if next_offset >= end_offset {
15586                return Ok(());
15587            }
15588
15589            // Decode unknown envelopes for gaps in ordinals.
15590            while _next_ordinal_to_read < 2 {
15591                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15592                _next_ordinal_to_read += 1;
15593                next_offset += envelope_size;
15594            }
15595
15596            let next_out_of_line = decoder.next_out_of_line();
15597            let handles_before = decoder.remaining_handles();
15598            if let Some((inlined, num_bytes, num_handles)) =
15599                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15600            {
15601                let member_inline_size = <fidl::encoding::Endpoint<
15602                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15603                > as fidl::encoding::TypeMarker>::inline_size(
15604                    decoder.context
15605                );
15606                if inlined != (member_inline_size <= 4) {
15607                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15608                }
15609                let inner_offset;
15610                let mut inner_depth = depth.clone();
15611                if inlined {
15612                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15613                    inner_offset = next_offset;
15614                } else {
15615                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15616                    inner_depth.increment()?;
15617                }
15618                let val_ref = self.data_directory.get_or_insert_with(|| {
15619                    fidl::new_empty!(
15620                        fidl::encoding::Endpoint<
15621                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15622                        >,
15623                        fidl::encoding::DefaultFuchsiaResourceDialect
15624                    )
15625                });
15626                fidl::decode!(
15627                    fidl::encoding::Endpoint<
15628                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15629                    >,
15630                    fidl::encoding::DefaultFuchsiaResourceDialect,
15631                    val_ref,
15632                    decoder,
15633                    inner_offset,
15634                    inner_depth
15635                )?;
15636                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15637                {
15638                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15639                }
15640                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15641                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15642                }
15643            }
15644
15645            next_offset += envelope_size;
15646            _next_ordinal_to_read += 1;
15647            if next_offset >= end_offset {
15648                return Ok(());
15649            }
15650
15651            // Decode unknown envelopes for gaps in ordinals.
15652            while _next_ordinal_to_read < 3 {
15653                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15654                _next_ordinal_to_read += 1;
15655                next_offset += envelope_size;
15656            }
15657
15658            let next_out_of_line = decoder.next_out_of_line();
15659            let handles_before = decoder.remaining_handles();
15660            if let Some((inlined, num_bytes, num_handles)) =
15661                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15662            {
15663                let member_inline_size =
15664                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15665                        decoder.context,
15666                    );
15667                if inlined != (member_inline_size <= 4) {
15668                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15669                }
15670                let inner_offset;
15671                let mut inner_depth = depth.clone();
15672                if inlined {
15673                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15674                    inner_offset = next_offset;
15675                } else {
15676                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15677                    inner_depth.increment()?;
15678                }
15679                let val_ref = self.user_agent_product.get_or_insert_with(|| {
15680                    fidl::new_empty!(
15681                        fidl::encoding::BoundedString<128>,
15682                        fidl::encoding::DefaultFuchsiaResourceDialect
15683                    )
15684                });
15685                fidl::decode!(
15686                    fidl::encoding::BoundedString<128>,
15687                    fidl::encoding::DefaultFuchsiaResourceDialect,
15688                    val_ref,
15689                    decoder,
15690                    inner_offset,
15691                    inner_depth
15692                )?;
15693                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15694                {
15695                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15696                }
15697                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15698                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15699                }
15700            }
15701
15702            next_offset += envelope_size;
15703            _next_ordinal_to_read += 1;
15704            if next_offset >= end_offset {
15705                return Ok(());
15706            }
15707
15708            // Decode unknown envelopes for gaps in ordinals.
15709            while _next_ordinal_to_read < 4 {
15710                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15711                _next_ordinal_to_read += 1;
15712                next_offset += envelope_size;
15713            }
15714
15715            let next_out_of_line = decoder.next_out_of_line();
15716            let handles_before = decoder.remaining_handles();
15717            if let Some((inlined, num_bytes, num_handles)) =
15718                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15719            {
15720                let member_inline_size =
15721                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15722                        decoder.context,
15723                    );
15724                if inlined != (member_inline_size <= 4) {
15725                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15726                }
15727                let inner_offset;
15728                let mut inner_depth = depth.clone();
15729                if inlined {
15730                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15731                    inner_offset = next_offset;
15732                } else {
15733                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15734                    inner_depth.increment()?;
15735                }
15736                let val_ref = self.user_agent_version.get_or_insert_with(|| {
15737                    fidl::new_empty!(
15738                        fidl::encoding::BoundedString<128>,
15739                        fidl::encoding::DefaultFuchsiaResourceDialect
15740                    )
15741                });
15742                fidl::decode!(
15743                    fidl::encoding::BoundedString<128>,
15744                    fidl::encoding::DefaultFuchsiaResourceDialect,
15745                    val_ref,
15746                    decoder,
15747                    inner_offset,
15748                    inner_depth
15749                )?;
15750                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15751                {
15752                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15753                }
15754                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15755                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15756                }
15757            }
15758
15759            next_offset += envelope_size;
15760            _next_ordinal_to_read += 1;
15761            if next_offset >= end_offset {
15762                return Ok(());
15763            }
15764
15765            // Decode unknown envelopes for gaps in ordinals.
15766            while _next_ordinal_to_read < 5 {
15767                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15768                _next_ordinal_to_read += 1;
15769                next_offset += envelope_size;
15770            }
15771
15772            let next_out_of_line = decoder.next_out_of_line();
15773            let handles_before = decoder.remaining_handles();
15774            if let Some((inlined, num_bytes, num_handles)) =
15775                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15776            {
15777                let member_inline_size =
15778                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15779                if inlined != (member_inline_size <= 4) {
15780                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15781                }
15782                let inner_offset;
15783                let mut inner_depth = depth.clone();
15784                if inlined {
15785                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15786                    inner_offset = next_offset;
15787                } else {
15788                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15789                    inner_depth.increment()?;
15790                }
15791                let val_ref = self.remote_debugging_port.get_or_insert_with(|| {
15792                    fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
15793                });
15794                fidl::decode!(
15795                    u16,
15796                    fidl::encoding::DefaultFuchsiaResourceDialect,
15797                    val_ref,
15798                    decoder,
15799                    inner_offset,
15800                    inner_depth
15801                )?;
15802                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15803                {
15804                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15805                }
15806                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15807                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15808                }
15809            }
15810
15811            next_offset += envelope_size;
15812            _next_ordinal_to_read += 1;
15813            if next_offset >= end_offset {
15814                return Ok(());
15815            }
15816
15817            // Decode unknown envelopes for gaps in ordinals.
15818            while _next_ordinal_to_read < 6 {
15819                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15820                _next_ordinal_to_read += 1;
15821                next_offset += envelope_size;
15822            }
15823
15824            let next_out_of_line = decoder.next_out_of_line();
15825            let handles_before = decoder.remaining_handles();
15826            if let Some((inlined, num_bytes, num_handles)) =
15827                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15828            {
15829                let member_inline_size = <fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15830                if inlined != (member_inline_size <= 4) {
15831                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15832                }
15833                let inner_offset;
15834                let mut inner_depth = depth.clone();
15835                if inlined {
15836                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15837                    inner_offset = next_offset;
15838                } else {
15839                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15840                    inner_depth.increment()?;
15841                }
15842                let val_ref =
15843                self.content_directories.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect));
15844                fidl::decode!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
15845                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15846                {
15847                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15848                }
15849                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15850                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15851                }
15852            }
15853
15854            next_offset += envelope_size;
15855            _next_ordinal_to_read += 1;
15856            if next_offset >= end_offset {
15857                return Ok(());
15858            }
15859
15860            // Decode unknown envelopes for gaps in ordinals.
15861            while _next_ordinal_to_read < 7 {
15862                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15863                _next_ordinal_to_read += 1;
15864                next_offset += envelope_size;
15865            }
15866
15867            let next_out_of_line = decoder.next_out_of_line();
15868            let handles_before = decoder.remaining_handles();
15869            if let Some((inlined, num_bytes, num_handles)) =
15870                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15871            {
15872                let member_inline_size =
15873                    <ContextFeatureFlags as fidl::encoding::TypeMarker>::inline_size(
15874                        decoder.context,
15875                    );
15876                if inlined != (member_inline_size <= 4) {
15877                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15878                }
15879                let inner_offset;
15880                let mut inner_depth = depth.clone();
15881                if inlined {
15882                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15883                    inner_offset = next_offset;
15884                } else {
15885                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15886                    inner_depth.increment()?;
15887                }
15888                let val_ref = self.features.get_or_insert_with(|| {
15889                    fidl::new_empty!(
15890                        ContextFeatureFlags,
15891                        fidl::encoding::DefaultFuchsiaResourceDialect
15892                    )
15893                });
15894                fidl::decode!(
15895                    ContextFeatureFlags,
15896                    fidl::encoding::DefaultFuchsiaResourceDialect,
15897                    val_ref,
15898                    decoder,
15899                    inner_offset,
15900                    inner_depth
15901                )?;
15902                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15903                {
15904                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15905                }
15906                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15907                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15908                }
15909            }
15910
15911            next_offset += envelope_size;
15912            _next_ordinal_to_read += 1;
15913            if next_offset >= end_offset {
15914                return Ok(());
15915            }
15916
15917            // Decode unknown envelopes for gaps in ordinals.
15918            while _next_ordinal_to_read < 8 {
15919                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15920                _next_ordinal_to_read += 1;
15921                next_offset += envelope_size;
15922            }
15923
15924            let next_out_of_line = decoder.next_out_of_line();
15925            let handles_before = decoder.remaining_handles();
15926            if let Some((inlined, num_bytes, num_handles)) =
15927                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15928            {
15929                let member_inline_size =
15930                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15931                        decoder.context,
15932                    );
15933                if inlined != (member_inline_size <= 4) {
15934                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15935                }
15936                let inner_offset;
15937                let mut inner_depth = depth.clone();
15938                if inlined {
15939                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15940                    inner_offset = next_offset;
15941                } else {
15942                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15943                    inner_depth.increment()?;
15944                }
15945                let val_ref = self.playready_key_system.get_or_insert_with(|| {
15946                    fidl::new_empty!(
15947                        fidl::encoding::BoundedString<128>,
15948                        fidl::encoding::DefaultFuchsiaResourceDialect
15949                    )
15950                });
15951                fidl::decode!(
15952                    fidl::encoding::BoundedString<128>,
15953                    fidl::encoding::DefaultFuchsiaResourceDialect,
15954                    val_ref,
15955                    decoder,
15956                    inner_offset,
15957                    inner_depth
15958                )?;
15959                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15960                {
15961                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15962                }
15963                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15964                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15965                }
15966            }
15967
15968            next_offset += envelope_size;
15969            _next_ordinal_to_read += 1;
15970            if next_offset >= end_offset {
15971                return Ok(());
15972            }
15973
15974            // Decode unknown envelopes for gaps in ordinals.
15975            while _next_ordinal_to_read < 9 {
15976                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15977                _next_ordinal_to_read += 1;
15978                next_offset += envelope_size;
15979            }
15980
15981            let next_out_of_line = decoder.next_out_of_line();
15982            let handles_before = decoder.remaining_handles();
15983            if let Some((inlined, num_bytes, num_handles)) =
15984                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15985            {
15986                let member_inline_size = <fidl::encoding::Vector<
15987                    fidl::encoding::BoundedString<513>,
15988                    100,
15989                > as fidl::encoding::TypeMarker>::inline_size(
15990                    decoder.context
15991                );
15992                if inlined != (member_inline_size <= 4) {
15993                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15994                }
15995                let inner_offset;
15996                let mut inner_depth = depth.clone();
15997                if inlined {
15998                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15999                    inner_offset = next_offset;
16000                } else {
16001                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16002                    inner_depth.increment()?;
16003                }
16004                let val_ref =
16005                    self.unsafely_treat_insecure_origins_as_secure.get_or_insert_with(|| {
16006                        fidl::new_empty!(
16007                            fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
16008                            fidl::encoding::DefaultFuchsiaResourceDialect
16009                        )
16010                    });
16011                fidl::decode!(
16012                    fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
16013                    fidl::encoding::DefaultFuchsiaResourceDialect,
16014                    val_ref,
16015                    decoder,
16016                    inner_offset,
16017                    inner_depth
16018                )?;
16019                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16020                {
16021                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16022                }
16023                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16024                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16025                }
16026            }
16027
16028            next_offset += envelope_size;
16029            _next_ordinal_to_read += 1;
16030            if next_offset >= end_offset {
16031                return Ok(());
16032            }
16033
16034            // Decode unknown envelopes for gaps in ordinals.
16035            while _next_ordinal_to_read < 10 {
16036                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16037                _next_ordinal_to_read += 1;
16038                next_offset += envelope_size;
16039            }
16040
16041            let next_out_of_line = decoder.next_out_of_line();
16042            let handles_before = decoder.remaining_handles();
16043            if let Some((inlined, num_bytes, num_handles)) =
16044                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16045            {
16046                let member_inline_size = <fidl::encoding::UnboundedVector<
16047                    fidl::encoding::UnboundedVector<u8>,
16048                > as fidl::encoding::TypeMarker>::inline_size(
16049                    decoder.context
16050                );
16051                if inlined != (member_inline_size <= 4) {
16052                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16053                }
16054                let inner_offset;
16055                let mut inner_depth = depth.clone();
16056                if inlined {
16057                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16058                    inner_offset = next_offset;
16059                } else {
16060                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16061                    inner_depth.increment()?;
16062                }
16063                let val_ref = self.cors_exempt_headers.get_or_insert_with(|| {
16064                    fidl::new_empty!(
16065                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
16066                        fidl::encoding::DefaultFuchsiaResourceDialect
16067                    )
16068                });
16069                fidl::decode!(
16070                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
16071                    fidl::encoding::DefaultFuchsiaResourceDialect,
16072                    val_ref,
16073                    decoder,
16074                    inner_offset,
16075                    inner_depth
16076                )?;
16077                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16078                {
16079                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16080                }
16081                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16082                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16083                }
16084            }
16085
16086            next_offset += envelope_size;
16087            _next_ordinal_to_read += 1;
16088            if next_offset >= end_offset {
16089                return Ok(());
16090            }
16091
16092            // Decode unknown envelopes for gaps in ordinals.
16093            while _next_ordinal_to_read < 11 {
16094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16095                _next_ordinal_to_read += 1;
16096                next_offset += envelope_size;
16097            }
16098
16099            let next_out_of_line = decoder.next_out_of_line();
16100            let handles_before = decoder.remaining_handles();
16101            if let Some((inlined, num_bytes, num_handles)) =
16102                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16103            {
16104                let member_inline_size = <fidl::encoding::Endpoint<
16105                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16106                > as fidl::encoding::TypeMarker>::inline_size(
16107                    decoder.context
16108                );
16109                if inlined != (member_inline_size <= 4) {
16110                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16111                }
16112                let inner_offset;
16113                let mut inner_depth = depth.clone();
16114                if inlined {
16115                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16116                    inner_offset = next_offset;
16117                } else {
16118                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16119                    inner_depth.increment()?;
16120                }
16121                let val_ref = self.cdm_data_directory.get_or_insert_with(|| {
16122                    fidl::new_empty!(
16123                        fidl::encoding::Endpoint<
16124                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16125                        >,
16126                        fidl::encoding::DefaultFuchsiaResourceDialect
16127                    )
16128                });
16129                fidl::decode!(
16130                    fidl::encoding::Endpoint<
16131                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16132                    >,
16133                    fidl::encoding::DefaultFuchsiaResourceDialect,
16134                    val_ref,
16135                    decoder,
16136                    inner_offset,
16137                    inner_depth
16138                )?;
16139                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16140                {
16141                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16142                }
16143                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16144                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16145                }
16146            }
16147
16148            next_offset += envelope_size;
16149            _next_ordinal_to_read += 1;
16150            if next_offset >= end_offset {
16151                return Ok(());
16152            }
16153
16154            // Decode unknown envelopes for gaps in ordinals.
16155            while _next_ordinal_to_read < 12 {
16156                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16157                _next_ordinal_to_read += 1;
16158                next_offset += envelope_size;
16159            }
16160
16161            let next_out_of_line = decoder.next_out_of_line();
16162            let handles_before = decoder.remaining_handles();
16163            if let Some((inlined, num_bytes, num_handles)) =
16164                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16165            {
16166                let member_inline_size =
16167                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16168                if inlined != (member_inline_size <= 4) {
16169                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16170                }
16171                let inner_offset;
16172                let mut inner_depth = depth.clone();
16173                if inlined {
16174                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16175                    inner_offset = next_offset;
16176                } else {
16177                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16178                    inner_depth.increment()?;
16179                }
16180                let val_ref = self.cdm_data_quota_bytes.get_or_insert_with(|| {
16181                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16182                });
16183                fidl::decode!(
16184                    u64,
16185                    fidl::encoding::DefaultFuchsiaResourceDialect,
16186                    val_ref,
16187                    decoder,
16188                    inner_offset,
16189                    inner_depth
16190                )?;
16191                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16192                {
16193                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16194                }
16195                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16196                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16197                }
16198            }
16199
16200            next_offset += envelope_size;
16201            _next_ordinal_to_read += 1;
16202            if next_offset >= end_offset {
16203                return Ok(());
16204            }
16205
16206            // Decode unknown envelopes for gaps in ordinals.
16207            while _next_ordinal_to_read < 13 {
16208                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16209                _next_ordinal_to_read += 1;
16210                next_offset += envelope_size;
16211            }
16212
16213            let next_out_of_line = decoder.next_out_of_line();
16214            let handles_before = decoder.remaining_handles();
16215            if let Some((inlined, num_bytes, num_handles)) =
16216                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16217            {
16218                let member_inline_size =
16219                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16220                if inlined != (member_inline_size <= 4) {
16221                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16222                }
16223                let inner_offset;
16224                let mut inner_depth = depth.clone();
16225                if inlined {
16226                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16227                    inner_offset = next_offset;
16228                } else {
16229                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16230                    inner_depth.increment()?;
16231                }
16232                let val_ref = self.data_quota_bytes.get_or_insert_with(|| {
16233                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16234                });
16235                fidl::decode!(
16236                    u64,
16237                    fidl::encoding::DefaultFuchsiaResourceDialect,
16238                    val_ref,
16239                    decoder,
16240                    inner_offset,
16241                    inner_depth
16242                )?;
16243                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16244                {
16245                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16246                }
16247                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16248                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16249                }
16250            }
16251
16252            next_offset += envelope_size;
16253
16254            // Decode the remaining unknown envelopes.
16255            while next_offset < end_offset {
16256                _next_ordinal_to_read += 1;
16257                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16258                next_offset += envelope_size;
16259            }
16260
16261            Ok(())
16262        }
16263    }
16264
16265    impl CreateFrameParams {
16266        #[inline(always)]
16267        fn max_ordinal_present(&self) -> u64 {
16268            if let Some(_) = self.explicit_sites_filter_error_page {
16269                return 4;
16270            }
16271            if let Some(_) = self.debug_name {
16272                return 2;
16273            }
16274            if let Some(_) = self.enable_remote_debugging {
16275                return 1;
16276            }
16277            0
16278        }
16279    }
16280
16281    impl fidl::encoding::ResourceTypeMarker for CreateFrameParams {
16282        type Borrowed<'a> = &'a mut Self;
16283        fn take_or_borrow<'a>(
16284            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16285        ) -> Self::Borrowed<'a> {
16286            value
16287        }
16288    }
16289
16290    unsafe impl fidl::encoding::TypeMarker for CreateFrameParams {
16291        type Owned = Self;
16292
16293        #[inline(always)]
16294        fn inline_align(_context: fidl::encoding::Context) -> usize {
16295            8
16296        }
16297
16298        #[inline(always)]
16299        fn inline_size(_context: fidl::encoding::Context) -> usize {
16300            16
16301        }
16302    }
16303
16304    unsafe impl
16305        fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>
16306        for &mut CreateFrameParams
16307    {
16308        unsafe fn encode(
16309            self,
16310            encoder: &mut fidl::encoding::Encoder<
16311                '_,
16312                fidl::encoding::DefaultFuchsiaResourceDialect,
16313            >,
16314            offset: usize,
16315            mut depth: fidl::encoding::Depth,
16316        ) -> fidl::Result<()> {
16317            encoder.debug_check_bounds::<CreateFrameParams>(offset);
16318            // Vector header
16319            let max_ordinal: u64 = self.max_ordinal_present();
16320            encoder.write_num(max_ordinal, offset);
16321            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16322            // Calling encoder.out_of_line_offset(0) is not allowed.
16323            if max_ordinal == 0 {
16324                return Ok(());
16325            }
16326            depth.increment()?;
16327            let envelope_size = 8;
16328            let bytes_len = max_ordinal as usize * envelope_size;
16329            #[allow(unused_variables)]
16330            let offset = encoder.out_of_line_offset(bytes_len);
16331            let mut _prev_end_offset: usize = 0;
16332            if 1 > max_ordinal {
16333                return Ok(());
16334            }
16335
16336            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16337            // are envelope_size bytes.
16338            let cur_offset: usize = (1 - 1) * envelope_size;
16339
16340            // Zero reserved fields.
16341            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16342
16343            // Safety:
16344            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16345            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16346            //   envelope_size bytes, there is always sufficient room.
16347            fidl::encoding::encode_in_envelope_optional::<
16348                bool,
16349                fidl::encoding::DefaultFuchsiaResourceDialect,
16350            >(
16351                self.enable_remote_debugging
16352                    .as_ref()
16353                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
16354                encoder,
16355                offset + cur_offset,
16356                depth,
16357            )?;
16358
16359            _prev_end_offset = cur_offset + envelope_size;
16360            if 2 > max_ordinal {
16361                return Ok(());
16362            }
16363
16364            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16365            // are envelope_size bytes.
16366            let cur_offset: usize = (2 - 1) * envelope_size;
16367
16368            // Zero reserved fields.
16369            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16370
16371            // Safety:
16372            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16373            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16374            //   envelope_size bytes, there is always sufficient room.
16375            fidl::encoding::encode_in_envelope_optional::<
16376                fidl::encoding::UnboundedString,
16377                fidl::encoding::DefaultFuchsiaResourceDialect,
16378            >(
16379                self.debug_name.as_ref().map(
16380                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
16381                ),
16382                encoder,
16383                offset + cur_offset,
16384                depth,
16385            )?;
16386
16387            _prev_end_offset = cur_offset + envelope_size;
16388            if 4 > max_ordinal {
16389                return Ok(());
16390            }
16391
16392            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16393            // are envelope_size bytes.
16394            let cur_offset: usize = (4 - 1) * envelope_size;
16395
16396            // Zero reserved fields.
16397            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16398
16399            // Safety:
16400            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16401            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16402            //   envelope_size bytes, there is always sufficient room.
16403            fidl::encoding::encode_in_envelope_optional::<
16404                fidl_fuchsia_mem::Data,
16405                fidl::encoding::DefaultFuchsiaResourceDialect,
16406            >(
16407                self.explicit_sites_filter_error_page.as_mut().map(
16408                    <fidl_fuchsia_mem::Data as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16409                ),
16410                encoder,
16411                offset + cur_offset,
16412                depth,
16413            )?;
16414
16415            _prev_end_offset = cur_offset + envelope_size;
16416
16417            Ok(())
16418        }
16419    }
16420
16421    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16422        for CreateFrameParams
16423    {
16424        #[inline(always)]
16425        fn new_empty() -> Self {
16426            Self::default()
16427        }
16428
16429        unsafe fn decode(
16430            &mut self,
16431            decoder: &mut fidl::encoding::Decoder<
16432                '_,
16433                fidl::encoding::DefaultFuchsiaResourceDialect,
16434            >,
16435            offset: usize,
16436            mut depth: fidl::encoding::Depth,
16437        ) -> fidl::Result<()> {
16438            decoder.debug_check_bounds::<Self>(offset);
16439            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16440                None => return Err(fidl::Error::NotNullable),
16441                Some(len) => len,
16442            };
16443            // Calling decoder.out_of_line_offset(0) is not allowed.
16444            if len == 0 {
16445                return Ok(());
16446            };
16447            depth.increment()?;
16448            let envelope_size = 8;
16449            let bytes_len = len * envelope_size;
16450            let offset = decoder.out_of_line_offset(bytes_len)?;
16451            // Decode the envelope for each type.
16452            let mut _next_ordinal_to_read = 0;
16453            let mut next_offset = offset;
16454            let end_offset = offset + bytes_len;
16455            _next_ordinal_to_read += 1;
16456            if next_offset >= end_offset {
16457                return Ok(());
16458            }
16459
16460            // Decode unknown envelopes for gaps in ordinals.
16461            while _next_ordinal_to_read < 1 {
16462                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16463                _next_ordinal_to_read += 1;
16464                next_offset += envelope_size;
16465            }
16466
16467            let next_out_of_line = decoder.next_out_of_line();
16468            let handles_before = decoder.remaining_handles();
16469            if let Some((inlined, num_bytes, num_handles)) =
16470                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16471            {
16472                let member_inline_size =
16473                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16474                if inlined != (member_inline_size <= 4) {
16475                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16476                }
16477                let inner_offset;
16478                let mut inner_depth = depth.clone();
16479                if inlined {
16480                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16481                    inner_offset = next_offset;
16482                } else {
16483                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16484                    inner_depth.increment()?;
16485                }
16486                let val_ref = self.enable_remote_debugging.get_or_insert_with(|| {
16487                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
16488                });
16489                fidl::decode!(
16490                    bool,
16491                    fidl::encoding::DefaultFuchsiaResourceDialect,
16492                    val_ref,
16493                    decoder,
16494                    inner_offset,
16495                    inner_depth
16496                )?;
16497                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16498                {
16499                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16500                }
16501                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16502                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16503                }
16504            }
16505
16506            next_offset += envelope_size;
16507            _next_ordinal_to_read += 1;
16508            if next_offset >= end_offset {
16509                return Ok(());
16510            }
16511
16512            // Decode unknown envelopes for gaps in ordinals.
16513            while _next_ordinal_to_read < 2 {
16514                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16515                _next_ordinal_to_read += 1;
16516                next_offset += envelope_size;
16517            }
16518
16519            let next_out_of_line = decoder.next_out_of_line();
16520            let handles_before = decoder.remaining_handles();
16521            if let Some((inlined, num_bytes, num_handles)) =
16522                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16523            {
16524                let member_inline_size =
16525                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
16526                        decoder.context,
16527                    );
16528                if inlined != (member_inline_size <= 4) {
16529                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16530                }
16531                let inner_offset;
16532                let mut inner_depth = depth.clone();
16533                if inlined {
16534                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16535                    inner_offset = next_offset;
16536                } else {
16537                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16538                    inner_depth.increment()?;
16539                }
16540                let val_ref = self.debug_name.get_or_insert_with(|| {
16541                    fidl::new_empty!(
16542                        fidl::encoding::UnboundedString,
16543                        fidl::encoding::DefaultFuchsiaResourceDialect
16544                    )
16545                });
16546                fidl::decode!(
16547                    fidl::encoding::UnboundedString,
16548                    fidl::encoding::DefaultFuchsiaResourceDialect,
16549                    val_ref,
16550                    decoder,
16551                    inner_offset,
16552                    inner_depth
16553                )?;
16554                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16555                {
16556                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16557                }
16558                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16559                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16560                }
16561            }
16562
16563            next_offset += envelope_size;
16564            _next_ordinal_to_read += 1;
16565            if next_offset >= end_offset {
16566                return Ok(());
16567            }
16568
16569            // Decode unknown envelopes for gaps in ordinals.
16570            while _next_ordinal_to_read < 4 {
16571                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16572                _next_ordinal_to_read += 1;
16573                next_offset += envelope_size;
16574            }
16575
16576            let next_out_of_line = decoder.next_out_of_line();
16577            let handles_before = decoder.remaining_handles();
16578            if let Some((inlined, num_bytes, num_handles)) =
16579                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16580            {
16581                let member_inline_size =
16582                    <fidl_fuchsia_mem::Data as fidl::encoding::TypeMarker>::inline_size(
16583                        decoder.context,
16584                    );
16585                if inlined != (member_inline_size <= 4) {
16586                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16587                }
16588                let inner_offset;
16589                let mut inner_depth = depth.clone();
16590                if inlined {
16591                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16592                    inner_offset = next_offset;
16593                } else {
16594                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16595                    inner_depth.increment()?;
16596                }
16597                let val_ref = self.explicit_sites_filter_error_page.get_or_insert_with(|| {
16598                    fidl::new_empty!(
16599                        fidl_fuchsia_mem::Data,
16600                        fidl::encoding::DefaultFuchsiaResourceDialect
16601                    )
16602                });
16603                fidl::decode!(
16604                    fidl_fuchsia_mem::Data,
16605                    fidl::encoding::DefaultFuchsiaResourceDialect,
16606                    val_ref,
16607                    decoder,
16608                    inner_offset,
16609                    inner_depth
16610                )?;
16611                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16612                {
16613                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16614                }
16615                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16616                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16617                }
16618            }
16619
16620            next_offset += envelope_size;
16621
16622            // Decode the remaining unknown envelopes.
16623            while next_offset < end_offset {
16624                _next_ordinal_to_read += 1;
16625                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16626                next_offset += envelope_size;
16627            }
16628
16629            Ok(())
16630        }
16631    }
16632
16633    impl CreateView2Args {
16634        #[inline(always)]
16635        fn max_ordinal_present(&self) -> u64 {
16636            if let Some(_) = self.view_creation_token {
16637                return 1;
16638            }
16639            0
16640        }
16641    }
16642
16643    impl fidl::encoding::ResourceTypeMarker for CreateView2Args {
16644        type Borrowed<'a> = &'a mut Self;
16645        fn take_or_borrow<'a>(
16646            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16647        ) -> Self::Borrowed<'a> {
16648            value
16649        }
16650    }
16651
16652    unsafe impl fidl::encoding::TypeMarker for CreateView2Args {
16653        type Owned = Self;
16654
16655        #[inline(always)]
16656        fn inline_align(_context: fidl::encoding::Context) -> usize {
16657            8
16658        }
16659
16660        #[inline(always)]
16661        fn inline_size(_context: fidl::encoding::Context) -> usize {
16662            16
16663        }
16664    }
16665
16666    unsafe impl
16667        fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>
16668        for &mut CreateView2Args
16669    {
16670        unsafe fn encode(
16671            self,
16672            encoder: &mut fidl::encoding::Encoder<
16673                '_,
16674                fidl::encoding::DefaultFuchsiaResourceDialect,
16675            >,
16676            offset: usize,
16677            mut depth: fidl::encoding::Depth,
16678        ) -> fidl::Result<()> {
16679            encoder.debug_check_bounds::<CreateView2Args>(offset);
16680            // Vector header
16681            let max_ordinal: u64 = self.max_ordinal_present();
16682            encoder.write_num(max_ordinal, offset);
16683            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16684            // Calling encoder.out_of_line_offset(0) is not allowed.
16685            if max_ordinal == 0 {
16686                return Ok(());
16687            }
16688            depth.increment()?;
16689            let envelope_size = 8;
16690            let bytes_len = max_ordinal as usize * envelope_size;
16691            #[allow(unused_variables)]
16692            let offset = encoder.out_of_line_offset(bytes_len);
16693            let mut _prev_end_offset: usize = 0;
16694            if 1 > max_ordinal {
16695                return Ok(());
16696            }
16697
16698            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16699            // are envelope_size bytes.
16700            let cur_offset: usize = (1 - 1) * envelope_size;
16701
16702            // Zero reserved fields.
16703            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16704
16705            // Safety:
16706            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16707            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16708            //   envelope_size bytes, there is always sufficient room.
16709            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
16710            self.view_creation_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16711            encoder, offset + cur_offset, depth
16712        )?;
16713
16714            _prev_end_offset = cur_offset + envelope_size;
16715
16716            Ok(())
16717        }
16718    }
16719
16720    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16721        for CreateView2Args
16722    {
16723        #[inline(always)]
16724        fn new_empty() -> Self {
16725            Self::default()
16726        }
16727
16728        unsafe fn decode(
16729            &mut self,
16730            decoder: &mut fidl::encoding::Decoder<
16731                '_,
16732                fidl::encoding::DefaultFuchsiaResourceDialect,
16733            >,
16734            offset: usize,
16735            mut depth: fidl::encoding::Depth,
16736        ) -> fidl::Result<()> {
16737            decoder.debug_check_bounds::<Self>(offset);
16738            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16739                None => return Err(fidl::Error::NotNullable),
16740                Some(len) => len,
16741            };
16742            // Calling decoder.out_of_line_offset(0) is not allowed.
16743            if len == 0 {
16744                return Ok(());
16745            };
16746            depth.increment()?;
16747            let envelope_size = 8;
16748            let bytes_len = len * envelope_size;
16749            let offset = decoder.out_of_line_offset(bytes_len)?;
16750            // Decode the envelope for each type.
16751            let mut _next_ordinal_to_read = 0;
16752            let mut next_offset = offset;
16753            let end_offset = offset + bytes_len;
16754            _next_ordinal_to_read += 1;
16755            if next_offset >= end_offset {
16756                return Ok(());
16757            }
16758
16759            // Decode unknown envelopes for gaps in ordinals.
16760            while _next_ordinal_to_read < 1 {
16761                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16762                _next_ordinal_to_read += 1;
16763                next_offset += envelope_size;
16764            }
16765
16766            let next_out_of_line = decoder.next_out_of_line();
16767            let handles_before = decoder.remaining_handles();
16768            if let Some((inlined, num_bytes, num_handles)) =
16769                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16770            {
16771                let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16772                if inlined != (member_inline_size <= 4) {
16773                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16774                }
16775                let inner_offset;
16776                let mut inner_depth = depth.clone();
16777                if inlined {
16778                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16779                    inner_offset = next_offset;
16780                } else {
16781                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16782                    inner_depth.increment()?;
16783                }
16784                let val_ref = self.view_creation_token.get_or_insert_with(|| {
16785                    fidl::new_empty!(
16786                        fidl_fuchsia_ui_views::ViewCreationToken,
16787                        fidl::encoding::DefaultFuchsiaResourceDialect
16788                    )
16789                });
16790                fidl::decode!(
16791                    fidl_fuchsia_ui_views::ViewCreationToken,
16792                    fidl::encoding::DefaultFuchsiaResourceDialect,
16793                    val_ref,
16794                    decoder,
16795                    inner_offset,
16796                    inner_depth
16797                )?;
16798                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16799                {
16800                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16801                }
16802                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16803                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16804                }
16805            }
16806
16807            next_offset += envelope_size;
16808
16809            // Decode the remaining unknown envelopes.
16810            while next_offset < end_offset {
16811                _next_ordinal_to_read += 1;
16812                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16813                next_offset += envelope_size;
16814            }
16815
16816            Ok(())
16817        }
16818    }
16819
16820    impl Favicon {
16821        #[inline(always)]
16822        fn max_ordinal_present(&self) -> u64 {
16823            if let Some(_) = self.height {
16824                return 3;
16825            }
16826            if let Some(_) = self.width {
16827                return 2;
16828            }
16829            if let Some(_) = self.data {
16830                return 1;
16831            }
16832            0
16833        }
16834    }
16835
16836    impl fidl::encoding::ResourceTypeMarker for Favicon {
16837        type Borrowed<'a> = &'a mut Self;
16838        fn take_or_borrow<'a>(
16839            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16840        ) -> Self::Borrowed<'a> {
16841            value
16842        }
16843    }
16844
16845    unsafe impl fidl::encoding::TypeMarker for Favicon {
16846        type Owned = Self;
16847
16848        #[inline(always)]
16849        fn inline_align(_context: fidl::encoding::Context) -> usize {
16850            8
16851        }
16852
16853        #[inline(always)]
16854        fn inline_size(_context: fidl::encoding::Context) -> usize {
16855            16
16856        }
16857    }
16858
16859    unsafe impl fidl::encoding::Encode<Favicon, fidl::encoding::DefaultFuchsiaResourceDialect>
16860        for &mut Favicon
16861    {
16862        unsafe fn encode(
16863            self,
16864            encoder: &mut fidl::encoding::Encoder<
16865                '_,
16866                fidl::encoding::DefaultFuchsiaResourceDialect,
16867            >,
16868            offset: usize,
16869            mut depth: fidl::encoding::Depth,
16870        ) -> fidl::Result<()> {
16871            encoder.debug_check_bounds::<Favicon>(offset);
16872            // Vector header
16873            let max_ordinal: u64 = self.max_ordinal_present();
16874            encoder.write_num(max_ordinal, offset);
16875            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16876            // Calling encoder.out_of_line_offset(0) is not allowed.
16877            if max_ordinal == 0 {
16878                return Ok(());
16879            }
16880            depth.increment()?;
16881            let envelope_size = 8;
16882            let bytes_len = max_ordinal as usize * envelope_size;
16883            #[allow(unused_variables)]
16884            let offset = encoder.out_of_line_offset(bytes_len);
16885            let mut _prev_end_offset: usize = 0;
16886            if 1 > max_ordinal {
16887                return Ok(());
16888            }
16889
16890            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16891            // are envelope_size bytes.
16892            let cur_offset: usize = (1 - 1) * envelope_size;
16893
16894            // Zero reserved fields.
16895            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16896
16897            // Safety:
16898            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16899            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16900            //   envelope_size bytes, there is always sufficient room.
16901            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
16902            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16903            encoder, offset + cur_offset, depth
16904        )?;
16905
16906            _prev_end_offset = cur_offset + envelope_size;
16907            if 2 > max_ordinal {
16908                return Ok(());
16909            }
16910
16911            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16912            // are envelope_size bytes.
16913            let cur_offset: usize = (2 - 1) * envelope_size;
16914
16915            // Zero reserved fields.
16916            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16917
16918            // Safety:
16919            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16920            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16921            //   envelope_size bytes, there is always sufficient room.
16922            fidl::encoding::encode_in_envelope_optional::<
16923                u32,
16924                fidl::encoding::DefaultFuchsiaResourceDialect,
16925            >(
16926                self.width.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16927                encoder,
16928                offset + cur_offset,
16929                depth,
16930            )?;
16931
16932            _prev_end_offset = cur_offset + envelope_size;
16933            if 3 > max_ordinal {
16934                return Ok(());
16935            }
16936
16937            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16938            // are envelope_size bytes.
16939            let cur_offset: usize = (3 - 1) * envelope_size;
16940
16941            // Zero reserved fields.
16942            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16943
16944            // Safety:
16945            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16946            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16947            //   envelope_size bytes, there is always sufficient room.
16948            fidl::encoding::encode_in_envelope_optional::<
16949                u32,
16950                fidl::encoding::DefaultFuchsiaResourceDialect,
16951            >(
16952                self.height.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16953                encoder,
16954                offset + cur_offset,
16955                depth,
16956            )?;
16957
16958            _prev_end_offset = cur_offset + envelope_size;
16959
16960            Ok(())
16961        }
16962    }
16963
16964    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Favicon {
16965        #[inline(always)]
16966        fn new_empty() -> Self {
16967            Self::default()
16968        }
16969
16970        unsafe fn decode(
16971            &mut self,
16972            decoder: &mut fidl::encoding::Decoder<
16973                '_,
16974                fidl::encoding::DefaultFuchsiaResourceDialect,
16975            >,
16976            offset: usize,
16977            mut depth: fidl::encoding::Depth,
16978        ) -> fidl::Result<()> {
16979            decoder.debug_check_bounds::<Self>(offset);
16980            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16981                None => return Err(fidl::Error::NotNullable),
16982                Some(len) => len,
16983            };
16984            // Calling decoder.out_of_line_offset(0) is not allowed.
16985            if len == 0 {
16986                return Ok(());
16987            };
16988            depth.increment()?;
16989            let envelope_size = 8;
16990            let bytes_len = len * envelope_size;
16991            let offset = decoder.out_of_line_offset(bytes_len)?;
16992            // Decode the envelope for each type.
16993            let mut _next_ordinal_to_read = 0;
16994            let mut next_offset = offset;
16995            let end_offset = offset + bytes_len;
16996            _next_ordinal_to_read += 1;
16997            if next_offset >= end_offset {
16998                return Ok(());
16999            }
17000
17001            // Decode unknown envelopes for gaps in ordinals.
17002            while _next_ordinal_to_read < 1 {
17003                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17004                _next_ordinal_to_read += 1;
17005                next_offset += envelope_size;
17006            }
17007
17008            let next_out_of_line = decoder.next_out_of_line();
17009            let handles_before = decoder.remaining_handles();
17010            if let Some((inlined, num_bytes, num_handles)) =
17011                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17012            {
17013                let member_inline_size =
17014                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
17015                        decoder.context,
17016                    );
17017                if inlined != (member_inline_size <= 4) {
17018                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17019                }
17020                let inner_offset;
17021                let mut inner_depth = depth.clone();
17022                if inlined {
17023                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17024                    inner_offset = next_offset;
17025                } else {
17026                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17027                    inner_depth.increment()?;
17028                }
17029                let val_ref = self.data.get_or_insert_with(|| {
17030                    fidl::new_empty!(
17031                        fidl_fuchsia_mem::Buffer,
17032                        fidl::encoding::DefaultFuchsiaResourceDialect
17033                    )
17034                });
17035                fidl::decode!(
17036                    fidl_fuchsia_mem::Buffer,
17037                    fidl::encoding::DefaultFuchsiaResourceDialect,
17038                    val_ref,
17039                    decoder,
17040                    inner_offset,
17041                    inner_depth
17042                )?;
17043                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17044                {
17045                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17046                }
17047                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17048                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17049                }
17050            }
17051
17052            next_offset += envelope_size;
17053            _next_ordinal_to_read += 1;
17054            if next_offset >= end_offset {
17055                return Ok(());
17056            }
17057
17058            // Decode unknown envelopes for gaps in ordinals.
17059            while _next_ordinal_to_read < 2 {
17060                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17061                _next_ordinal_to_read += 1;
17062                next_offset += envelope_size;
17063            }
17064
17065            let next_out_of_line = decoder.next_out_of_line();
17066            let handles_before = decoder.remaining_handles();
17067            if let Some((inlined, num_bytes, num_handles)) =
17068                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17069            {
17070                let member_inline_size =
17071                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17072                if inlined != (member_inline_size <= 4) {
17073                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17074                }
17075                let inner_offset;
17076                let mut inner_depth = depth.clone();
17077                if inlined {
17078                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17079                    inner_offset = next_offset;
17080                } else {
17081                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17082                    inner_depth.increment()?;
17083                }
17084                let val_ref = self.width.get_or_insert_with(|| {
17085                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17086                });
17087                fidl::decode!(
17088                    u32,
17089                    fidl::encoding::DefaultFuchsiaResourceDialect,
17090                    val_ref,
17091                    decoder,
17092                    inner_offset,
17093                    inner_depth
17094                )?;
17095                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17096                {
17097                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17098                }
17099                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17100                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17101                }
17102            }
17103
17104            next_offset += envelope_size;
17105            _next_ordinal_to_read += 1;
17106            if next_offset >= end_offset {
17107                return Ok(());
17108            }
17109
17110            // Decode unknown envelopes for gaps in ordinals.
17111            while _next_ordinal_to_read < 3 {
17112                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17113                _next_ordinal_to_read += 1;
17114                next_offset += envelope_size;
17115            }
17116
17117            let next_out_of_line = decoder.next_out_of_line();
17118            let handles_before = decoder.remaining_handles();
17119            if let Some((inlined, num_bytes, num_handles)) =
17120                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17121            {
17122                let member_inline_size =
17123                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17124                if inlined != (member_inline_size <= 4) {
17125                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17126                }
17127                let inner_offset;
17128                let mut inner_depth = depth.clone();
17129                if inlined {
17130                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17131                    inner_offset = next_offset;
17132                } else {
17133                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17134                    inner_depth.increment()?;
17135                }
17136                let val_ref = self.height.get_or_insert_with(|| {
17137                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17138                });
17139                fidl::decode!(
17140                    u32,
17141                    fidl::encoding::DefaultFuchsiaResourceDialect,
17142                    val_ref,
17143                    decoder,
17144                    inner_offset,
17145                    inner_depth
17146                )?;
17147                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17148                {
17149                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17150                }
17151                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17152                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17153                }
17154            }
17155
17156            next_offset += envelope_size;
17157
17158            // Decode the remaining unknown envelopes.
17159            while next_offset < end_offset {
17160                _next_ordinal_to_read += 1;
17161                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17162                next_offset += envelope_size;
17163            }
17164
17165            Ok(())
17166        }
17167    }
17168
17169    impl LoadUrlParams {
17170        #[inline(always)]
17171        fn max_ordinal_present(&self) -> u64 {
17172            if let Some(_) = self.headers {
17173                return 4;
17174            }
17175            if let Some(_) = self.was_user_activated {
17176                return 3;
17177            }
17178            if let Some(_) = self.referrer_url {
17179                return 2;
17180            }
17181            if let Some(_) = self.type_ {
17182                return 1;
17183            }
17184            0
17185        }
17186    }
17187
17188    impl fidl::encoding::ResourceTypeMarker for LoadUrlParams {
17189        type Borrowed<'a> = &'a mut Self;
17190        fn take_or_borrow<'a>(
17191            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17192        ) -> Self::Borrowed<'a> {
17193            value
17194        }
17195    }
17196
17197    unsafe impl fidl::encoding::TypeMarker for LoadUrlParams {
17198        type Owned = Self;
17199
17200        #[inline(always)]
17201        fn inline_align(_context: fidl::encoding::Context) -> usize {
17202            8
17203        }
17204
17205        #[inline(always)]
17206        fn inline_size(_context: fidl::encoding::Context) -> usize {
17207            16
17208        }
17209    }
17210
17211    unsafe impl fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>
17212        for &mut LoadUrlParams
17213    {
17214        unsafe fn encode(
17215            self,
17216            encoder: &mut fidl::encoding::Encoder<
17217                '_,
17218                fidl::encoding::DefaultFuchsiaResourceDialect,
17219            >,
17220            offset: usize,
17221            mut depth: fidl::encoding::Depth,
17222        ) -> fidl::Result<()> {
17223            encoder.debug_check_bounds::<LoadUrlParams>(offset);
17224            // Vector header
17225            let max_ordinal: u64 = self.max_ordinal_present();
17226            encoder.write_num(max_ordinal, offset);
17227            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17228            // Calling encoder.out_of_line_offset(0) is not allowed.
17229            if max_ordinal == 0 {
17230                return Ok(());
17231            }
17232            depth.increment()?;
17233            let envelope_size = 8;
17234            let bytes_len = max_ordinal as usize * envelope_size;
17235            #[allow(unused_variables)]
17236            let offset = encoder.out_of_line_offset(bytes_len);
17237            let mut _prev_end_offset: usize = 0;
17238            if 1 > max_ordinal {
17239                return Ok(());
17240            }
17241
17242            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17243            // are envelope_size bytes.
17244            let cur_offset: usize = (1 - 1) * envelope_size;
17245
17246            // Zero reserved fields.
17247            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17248
17249            // Safety:
17250            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17251            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17252            //   envelope_size bytes, there is always sufficient room.
17253            fidl::encoding::encode_in_envelope_optional::<
17254                LoadUrlReason,
17255                fidl::encoding::DefaultFuchsiaResourceDialect,
17256            >(
17257                self.type_.as_ref().map(<LoadUrlReason as fidl::encoding::ValueTypeMarker>::borrow),
17258                encoder,
17259                offset + cur_offset,
17260                depth,
17261            )?;
17262
17263            _prev_end_offset = cur_offset + envelope_size;
17264            if 2 > max_ordinal {
17265                return Ok(());
17266            }
17267
17268            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17269            // are envelope_size bytes.
17270            let cur_offset: usize = (2 - 1) * envelope_size;
17271
17272            // Zero reserved fields.
17273            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17274
17275            // Safety:
17276            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17277            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17278            //   envelope_size bytes, there is always sufficient room.
17279            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17280            self.referrer_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17281            encoder, offset + cur_offset, depth
17282        )?;
17283
17284            _prev_end_offset = cur_offset + envelope_size;
17285            if 3 > max_ordinal {
17286                return Ok(());
17287            }
17288
17289            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17290            // are envelope_size bytes.
17291            let cur_offset: usize = (3 - 1) * envelope_size;
17292
17293            // Zero reserved fields.
17294            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17295
17296            // Safety:
17297            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17298            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17299            //   envelope_size bytes, there is always sufficient room.
17300            fidl::encoding::encode_in_envelope_optional::<
17301                bool,
17302                fidl::encoding::DefaultFuchsiaResourceDialect,
17303            >(
17304                self.was_user_activated
17305                    .as_ref()
17306                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17307                encoder,
17308                offset + cur_offset,
17309                depth,
17310            )?;
17311
17312            _prev_end_offset = cur_offset + envelope_size;
17313            if 4 > max_ordinal {
17314                return Ok(());
17315            }
17316
17317            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17318            // are envelope_size bytes.
17319            let cur_offset: usize = (4 - 1) * envelope_size;
17320
17321            // Zero reserved fields.
17322            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17323
17324            // Safety:
17325            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17326            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17327            //   envelope_size bytes, there is always sufficient room.
17328            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17329            self.headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header> as fidl::encoding::ValueTypeMarker>::borrow),
17330            encoder, offset + cur_offset, depth
17331        )?;
17332
17333            _prev_end_offset = cur_offset + envelope_size;
17334
17335            Ok(())
17336        }
17337    }
17338
17339    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LoadUrlParams {
17340        #[inline(always)]
17341        fn new_empty() -> Self {
17342            Self::default()
17343        }
17344
17345        unsafe fn decode(
17346            &mut self,
17347            decoder: &mut fidl::encoding::Decoder<
17348                '_,
17349                fidl::encoding::DefaultFuchsiaResourceDialect,
17350            >,
17351            offset: usize,
17352            mut depth: fidl::encoding::Depth,
17353        ) -> fidl::Result<()> {
17354            decoder.debug_check_bounds::<Self>(offset);
17355            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17356                None => return Err(fidl::Error::NotNullable),
17357                Some(len) => len,
17358            };
17359            // Calling decoder.out_of_line_offset(0) is not allowed.
17360            if len == 0 {
17361                return Ok(());
17362            };
17363            depth.increment()?;
17364            let envelope_size = 8;
17365            let bytes_len = len * envelope_size;
17366            let offset = decoder.out_of_line_offset(bytes_len)?;
17367            // Decode the envelope for each type.
17368            let mut _next_ordinal_to_read = 0;
17369            let mut next_offset = offset;
17370            let end_offset = offset + bytes_len;
17371            _next_ordinal_to_read += 1;
17372            if next_offset >= end_offset {
17373                return Ok(());
17374            }
17375
17376            // Decode unknown envelopes for gaps in ordinals.
17377            while _next_ordinal_to_read < 1 {
17378                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17379                _next_ordinal_to_read += 1;
17380                next_offset += envelope_size;
17381            }
17382
17383            let next_out_of_line = decoder.next_out_of_line();
17384            let handles_before = decoder.remaining_handles();
17385            if let Some((inlined, num_bytes, num_handles)) =
17386                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17387            {
17388                let member_inline_size =
17389                    <LoadUrlReason as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17390                if inlined != (member_inline_size <= 4) {
17391                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17392                }
17393                let inner_offset;
17394                let mut inner_depth = depth.clone();
17395                if inlined {
17396                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17397                    inner_offset = next_offset;
17398                } else {
17399                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17400                    inner_depth.increment()?;
17401                }
17402                let val_ref = self.type_.get_or_insert_with(|| {
17403                    fidl::new_empty!(LoadUrlReason, fidl::encoding::DefaultFuchsiaResourceDialect)
17404                });
17405                fidl::decode!(
17406                    LoadUrlReason,
17407                    fidl::encoding::DefaultFuchsiaResourceDialect,
17408                    val_ref,
17409                    decoder,
17410                    inner_offset,
17411                    inner_depth
17412                )?;
17413                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17414                {
17415                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17416                }
17417                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17418                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17419                }
17420            }
17421
17422            next_offset += envelope_size;
17423            _next_ordinal_to_read += 1;
17424            if next_offset >= end_offset {
17425                return Ok(());
17426            }
17427
17428            // Decode unknown envelopes for gaps in ordinals.
17429            while _next_ordinal_to_read < 2 {
17430                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17431                _next_ordinal_to_read += 1;
17432                next_offset += envelope_size;
17433            }
17434
17435            let next_out_of_line = decoder.next_out_of_line();
17436            let handles_before = decoder.remaining_handles();
17437            if let Some((inlined, num_bytes, num_handles)) =
17438                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17439            {
17440                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17441                if inlined != (member_inline_size <= 4) {
17442                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17443                }
17444                let inner_offset;
17445                let mut inner_depth = depth.clone();
17446                if inlined {
17447                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17448                    inner_offset = next_offset;
17449                } else {
17450                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17451                    inner_depth.increment()?;
17452                }
17453                let val_ref = self.referrer_url.get_or_insert_with(|| {
17454                    fidl::new_empty!(
17455                        fidl::encoding::BoundedString<65536>,
17456                        fidl::encoding::DefaultFuchsiaResourceDialect
17457                    )
17458                });
17459                fidl::decode!(
17460                    fidl::encoding::BoundedString<65536>,
17461                    fidl::encoding::DefaultFuchsiaResourceDialect,
17462                    val_ref,
17463                    decoder,
17464                    inner_offset,
17465                    inner_depth
17466                )?;
17467                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17468                {
17469                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17470                }
17471                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17472                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17473                }
17474            }
17475
17476            next_offset += envelope_size;
17477            _next_ordinal_to_read += 1;
17478            if next_offset >= end_offset {
17479                return Ok(());
17480            }
17481
17482            // Decode unknown envelopes for gaps in ordinals.
17483            while _next_ordinal_to_read < 3 {
17484                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17485                _next_ordinal_to_read += 1;
17486                next_offset += envelope_size;
17487            }
17488
17489            let next_out_of_line = decoder.next_out_of_line();
17490            let handles_before = decoder.remaining_handles();
17491            if let Some((inlined, num_bytes, num_handles)) =
17492                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17493            {
17494                let member_inline_size =
17495                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17496                if inlined != (member_inline_size <= 4) {
17497                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17498                }
17499                let inner_offset;
17500                let mut inner_depth = depth.clone();
17501                if inlined {
17502                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17503                    inner_offset = next_offset;
17504                } else {
17505                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17506                    inner_depth.increment()?;
17507                }
17508                let val_ref = self.was_user_activated.get_or_insert_with(|| {
17509                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
17510                });
17511                fidl::decode!(
17512                    bool,
17513                    fidl::encoding::DefaultFuchsiaResourceDialect,
17514                    val_ref,
17515                    decoder,
17516                    inner_offset,
17517                    inner_depth
17518                )?;
17519                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17520                {
17521                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17522                }
17523                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17524                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17525                }
17526            }
17527
17528            next_offset += envelope_size;
17529            _next_ordinal_to_read += 1;
17530            if next_offset >= end_offset {
17531                return Ok(());
17532            }
17533
17534            // Decode unknown envelopes for gaps in ordinals.
17535            while _next_ordinal_to_read < 4 {
17536                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17537                _next_ordinal_to_read += 1;
17538                next_offset += envelope_size;
17539            }
17540
17541            let next_out_of_line = decoder.next_out_of_line();
17542            let handles_before = decoder.remaining_handles();
17543            if let Some((inlined, num_bytes, num_handles)) =
17544                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17545            {
17546                let member_inline_size = <fidl::encoding::UnboundedVector<
17547                    fidl_fuchsia_net_http::Header,
17548                > as fidl::encoding::TypeMarker>::inline_size(
17549                    decoder.context
17550                );
17551                if inlined != (member_inline_size <= 4) {
17552                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17553                }
17554                let inner_offset;
17555                let mut inner_depth = depth.clone();
17556                if inlined {
17557                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17558                    inner_offset = next_offset;
17559                } else {
17560                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17561                    inner_depth.increment()?;
17562                }
17563                let val_ref = self.headers.get_or_insert_with(|| {
17564                    fidl::new_empty!(
17565                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17566                        fidl::encoding::DefaultFuchsiaResourceDialect
17567                    )
17568                });
17569                fidl::decode!(
17570                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17571                    fidl::encoding::DefaultFuchsiaResourceDialect,
17572                    val_ref,
17573                    decoder,
17574                    inner_offset,
17575                    inner_depth
17576                )?;
17577                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17578                {
17579                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17580                }
17581                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17582                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17583                }
17584            }
17585
17586            next_offset += envelope_size;
17587
17588            // Decode the remaining unknown envelopes.
17589            while next_offset < end_offset {
17590                _next_ordinal_to_read += 1;
17591                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17592                next_offset += envelope_size;
17593            }
17594
17595            Ok(())
17596        }
17597    }
17598
17599    impl NavigationState {
17600        #[inline(always)]
17601        fn max_ordinal_present(&self) -> u64 {
17602            if let Some(_) = self.error_detail {
17603                return 8;
17604            }
17605            if let Some(_) = self.favicon {
17606                return 7;
17607            }
17608            if let Some(_) = self.is_main_document_loaded {
17609                return 6;
17610            }
17611            if let Some(_) = self.can_go_back {
17612                return 5;
17613            }
17614            if let Some(_) = self.can_go_forward {
17615                return 4;
17616            }
17617            if let Some(_) = self.page_type {
17618                return 3;
17619            }
17620            if let Some(_) = self.title {
17621                return 2;
17622            }
17623            if let Some(_) = self.url {
17624                return 1;
17625            }
17626            0
17627        }
17628    }
17629
17630    impl fidl::encoding::ResourceTypeMarker for NavigationState {
17631        type Borrowed<'a> = &'a mut Self;
17632        fn take_or_borrow<'a>(
17633            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17634        ) -> Self::Borrowed<'a> {
17635            value
17636        }
17637    }
17638
17639    unsafe impl fidl::encoding::TypeMarker for NavigationState {
17640        type Owned = Self;
17641
17642        #[inline(always)]
17643        fn inline_align(_context: fidl::encoding::Context) -> usize {
17644            8
17645        }
17646
17647        #[inline(always)]
17648        fn inline_size(_context: fidl::encoding::Context) -> usize {
17649            16
17650        }
17651    }
17652
17653    unsafe impl
17654        fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>
17655        for &mut NavigationState
17656    {
17657        unsafe fn encode(
17658            self,
17659            encoder: &mut fidl::encoding::Encoder<
17660                '_,
17661                fidl::encoding::DefaultFuchsiaResourceDialect,
17662            >,
17663            offset: usize,
17664            mut depth: fidl::encoding::Depth,
17665        ) -> fidl::Result<()> {
17666            encoder.debug_check_bounds::<NavigationState>(offset);
17667            // Vector header
17668            let max_ordinal: u64 = self.max_ordinal_present();
17669            encoder.write_num(max_ordinal, offset);
17670            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17671            // Calling encoder.out_of_line_offset(0) is not allowed.
17672            if max_ordinal == 0 {
17673                return Ok(());
17674            }
17675            depth.increment()?;
17676            let envelope_size = 8;
17677            let bytes_len = max_ordinal as usize * envelope_size;
17678            #[allow(unused_variables)]
17679            let offset = encoder.out_of_line_offset(bytes_len);
17680            let mut _prev_end_offset: usize = 0;
17681            if 1 > max_ordinal {
17682                return Ok(());
17683            }
17684
17685            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17686            // are envelope_size bytes.
17687            let cur_offset: usize = (1 - 1) * envelope_size;
17688
17689            // Zero reserved fields.
17690            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17691
17692            // Safety:
17693            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17694            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17695            //   envelope_size bytes, there is always sufficient room.
17696            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17697            self.url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17698            encoder, offset + cur_offset, depth
17699        )?;
17700
17701            _prev_end_offset = cur_offset + envelope_size;
17702            if 2 > max_ordinal {
17703                return Ok(());
17704            }
17705
17706            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17707            // are envelope_size bytes.
17708            let cur_offset: usize = (2 - 1) * envelope_size;
17709
17710            // Zero reserved fields.
17711            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17712
17713            // Safety:
17714            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17715            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17716            //   envelope_size bytes, there is always sufficient room.
17717            fidl::encoding::encode_in_envelope_optional::<
17718                fidl::encoding::UnboundedString,
17719                fidl::encoding::DefaultFuchsiaResourceDialect,
17720            >(
17721                self.title.as_ref().map(
17722                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
17723                ),
17724                encoder,
17725                offset + cur_offset,
17726                depth,
17727            )?;
17728
17729            _prev_end_offset = cur_offset + envelope_size;
17730            if 3 > max_ordinal {
17731                return Ok(());
17732            }
17733
17734            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17735            // are envelope_size bytes.
17736            let cur_offset: usize = (3 - 1) * envelope_size;
17737
17738            // Zero reserved fields.
17739            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17740
17741            // Safety:
17742            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17743            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17744            //   envelope_size bytes, there is always sufficient room.
17745            fidl::encoding::encode_in_envelope_optional::<
17746                PageType,
17747                fidl::encoding::DefaultFuchsiaResourceDialect,
17748            >(
17749                self.page_type.as_ref().map(<PageType as fidl::encoding::ValueTypeMarker>::borrow),
17750                encoder,
17751                offset + cur_offset,
17752                depth,
17753            )?;
17754
17755            _prev_end_offset = cur_offset + envelope_size;
17756            if 4 > max_ordinal {
17757                return Ok(());
17758            }
17759
17760            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17761            // are envelope_size bytes.
17762            let cur_offset: usize = (4 - 1) * envelope_size;
17763
17764            // Zero reserved fields.
17765            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17766
17767            // Safety:
17768            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17769            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17770            //   envelope_size bytes, there is always sufficient room.
17771            fidl::encoding::encode_in_envelope_optional::<
17772                bool,
17773                fidl::encoding::DefaultFuchsiaResourceDialect,
17774            >(
17775                self.can_go_forward.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17776                encoder,
17777                offset + cur_offset,
17778                depth,
17779            )?;
17780
17781            _prev_end_offset = cur_offset + envelope_size;
17782            if 5 > max_ordinal {
17783                return Ok(());
17784            }
17785
17786            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17787            // are envelope_size bytes.
17788            let cur_offset: usize = (5 - 1) * envelope_size;
17789
17790            // Zero reserved fields.
17791            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17792
17793            // Safety:
17794            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17795            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17796            //   envelope_size bytes, there is always sufficient room.
17797            fidl::encoding::encode_in_envelope_optional::<
17798                bool,
17799                fidl::encoding::DefaultFuchsiaResourceDialect,
17800            >(
17801                self.can_go_back.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17802                encoder,
17803                offset + cur_offset,
17804                depth,
17805            )?;
17806
17807            _prev_end_offset = cur_offset + envelope_size;
17808            if 6 > max_ordinal {
17809                return Ok(());
17810            }
17811
17812            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17813            // are envelope_size bytes.
17814            let cur_offset: usize = (6 - 1) * envelope_size;
17815
17816            // Zero reserved fields.
17817            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17818
17819            // Safety:
17820            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17821            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17822            //   envelope_size bytes, there is always sufficient room.
17823            fidl::encoding::encode_in_envelope_optional::<
17824                bool,
17825                fidl::encoding::DefaultFuchsiaResourceDialect,
17826            >(
17827                self.is_main_document_loaded
17828                    .as_ref()
17829                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17830                encoder,
17831                offset + cur_offset,
17832                depth,
17833            )?;
17834
17835            _prev_end_offset = cur_offset + envelope_size;
17836            if 7 > max_ordinal {
17837                return Ok(());
17838            }
17839
17840            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17841            // are envelope_size bytes.
17842            let cur_offset: usize = (7 - 1) * envelope_size;
17843
17844            // Zero reserved fields.
17845            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17846
17847            // Safety:
17848            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17849            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17850            //   envelope_size bytes, there is always sufficient room.
17851            fidl::encoding::encode_in_envelope_optional::<
17852                Favicon,
17853                fidl::encoding::DefaultFuchsiaResourceDialect,
17854            >(
17855                self.favicon
17856                    .as_mut()
17857                    .map(<Favicon as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17858                encoder,
17859                offset + cur_offset,
17860                depth,
17861            )?;
17862
17863            _prev_end_offset = cur_offset + envelope_size;
17864            if 8 > max_ordinal {
17865                return Ok(());
17866            }
17867
17868            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17869            // are envelope_size bytes.
17870            let cur_offset: usize = (8 - 1) * envelope_size;
17871
17872            // Zero reserved fields.
17873            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17874
17875            // Safety:
17876            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17877            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17878            //   envelope_size bytes, there is always sufficient room.
17879            fidl::encoding::encode_in_envelope_optional::<
17880                ErrorDetail,
17881                fidl::encoding::DefaultFuchsiaResourceDialect,
17882            >(
17883                self.error_detail
17884                    .as_ref()
17885                    .map(<ErrorDetail as fidl::encoding::ValueTypeMarker>::borrow),
17886                encoder,
17887                offset + cur_offset,
17888                depth,
17889            )?;
17890
17891            _prev_end_offset = cur_offset + envelope_size;
17892
17893            Ok(())
17894        }
17895    }
17896
17897    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17898        for NavigationState
17899    {
17900        #[inline(always)]
17901        fn new_empty() -> Self {
17902            Self::default()
17903        }
17904
17905        unsafe fn decode(
17906            &mut self,
17907            decoder: &mut fidl::encoding::Decoder<
17908                '_,
17909                fidl::encoding::DefaultFuchsiaResourceDialect,
17910            >,
17911            offset: usize,
17912            mut depth: fidl::encoding::Depth,
17913        ) -> fidl::Result<()> {
17914            decoder.debug_check_bounds::<Self>(offset);
17915            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17916                None => return Err(fidl::Error::NotNullable),
17917                Some(len) => len,
17918            };
17919            // Calling decoder.out_of_line_offset(0) is not allowed.
17920            if len == 0 {
17921                return Ok(());
17922            };
17923            depth.increment()?;
17924            let envelope_size = 8;
17925            let bytes_len = len * envelope_size;
17926            let offset = decoder.out_of_line_offset(bytes_len)?;
17927            // Decode the envelope for each type.
17928            let mut _next_ordinal_to_read = 0;
17929            let mut next_offset = offset;
17930            let end_offset = offset + bytes_len;
17931            _next_ordinal_to_read += 1;
17932            if next_offset >= end_offset {
17933                return Ok(());
17934            }
17935
17936            // Decode unknown envelopes for gaps in ordinals.
17937            while _next_ordinal_to_read < 1 {
17938                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17939                _next_ordinal_to_read += 1;
17940                next_offset += envelope_size;
17941            }
17942
17943            let next_out_of_line = decoder.next_out_of_line();
17944            let handles_before = decoder.remaining_handles();
17945            if let Some((inlined, num_bytes, num_handles)) =
17946                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17947            {
17948                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17949                if inlined != (member_inline_size <= 4) {
17950                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17951                }
17952                let inner_offset;
17953                let mut inner_depth = depth.clone();
17954                if inlined {
17955                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17956                    inner_offset = next_offset;
17957                } else {
17958                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17959                    inner_depth.increment()?;
17960                }
17961                let val_ref = self.url.get_or_insert_with(|| {
17962                    fidl::new_empty!(
17963                        fidl::encoding::BoundedString<65536>,
17964                        fidl::encoding::DefaultFuchsiaResourceDialect
17965                    )
17966                });
17967                fidl::decode!(
17968                    fidl::encoding::BoundedString<65536>,
17969                    fidl::encoding::DefaultFuchsiaResourceDialect,
17970                    val_ref,
17971                    decoder,
17972                    inner_offset,
17973                    inner_depth
17974                )?;
17975                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17976                {
17977                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17978                }
17979                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17980                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17981                }
17982            }
17983
17984            next_offset += envelope_size;
17985            _next_ordinal_to_read += 1;
17986            if next_offset >= end_offset {
17987                return Ok(());
17988            }
17989
17990            // Decode unknown envelopes for gaps in ordinals.
17991            while _next_ordinal_to_read < 2 {
17992                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17993                _next_ordinal_to_read += 1;
17994                next_offset += envelope_size;
17995            }
17996
17997            let next_out_of_line = decoder.next_out_of_line();
17998            let handles_before = decoder.remaining_handles();
17999            if let Some((inlined, num_bytes, num_handles)) =
18000                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18001            {
18002                let member_inline_size =
18003                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
18004                        decoder.context,
18005                    );
18006                if inlined != (member_inline_size <= 4) {
18007                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18008                }
18009                let inner_offset;
18010                let mut inner_depth = depth.clone();
18011                if inlined {
18012                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18013                    inner_offset = next_offset;
18014                } else {
18015                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18016                    inner_depth.increment()?;
18017                }
18018                let val_ref = self.title.get_or_insert_with(|| {
18019                    fidl::new_empty!(
18020                        fidl::encoding::UnboundedString,
18021                        fidl::encoding::DefaultFuchsiaResourceDialect
18022                    )
18023                });
18024                fidl::decode!(
18025                    fidl::encoding::UnboundedString,
18026                    fidl::encoding::DefaultFuchsiaResourceDialect,
18027                    val_ref,
18028                    decoder,
18029                    inner_offset,
18030                    inner_depth
18031                )?;
18032                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18033                {
18034                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18035                }
18036                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18037                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18038                }
18039            }
18040
18041            next_offset += envelope_size;
18042            _next_ordinal_to_read += 1;
18043            if next_offset >= end_offset {
18044                return Ok(());
18045            }
18046
18047            // Decode unknown envelopes for gaps in ordinals.
18048            while _next_ordinal_to_read < 3 {
18049                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18050                _next_ordinal_to_read += 1;
18051                next_offset += envelope_size;
18052            }
18053
18054            let next_out_of_line = decoder.next_out_of_line();
18055            let handles_before = decoder.remaining_handles();
18056            if let Some((inlined, num_bytes, num_handles)) =
18057                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18058            {
18059                let member_inline_size =
18060                    <PageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18061                if inlined != (member_inline_size <= 4) {
18062                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18063                }
18064                let inner_offset;
18065                let mut inner_depth = depth.clone();
18066                if inlined {
18067                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18068                    inner_offset = next_offset;
18069                } else {
18070                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18071                    inner_depth.increment()?;
18072                }
18073                let val_ref = self.page_type.get_or_insert_with(|| {
18074                    fidl::new_empty!(PageType, fidl::encoding::DefaultFuchsiaResourceDialect)
18075                });
18076                fidl::decode!(
18077                    PageType,
18078                    fidl::encoding::DefaultFuchsiaResourceDialect,
18079                    val_ref,
18080                    decoder,
18081                    inner_offset,
18082                    inner_depth
18083                )?;
18084                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18085                {
18086                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18087                }
18088                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18089                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18090                }
18091            }
18092
18093            next_offset += envelope_size;
18094            _next_ordinal_to_read += 1;
18095            if next_offset >= end_offset {
18096                return Ok(());
18097            }
18098
18099            // Decode unknown envelopes for gaps in ordinals.
18100            while _next_ordinal_to_read < 4 {
18101                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18102                _next_ordinal_to_read += 1;
18103                next_offset += envelope_size;
18104            }
18105
18106            let next_out_of_line = decoder.next_out_of_line();
18107            let handles_before = decoder.remaining_handles();
18108            if let Some((inlined, num_bytes, num_handles)) =
18109                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18110            {
18111                let member_inline_size =
18112                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18113                if inlined != (member_inline_size <= 4) {
18114                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18115                }
18116                let inner_offset;
18117                let mut inner_depth = depth.clone();
18118                if inlined {
18119                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18120                    inner_offset = next_offset;
18121                } else {
18122                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18123                    inner_depth.increment()?;
18124                }
18125                let val_ref = self.can_go_forward.get_or_insert_with(|| {
18126                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18127                });
18128                fidl::decode!(
18129                    bool,
18130                    fidl::encoding::DefaultFuchsiaResourceDialect,
18131                    val_ref,
18132                    decoder,
18133                    inner_offset,
18134                    inner_depth
18135                )?;
18136                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18137                {
18138                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18139                }
18140                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18141                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18142                }
18143            }
18144
18145            next_offset += envelope_size;
18146            _next_ordinal_to_read += 1;
18147            if next_offset >= end_offset {
18148                return Ok(());
18149            }
18150
18151            // Decode unknown envelopes for gaps in ordinals.
18152            while _next_ordinal_to_read < 5 {
18153                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18154                _next_ordinal_to_read += 1;
18155                next_offset += envelope_size;
18156            }
18157
18158            let next_out_of_line = decoder.next_out_of_line();
18159            let handles_before = decoder.remaining_handles();
18160            if let Some((inlined, num_bytes, num_handles)) =
18161                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18162            {
18163                let member_inline_size =
18164                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18165                if inlined != (member_inline_size <= 4) {
18166                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18167                }
18168                let inner_offset;
18169                let mut inner_depth = depth.clone();
18170                if inlined {
18171                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18172                    inner_offset = next_offset;
18173                } else {
18174                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18175                    inner_depth.increment()?;
18176                }
18177                let val_ref = self.can_go_back.get_or_insert_with(|| {
18178                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18179                });
18180                fidl::decode!(
18181                    bool,
18182                    fidl::encoding::DefaultFuchsiaResourceDialect,
18183                    val_ref,
18184                    decoder,
18185                    inner_offset,
18186                    inner_depth
18187                )?;
18188                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18189                {
18190                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18191                }
18192                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18193                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18194                }
18195            }
18196
18197            next_offset += envelope_size;
18198            _next_ordinal_to_read += 1;
18199            if next_offset >= end_offset {
18200                return Ok(());
18201            }
18202
18203            // Decode unknown envelopes for gaps in ordinals.
18204            while _next_ordinal_to_read < 6 {
18205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18206                _next_ordinal_to_read += 1;
18207                next_offset += envelope_size;
18208            }
18209
18210            let next_out_of_line = decoder.next_out_of_line();
18211            let handles_before = decoder.remaining_handles();
18212            if let Some((inlined, num_bytes, num_handles)) =
18213                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18214            {
18215                let member_inline_size =
18216                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18217                if inlined != (member_inline_size <= 4) {
18218                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18219                }
18220                let inner_offset;
18221                let mut inner_depth = depth.clone();
18222                if inlined {
18223                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18224                    inner_offset = next_offset;
18225                } else {
18226                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18227                    inner_depth.increment()?;
18228                }
18229                let val_ref = self.is_main_document_loaded.get_or_insert_with(|| {
18230                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18231                });
18232                fidl::decode!(
18233                    bool,
18234                    fidl::encoding::DefaultFuchsiaResourceDialect,
18235                    val_ref,
18236                    decoder,
18237                    inner_offset,
18238                    inner_depth
18239                )?;
18240                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18241                {
18242                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18243                }
18244                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18245                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18246                }
18247            }
18248
18249            next_offset += envelope_size;
18250            _next_ordinal_to_read += 1;
18251            if next_offset >= end_offset {
18252                return Ok(());
18253            }
18254
18255            // Decode unknown envelopes for gaps in ordinals.
18256            while _next_ordinal_to_read < 7 {
18257                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18258                _next_ordinal_to_read += 1;
18259                next_offset += envelope_size;
18260            }
18261
18262            let next_out_of_line = decoder.next_out_of_line();
18263            let handles_before = decoder.remaining_handles();
18264            if let Some((inlined, num_bytes, num_handles)) =
18265                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18266            {
18267                let member_inline_size =
18268                    <Favicon as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18269                if inlined != (member_inline_size <= 4) {
18270                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18271                }
18272                let inner_offset;
18273                let mut inner_depth = depth.clone();
18274                if inlined {
18275                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18276                    inner_offset = next_offset;
18277                } else {
18278                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18279                    inner_depth.increment()?;
18280                }
18281                let val_ref = self.favicon.get_or_insert_with(|| {
18282                    fidl::new_empty!(Favicon, fidl::encoding::DefaultFuchsiaResourceDialect)
18283                });
18284                fidl::decode!(
18285                    Favicon,
18286                    fidl::encoding::DefaultFuchsiaResourceDialect,
18287                    val_ref,
18288                    decoder,
18289                    inner_offset,
18290                    inner_depth
18291                )?;
18292                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18293                {
18294                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18295                }
18296                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18297                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18298                }
18299            }
18300
18301            next_offset += envelope_size;
18302            _next_ordinal_to_read += 1;
18303            if next_offset >= end_offset {
18304                return Ok(());
18305            }
18306
18307            // Decode unknown envelopes for gaps in ordinals.
18308            while _next_ordinal_to_read < 8 {
18309                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18310                _next_ordinal_to_read += 1;
18311                next_offset += envelope_size;
18312            }
18313
18314            let next_out_of_line = decoder.next_out_of_line();
18315            let handles_before = decoder.remaining_handles();
18316            if let Some((inlined, num_bytes, num_handles)) =
18317                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18318            {
18319                let member_inline_size =
18320                    <ErrorDetail as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18321                if inlined != (member_inline_size <= 4) {
18322                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18323                }
18324                let inner_offset;
18325                let mut inner_depth = depth.clone();
18326                if inlined {
18327                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18328                    inner_offset = next_offset;
18329                } else {
18330                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18331                    inner_depth.increment()?;
18332                }
18333                let val_ref = self.error_detail.get_or_insert_with(|| {
18334                    fidl::new_empty!(ErrorDetail, fidl::encoding::DefaultFuchsiaResourceDialect)
18335                });
18336                fidl::decode!(
18337                    ErrorDetail,
18338                    fidl::encoding::DefaultFuchsiaResourceDialect,
18339                    val_ref,
18340                    decoder,
18341                    inner_offset,
18342                    inner_depth
18343                )?;
18344                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18345                {
18346                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18347                }
18348                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18349                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18350                }
18351            }
18352
18353            next_offset += envelope_size;
18354
18355            // Decode the remaining unknown envelopes.
18356            while next_offset < end_offset {
18357                _next_ordinal_to_read += 1;
18358                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18359                next_offset += envelope_size;
18360            }
18361
18362            Ok(())
18363        }
18364    }
18365
18366    impl PopupFrameCreationInfo {
18367        #[inline(always)]
18368        fn max_ordinal_present(&self) -> u64 {
18369            if let Some(_) = self.initiated_by_user {
18370                return 2;
18371            }
18372            if let Some(_) = self.initial_url {
18373                return 1;
18374            }
18375            0
18376        }
18377    }
18378
18379    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationInfo {
18380        type Borrowed<'a> = &'a mut Self;
18381        fn take_or_borrow<'a>(
18382            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18383        ) -> Self::Borrowed<'a> {
18384            value
18385        }
18386    }
18387
18388    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationInfo {
18389        type Owned = Self;
18390
18391        #[inline(always)]
18392        fn inline_align(_context: fidl::encoding::Context) -> usize {
18393            8
18394        }
18395
18396        #[inline(always)]
18397        fn inline_size(_context: fidl::encoding::Context) -> usize {
18398            16
18399        }
18400    }
18401
18402    unsafe impl
18403        fidl::encoding::Encode<
18404            PopupFrameCreationInfo,
18405            fidl::encoding::DefaultFuchsiaResourceDialect,
18406        > for &mut PopupFrameCreationInfo
18407    {
18408        unsafe fn encode(
18409            self,
18410            encoder: &mut fidl::encoding::Encoder<
18411                '_,
18412                fidl::encoding::DefaultFuchsiaResourceDialect,
18413            >,
18414            offset: usize,
18415            mut depth: fidl::encoding::Depth,
18416        ) -> fidl::Result<()> {
18417            encoder.debug_check_bounds::<PopupFrameCreationInfo>(offset);
18418            // Vector header
18419            let max_ordinal: u64 = self.max_ordinal_present();
18420            encoder.write_num(max_ordinal, offset);
18421            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18422            // Calling encoder.out_of_line_offset(0) is not allowed.
18423            if max_ordinal == 0 {
18424                return Ok(());
18425            }
18426            depth.increment()?;
18427            let envelope_size = 8;
18428            let bytes_len = max_ordinal as usize * envelope_size;
18429            #[allow(unused_variables)]
18430            let offset = encoder.out_of_line_offset(bytes_len);
18431            let mut _prev_end_offset: usize = 0;
18432            if 1 > max_ordinal {
18433                return Ok(());
18434            }
18435
18436            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18437            // are envelope_size bytes.
18438            let cur_offset: usize = (1 - 1) * envelope_size;
18439
18440            // Zero reserved fields.
18441            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18442
18443            // Safety:
18444            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18445            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18446            //   envelope_size bytes, there is always sufficient room.
18447            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18448            self.initial_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
18449            encoder, offset + cur_offset, depth
18450        )?;
18451
18452            _prev_end_offset = cur_offset + envelope_size;
18453            if 2 > max_ordinal {
18454                return Ok(());
18455            }
18456
18457            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18458            // are envelope_size bytes.
18459            let cur_offset: usize = (2 - 1) * envelope_size;
18460
18461            // Zero reserved fields.
18462            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18463
18464            // Safety:
18465            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18466            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18467            //   envelope_size bytes, there is always sufficient room.
18468            fidl::encoding::encode_in_envelope_optional::<
18469                bool,
18470                fidl::encoding::DefaultFuchsiaResourceDialect,
18471            >(
18472                self.initiated_by_user
18473                    .as_ref()
18474                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18475                encoder,
18476                offset + cur_offset,
18477                depth,
18478            )?;
18479
18480            _prev_end_offset = cur_offset + envelope_size;
18481
18482            Ok(())
18483        }
18484    }
18485
18486    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18487        for PopupFrameCreationInfo
18488    {
18489        #[inline(always)]
18490        fn new_empty() -> Self {
18491            Self::default()
18492        }
18493
18494        unsafe fn decode(
18495            &mut self,
18496            decoder: &mut fidl::encoding::Decoder<
18497                '_,
18498                fidl::encoding::DefaultFuchsiaResourceDialect,
18499            >,
18500            offset: usize,
18501            mut depth: fidl::encoding::Depth,
18502        ) -> fidl::Result<()> {
18503            decoder.debug_check_bounds::<Self>(offset);
18504            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18505                None => return Err(fidl::Error::NotNullable),
18506                Some(len) => len,
18507            };
18508            // Calling decoder.out_of_line_offset(0) is not allowed.
18509            if len == 0 {
18510                return Ok(());
18511            };
18512            depth.increment()?;
18513            let envelope_size = 8;
18514            let bytes_len = len * envelope_size;
18515            let offset = decoder.out_of_line_offset(bytes_len)?;
18516            // Decode the envelope for each type.
18517            let mut _next_ordinal_to_read = 0;
18518            let mut next_offset = offset;
18519            let end_offset = offset + bytes_len;
18520            _next_ordinal_to_read += 1;
18521            if next_offset >= end_offset {
18522                return Ok(());
18523            }
18524
18525            // Decode unknown envelopes for gaps in ordinals.
18526            while _next_ordinal_to_read < 1 {
18527                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18528                _next_ordinal_to_read += 1;
18529                next_offset += envelope_size;
18530            }
18531
18532            let next_out_of_line = decoder.next_out_of_line();
18533            let handles_before = decoder.remaining_handles();
18534            if let Some((inlined, num_bytes, num_handles)) =
18535                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18536            {
18537                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18538                if inlined != (member_inline_size <= 4) {
18539                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18540                }
18541                let inner_offset;
18542                let mut inner_depth = depth.clone();
18543                if inlined {
18544                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18545                    inner_offset = next_offset;
18546                } else {
18547                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18548                    inner_depth.increment()?;
18549                }
18550                let val_ref = self.initial_url.get_or_insert_with(|| {
18551                    fidl::new_empty!(
18552                        fidl::encoding::BoundedString<65536>,
18553                        fidl::encoding::DefaultFuchsiaResourceDialect
18554                    )
18555                });
18556                fidl::decode!(
18557                    fidl::encoding::BoundedString<65536>,
18558                    fidl::encoding::DefaultFuchsiaResourceDialect,
18559                    val_ref,
18560                    decoder,
18561                    inner_offset,
18562                    inner_depth
18563                )?;
18564                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18565                {
18566                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18567                }
18568                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18569                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18570                }
18571            }
18572
18573            next_offset += envelope_size;
18574            _next_ordinal_to_read += 1;
18575            if next_offset >= end_offset {
18576                return Ok(());
18577            }
18578
18579            // Decode unknown envelopes for gaps in ordinals.
18580            while _next_ordinal_to_read < 2 {
18581                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18582                _next_ordinal_to_read += 1;
18583                next_offset += envelope_size;
18584            }
18585
18586            let next_out_of_line = decoder.next_out_of_line();
18587            let handles_before = decoder.remaining_handles();
18588            if let Some((inlined, num_bytes, num_handles)) =
18589                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18590            {
18591                let member_inline_size =
18592                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18593                if inlined != (member_inline_size <= 4) {
18594                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18595                }
18596                let inner_offset;
18597                let mut inner_depth = depth.clone();
18598                if inlined {
18599                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18600                    inner_offset = next_offset;
18601                } else {
18602                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18603                    inner_depth.increment()?;
18604                }
18605                let val_ref = self.initiated_by_user.get_or_insert_with(|| {
18606                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18607                });
18608                fidl::decode!(
18609                    bool,
18610                    fidl::encoding::DefaultFuchsiaResourceDialect,
18611                    val_ref,
18612                    decoder,
18613                    inner_offset,
18614                    inner_depth
18615                )?;
18616                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18617                {
18618                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18619                }
18620                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18621                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18622                }
18623            }
18624
18625            next_offset += envelope_size;
18626
18627            // Decode the remaining unknown envelopes.
18628            while next_offset < end_offset {
18629                _next_ordinal_to_read += 1;
18630                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18631                next_offset += envelope_size;
18632            }
18633
18634            Ok(())
18635        }
18636    }
18637
18638    impl WebMessage {
18639        #[inline(always)]
18640        fn max_ordinal_present(&self) -> u64 {
18641            if let Some(_) = self.outgoing_transfer {
18642                return 3;
18643            }
18644            if let Some(_) = self.incoming_transfer {
18645                return 2;
18646            }
18647            if let Some(_) = self.data {
18648                return 1;
18649            }
18650            0
18651        }
18652    }
18653
18654    impl fidl::encoding::ResourceTypeMarker for WebMessage {
18655        type Borrowed<'a> = &'a mut Self;
18656        fn take_or_borrow<'a>(
18657            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18658        ) -> Self::Borrowed<'a> {
18659            value
18660        }
18661    }
18662
18663    unsafe impl fidl::encoding::TypeMarker for WebMessage {
18664        type Owned = Self;
18665
18666        #[inline(always)]
18667        fn inline_align(_context: fidl::encoding::Context) -> usize {
18668            8
18669        }
18670
18671        #[inline(always)]
18672        fn inline_size(_context: fidl::encoding::Context) -> usize {
18673            16
18674        }
18675    }
18676
18677    unsafe impl fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
18678        for &mut WebMessage
18679    {
18680        unsafe fn encode(
18681            self,
18682            encoder: &mut fidl::encoding::Encoder<
18683                '_,
18684                fidl::encoding::DefaultFuchsiaResourceDialect,
18685            >,
18686            offset: usize,
18687            mut depth: fidl::encoding::Depth,
18688        ) -> fidl::Result<()> {
18689            encoder.debug_check_bounds::<WebMessage>(offset);
18690            // Vector header
18691            let max_ordinal: u64 = self.max_ordinal_present();
18692            encoder.write_num(max_ordinal, offset);
18693            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18694            // Calling encoder.out_of_line_offset(0) is not allowed.
18695            if max_ordinal == 0 {
18696                return Ok(());
18697            }
18698            depth.increment()?;
18699            let envelope_size = 8;
18700            let bytes_len = max_ordinal as usize * envelope_size;
18701            #[allow(unused_variables)]
18702            let offset = encoder.out_of_line_offset(bytes_len);
18703            let mut _prev_end_offset: usize = 0;
18704            if 1 > max_ordinal {
18705                return Ok(());
18706            }
18707
18708            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18709            // are envelope_size bytes.
18710            let cur_offset: usize = (1 - 1) * envelope_size;
18711
18712            // Zero reserved fields.
18713            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18714
18715            // Safety:
18716            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18717            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18718            //   envelope_size bytes, there is always sufficient room.
18719            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
18720            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18721            encoder, offset + cur_offset, depth
18722        )?;
18723
18724            _prev_end_offset = cur_offset + envelope_size;
18725            if 2 > max_ordinal {
18726                return Ok(());
18727            }
18728
18729            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18730            // are envelope_size bytes.
18731            let cur_offset: usize = (2 - 1) * envelope_size;
18732
18733            // Zero reserved fields.
18734            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18735
18736            // Safety:
18737            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18738            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18739            //   envelope_size bytes, there is always sufficient room.
18740            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<IncomingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18741            self.incoming_transfer.as_mut().map(<fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18742            encoder, offset + cur_offset, depth
18743        )?;
18744
18745            _prev_end_offset = cur_offset + envelope_size;
18746            if 3 > max_ordinal {
18747                return Ok(());
18748            }
18749
18750            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18751            // are envelope_size bytes.
18752            let cur_offset: usize = (3 - 1) * envelope_size;
18753
18754            // Zero reserved fields.
18755            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18756
18757            // Safety:
18758            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18759            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18760            //   envelope_size bytes, there is always sufficient room.
18761            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<OutgoingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18762            self.outgoing_transfer.as_mut().map(<fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18763            encoder, offset + cur_offset, depth
18764        )?;
18765
18766            _prev_end_offset = cur_offset + envelope_size;
18767
18768            Ok(())
18769        }
18770    }
18771
18772    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WebMessage {
18773        #[inline(always)]
18774        fn new_empty() -> Self {
18775            Self::default()
18776        }
18777
18778        unsafe fn decode(
18779            &mut self,
18780            decoder: &mut fidl::encoding::Decoder<
18781                '_,
18782                fidl::encoding::DefaultFuchsiaResourceDialect,
18783            >,
18784            offset: usize,
18785            mut depth: fidl::encoding::Depth,
18786        ) -> fidl::Result<()> {
18787            decoder.debug_check_bounds::<Self>(offset);
18788            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18789                None => return Err(fidl::Error::NotNullable),
18790                Some(len) => len,
18791            };
18792            // Calling decoder.out_of_line_offset(0) is not allowed.
18793            if len == 0 {
18794                return Ok(());
18795            };
18796            depth.increment()?;
18797            let envelope_size = 8;
18798            let bytes_len = len * envelope_size;
18799            let offset = decoder.out_of_line_offset(bytes_len)?;
18800            // Decode the envelope for each type.
18801            let mut _next_ordinal_to_read = 0;
18802            let mut next_offset = offset;
18803            let end_offset = offset + bytes_len;
18804            _next_ordinal_to_read += 1;
18805            if next_offset >= end_offset {
18806                return Ok(());
18807            }
18808
18809            // Decode unknown envelopes for gaps in ordinals.
18810            while _next_ordinal_to_read < 1 {
18811                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18812                _next_ordinal_to_read += 1;
18813                next_offset += envelope_size;
18814            }
18815
18816            let next_out_of_line = decoder.next_out_of_line();
18817            let handles_before = decoder.remaining_handles();
18818            if let Some((inlined, num_bytes, num_handles)) =
18819                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18820            {
18821                let member_inline_size =
18822                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
18823                        decoder.context,
18824                    );
18825                if inlined != (member_inline_size <= 4) {
18826                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18827                }
18828                let inner_offset;
18829                let mut inner_depth = depth.clone();
18830                if inlined {
18831                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18832                    inner_offset = next_offset;
18833                } else {
18834                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18835                    inner_depth.increment()?;
18836                }
18837                let val_ref = self.data.get_or_insert_with(|| {
18838                    fidl::new_empty!(
18839                        fidl_fuchsia_mem::Buffer,
18840                        fidl::encoding::DefaultFuchsiaResourceDialect
18841                    )
18842                });
18843                fidl::decode!(
18844                    fidl_fuchsia_mem::Buffer,
18845                    fidl::encoding::DefaultFuchsiaResourceDialect,
18846                    val_ref,
18847                    decoder,
18848                    inner_offset,
18849                    inner_depth
18850                )?;
18851                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18852                {
18853                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18854                }
18855                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18856                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18857                }
18858            }
18859
18860            next_offset += envelope_size;
18861            _next_ordinal_to_read += 1;
18862            if next_offset >= end_offset {
18863                return Ok(());
18864            }
18865
18866            // Decode unknown envelopes for gaps in ordinals.
18867            while _next_ordinal_to_read < 2 {
18868                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18869                _next_ordinal_to_read += 1;
18870                next_offset += envelope_size;
18871            }
18872
18873            let next_out_of_line = decoder.next_out_of_line();
18874            let handles_before = decoder.remaining_handles();
18875            if let Some((inlined, num_bytes, num_handles)) =
18876                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18877            {
18878                let member_inline_size = <fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18879                if inlined != (member_inline_size <= 4) {
18880                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18881                }
18882                let inner_offset;
18883                let mut inner_depth = depth.clone();
18884                if inlined {
18885                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18886                    inner_offset = next_offset;
18887                } else {
18888                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18889                    inner_depth.increment()?;
18890                }
18891                let val_ref = self.incoming_transfer.get_or_insert_with(|| {
18892                    fidl::new_empty!(
18893                        fidl::encoding::UnboundedVector<IncomingTransferable>,
18894                        fidl::encoding::DefaultFuchsiaResourceDialect
18895                    )
18896                });
18897                fidl::decode!(
18898                    fidl::encoding::UnboundedVector<IncomingTransferable>,
18899                    fidl::encoding::DefaultFuchsiaResourceDialect,
18900                    val_ref,
18901                    decoder,
18902                    inner_offset,
18903                    inner_depth
18904                )?;
18905                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18906                {
18907                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18908                }
18909                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18910                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18911                }
18912            }
18913
18914            next_offset += envelope_size;
18915            _next_ordinal_to_read += 1;
18916            if next_offset >= end_offset {
18917                return Ok(());
18918            }
18919
18920            // Decode unknown envelopes for gaps in ordinals.
18921            while _next_ordinal_to_read < 3 {
18922                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18923                _next_ordinal_to_read += 1;
18924                next_offset += envelope_size;
18925            }
18926
18927            let next_out_of_line = decoder.next_out_of_line();
18928            let handles_before = decoder.remaining_handles();
18929            if let Some((inlined, num_bytes, num_handles)) =
18930                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18931            {
18932                let member_inline_size = <fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18933                if inlined != (member_inline_size <= 4) {
18934                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18935                }
18936                let inner_offset;
18937                let mut inner_depth = depth.clone();
18938                if inlined {
18939                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18940                    inner_offset = next_offset;
18941                } else {
18942                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18943                    inner_depth.increment()?;
18944                }
18945                let val_ref = self.outgoing_transfer.get_or_insert_with(|| {
18946                    fidl::new_empty!(
18947                        fidl::encoding::UnboundedVector<OutgoingTransferable>,
18948                        fidl::encoding::DefaultFuchsiaResourceDialect
18949                    )
18950                });
18951                fidl::decode!(
18952                    fidl::encoding::UnboundedVector<OutgoingTransferable>,
18953                    fidl::encoding::DefaultFuchsiaResourceDialect,
18954                    val_ref,
18955                    decoder,
18956                    inner_offset,
18957                    inner_depth
18958                )?;
18959                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18960                {
18961                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18962                }
18963                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18964                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18965                }
18966            }
18967
18968            next_offset += envelope_size;
18969
18970            // Decode the remaining unknown envelopes.
18971            while next_offset < end_offset {
18972                _next_ordinal_to_read += 1;
18973                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18974                next_offset += envelope_size;
18975            }
18976
18977            Ok(())
18978        }
18979    }
18980
18981    impl fidl::encoding::ResourceTypeMarker for IncomingTransferable {
18982        type Borrowed<'a> = &'a mut Self;
18983        fn take_or_borrow<'a>(
18984            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18985        ) -> Self::Borrowed<'a> {
18986            value
18987        }
18988    }
18989
18990    unsafe impl fidl::encoding::TypeMarker for IncomingTransferable {
18991        type Owned = Self;
18992
18993        #[inline(always)]
18994        fn inline_align(_context: fidl::encoding::Context) -> usize {
18995            8
18996        }
18997
18998        #[inline(always)]
18999        fn inline_size(_context: fidl::encoding::Context) -> usize {
19000            16
19001        }
19002    }
19003
19004    unsafe impl
19005        fidl::encoding::Encode<IncomingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
19006        for &mut IncomingTransferable
19007    {
19008        #[inline]
19009        unsafe fn encode(
19010            self,
19011            encoder: &mut fidl::encoding::Encoder<
19012                '_,
19013                fidl::encoding::DefaultFuchsiaResourceDialect,
19014            >,
19015            offset: usize,
19016            _depth: fidl::encoding::Depth,
19017        ) -> fidl::Result<()> {
19018            encoder.debug_check_bounds::<IncomingTransferable>(offset);
19019            encoder.write_num::<u64>(self.ordinal(), offset);
19020            match self {
19021            IncomingTransferable::MessagePort(ref mut val) => {
19022                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
19023                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19024                    encoder, offset + 8, _depth
19025                )
19026            }
19027            IncomingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19028        }
19029        }
19030    }
19031
19032    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19033        for IncomingTransferable
19034    {
19035        #[inline(always)]
19036        fn new_empty() -> Self {
19037            Self::__SourceBreaking { unknown_ordinal: 0 }
19038        }
19039
19040        #[inline]
19041        unsafe fn decode(
19042            &mut self,
19043            decoder: &mut fidl::encoding::Decoder<
19044                '_,
19045                fidl::encoding::DefaultFuchsiaResourceDialect,
19046            >,
19047            offset: usize,
19048            mut depth: fidl::encoding::Depth,
19049        ) -> fidl::Result<()> {
19050            decoder.debug_check_bounds::<Self>(offset);
19051            #[allow(unused_variables)]
19052            let next_out_of_line = decoder.next_out_of_line();
19053            let handles_before = decoder.remaining_handles();
19054            let (ordinal, inlined, num_bytes, num_handles) =
19055                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19056
19057            let member_inline_size = match ordinal {
19058            1 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19059            0 => return Err(fidl::Error::UnknownUnionTag),
19060            _ => num_bytes as usize,
19061        };
19062
19063            if inlined != (member_inline_size <= 4) {
19064                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19065            }
19066            let _inner_offset;
19067            if inlined {
19068                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19069                _inner_offset = offset + 8;
19070            } else {
19071                depth.increment()?;
19072                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19073            }
19074            match ordinal {
19075                1 => {
19076                    #[allow(irrefutable_let_patterns)]
19077                    if let IncomingTransferable::MessagePort(_) = self {
19078                        // Do nothing, read the value into the object
19079                    } else {
19080                        // Initialize `self` to the right variant
19081                        *self = IncomingTransferable::MessagePort(fidl::new_empty!(
19082                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
19083                            fidl::encoding::DefaultFuchsiaResourceDialect
19084                        ));
19085                    }
19086                    #[allow(irrefutable_let_patterns)]
19087                    if let IncomingTransferable::MessagePort(ref mut val) = self {
19088                        fidl::decode!(
19089                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
19090                            fidl::encoding::DefaultFuchsiaResourceDialect,
19091                            val,
19092                            decoder,
19093                            _inner_offset,
19094                            depth
19095                        )?;
19096                    } else {
19097                        unreachable!()
19098                    }
19099                }
19100                #[allow(deprecated)]
19101                ordinal => {
19102                    for _ in 0..num_handles {
19103                        decoder.drop_next_handle()?;
19104                    }
19105                    *self = IncomingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19106                }
19107            }
19108            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19109                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19110            }
19111            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19112                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19113            }
19114            Ok(())
19115        }
19116    }
19117
19118    impl fidl::encoding::ResourceTypeMarker for NavigationDecision {
19119        type Borrowed<'a> = &'a mut Self;
19120        fn take_or_borrow<'a>(
19121            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19122        ) -> Self::Borrowed<'a> {
19123            value
19124        }
19125    }
19126
19127    unsafe impl fidl::encoding::TypeMarker for NavigationDecision {
19128        type Owned = Self;
19129
19130        #[inline(always)]
19131        fn inline_align(_context: fidl::encoding::Context) -> usize {
19132            8
19133        }
19134
19135        #[inline(always)]
19136        fn inline_size(_context: fidl::encoding::Context) -> usize {
19137            16
19138        }
19139    }
19140
19141    unsafe impl
19142        fidl::encoding::Encode<NavigationDecision, fidl::encoding::DefaultFuchsiaResourceDialect>
19143        for &mut NavigationDecision
19144    {
19145        #[inline]
19146        unsafe fn encode(
19147            self,
19148            encoder: &mut fidl::encoding::Encoder<
19149                '_,
19150                fidl::encoding::DefaultFuchsiaResourceDialect,
19151            >,
19152            offset: usize,
19153            _depth: fidl::encoding::Depth,
19154        ) -> fidl::Result<()> {
19155            encoder.debug_check_bounds::<NavigationDecision>(offset);
19156            encoder.write_num::<u64>(self.ordinal(), offset);
19157            match self {
19158                NavigationDecision::Proceed(ref val) => fidl::encoding::encode_in_envelope::<
19159                    NoArgumentsAction,
19160                    fidl::encoding::DefaultFuchsiaResourceDialect,
19161                >(
19162                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19163                    encoder,
19164                    offset + 8,
19165                    _depth,
19166                ),
19167                NavigationDecision::Abort(ref val) => fidl::encoding::encode_in_envelope::<
19168                    NoArgumentsAction,
19169                    fidl::encoding::DefaultFuchsiaResourceDialect,
19170                >(
19171                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19172                    encoder,
19173                    offset + 8,
19174                    _depth,
19175                ),
19176            }
19177        }
19178    }
19179
19180    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19181        for NavigationDecision
19182    {
19183        #[inline(always)]
19184        fn new_empty() -> Self {
19185            Self::Proceed(fidl::new_empty!(
19186                NoArgumentsAction,
19187                fidl::encoding::DefaultFuchsiaResourceDialect
19188            ))
19189        }
19190
19191        #[inline]
19192        unsafe fn decode(
19193            &mut self,
19194            decoder: &mut fidl::encoding::Decoder<
19195                '_,
19196                fidl::encoding::DefaultFuchsiaResourceDialect,
19197            >,
19198            offset: usize,
19199            mut depth: fidl::encoding::Depth,
19200        ) -> fidl::Result<()> {
19201            decoder.debug_check_bounds::<Self>(offset);
19202            #[allow(unused_variables)]
19203            let next_out_of_line = decoder.next_out_of_line();
19204            let handles_before = decoder.remaining_handles();
19205            let (ordinal, inlined, num_bytes, num_handles) =
19206                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19207
19208            let member_inline_size = match ordinal {
19209                1 => {
19210                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19211                }
19212                2 => {
19213                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19214                }
19215                _ => return Err(fidl::Error::UnknownUnionTag),
19216            };
19217
19218            if inlined != (member_inline_size <= 4) {
19219                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19220            }
19221            let _inner_offset;
19222            if inlined {
19223                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19224                _inner_offset = offset + 8;
19225            } else {
19226                depth.increment()?;
19227                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19228            }
19229            match ordinal {
19230                1 => {
19231                    #[allow(irrefutable_let_patterns)]
19232                    if let NavigationDecision::Proceed(_) = self {
19233                        // Do nothing, read the value into the object
19234                    } else {
19235                        // Initialize `self` to the right variant
19236                        *self = NavigationDecision::Proceed(fidl::new_empty!(
19237                            NoArgumentsAction,
19238                            fidl::encoding::DefaultFuchsiaResourceDialect
19239                        ));
19240                    }
19241                    #[allow(irrefutable_let_patterns)]
19242                    if let NavigationDecision::Proceed(ref mut val) = self {
19243                        fidl::decode!(
19244                            NoArgumentsAction,
19245                            fidl::encoding::DefaultFuchsiaResourceDialect,
19246                            val,
19247                            decoder,
19248                            _inner_offset,
19249                            depth
19250                        )?;
19251                    } else {
19252                        unreachable!()
19253                    }
19254                }
19255                2 => {
19256                    #[allow(irrefutable_let_patterns)]
19257                    if let NavigationDecision::Abort(_) = self {
19258                        // Do nothing, read the value into the object
19259                    } else {
19260                        // Initialize `self` to the right variant
19261                        *self = NavigationDecision::Abort(fidl::new_empty!(
19262                            NoArgumentsAction,
19263                            fidl::encoding::DefaultFuchsiaResourceDialect
19264                        ));
19265                    }
19266                    #[allow(irrefutable_let_patterns)]
19267                    if let NavigationDecision::Abort(ref mut val) = self {
19268                        fidl::decode!(
19269                            NoArgumentsAction,
19270                            fidl::encoding::DefaultFuchsiaResourceDialect,
19271                            val,
19272                            decoder,
19273                            _inner_offset,
19274                            depth
19275                        )?;
19276                    } else {
19277                        unreachable!()
19278                    }
19279                }
19280                ordinal => panic!("unexpected ordinal {:?}", ordinal),
19281            }
19282            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19283                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19284            }
19285            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19286                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19287            }
19288            Ok(())
19289        }
19290    }
19291
19292    impl fidl::encoding::ResourceTypeMarker for OutgoingTransferable {
19293        type Borrowed<'a> = &'a mut Self;
19294        fn take_or_borrow<'a>(
19295            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19296        ) -> Self::Borrowed<'a> {
19297            value
19298        }
19299    }
19300
19301    unsafe impl fidl::encoding::TypeMarker for OutgoingTransferable {
19302        type Owned = Self;
19303
19304        #[inline(always)]
19305        fn inline_align(_context: fidl::encoding::Context) -> usize {
19306            8
19307        }
19308
19309        #[inline(always)]
19310        fn inline_size(_context: fidl::encoding::Context) -> usize {
19311            16
19312        }
19313    }
19314
19315    unsafe impl
19316        fidl::encoding::Encode<OutgoingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
19317        for &mut OutgoingTransferable
19318    {
19319        #[inline]
19320        unsafe fn encode(
19321            self,
19322            encoder: &mut fidl::encoding::Encoder<
19323                '_,
19324                fidl::encoding::DefaultFuchsiaResourceDialect,
19325            >,
19326            offset: usize,
19327            _depth: fidl::encoding::Depth,
19328        ) -> fidl::Result<()> {
19329            encoder.debug_check_bounds::<OutgoingTransferable>(offset);
19330            encoder.write_num::<u64>(self.ordinal(), offset);
19331            match self {
19332            OutgoingTransferable::MessagePort(ref mut val) => {
19333                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
19334                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19335                    encoder, offset + 8, _depth
19336                )
19337            }
19338            OutgoingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19339        }
19340        }
19341    }
19342
19343    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19344        for OutgoingTransferable
19345    {
19346        #[inline(always)]
19347        fn new_empty() -> Self {
19348            Self::__SourceBreaking { unknown_ordinal: 0 }
19349        }
19350
19351        #[inline]
19352        unsafe fn decode(
19353            &mut self,
19354            decoder: &mut fidl::encoding::Decoder<
19355                '_,
19356                fidl::encoding::DefaultFuchsiaResourceDialect,
19357            >,
19358            offset: usize,
19359            mut depth: fidl::encoding::Depth,
19360        ) -> fidl::Result<()> {
19361            decoder.debug_check_bounds::<Self>(offset);
19362            #[allow(unused_variables)]
19363            let next_out_of_line = decoder.next_out_of_line();
19364            let handles_before = decoder.remaining_handles();
19365            let (ordinal, inlined, num_bytes, num_handles) =
19366                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19367
19368            let member_inline_size = match ordinal {
19369            1 => <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19370            0 => return Err(fidl::Error::UnknownUnionTag),
19371            _ => num_bytes as usize,
19372        };
19373
19374            if inlined != (member_inline_size <= 4) {
19375                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19376            }
19377            let _inner_offset;
19378            if inlined {
19379                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19380                _inner_offset = offset + 8;
19381            } else {
19382                depth.increment()?;
19383                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19384            }
19385            match ordinal {
19386                1 => {
19387                    #[allow(irrefutable_let_patterns)]
19388                    if let OutgoingTransferable::MessagePort(_) = self {
19389                        // Do nothing, read the value into the object
19390                    } else {
19391                        // Initialize `self` to the right variant
19392                        *self = OutgoingTransferable::MessagePort(fidl::new_empty!(
19393                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19394                            fidl::encoding::DefaultFuchsiaResourceDialect
19395                        ));
19396                    }
19397                    #[allow(irrefutable_let_patterns)]
19398                    if let OutgoingTransferable::MessagePort(ref mut val) = self {
19399                        fidl::decode!(
19400                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19401                            fidl::encoding::DefaultFuchsiaResourceDialect,
19402                            val,
19403                            decoder,
19404                            _inner_offset,
19405                            depth
19406                        )?;
19407                    } else {
19408                        unreachable!()
19409                    }
19410                }
19411                #[allow(deprecated)]
19412                ordinal => {
19413                    for _ in 0..num_handles {
19414                        decoder.drop_next_handle()?;
19415                    }
19416                    *self = OutgoingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19417                }
19418            }
19419            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19420                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19421            }
19422            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19423                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19424            }
19425            Ok(())
19426        }
19427    }
19428}