fidl_fuchsia_web/
fidl_fuchsia_web.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_web__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ContextCreateFrameRequest {
16    pub frame: fidl::endpoints::ServerEnd<FrameMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ContextCreateFrameRequest {}
20
21#[derive(Debug, PartialEq)]
22pub struct ContextCreateFrameWithParamsRequest {
23    pub params: CreateFrameParams,
24    pub frame: fidl::endpoints::ServerEnd<FrameMarker>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28    for ContextCreateFrameWithParamsRequest
29{
30}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct ContextGetCookieManagerRequest {
34    pub manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
38    for ContextGetCookieManagerRequest
39{
40}
41
42#[derive(Debug, PartialEq)]
43pub struct ContextProviderCreateRequest {
44    pub params: CreateContextParams,
45    pub context: fidl::endpoints::ServerEnd<ContextMarker>,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
49    for ContextProviderCreateRequest
50{
51}
52
53#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54pub struct CookieManagerGetCookieListRequest {
55    pub url: Option<String>,
56    pub name: Option<String>,
57    pub cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61    for CookieManagerGetCookieListRequest
62{
63}
64
65#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66pub struct CookieManagerObserveCookieChangesRequest {
67    pub url: Option<String>,
68    pub name: Option<String>,
69    pub changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
70}
71
72impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
73    for CookieManagerObserveCookieChangesRequest
74{
75}
76
77#[derive(Debug, PartialEq)]
78pub struct CookiesIteratorGetNextResponse {
79    pub changed_cookies: Vec<Cookie>,
80}
81
82impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
83    for CookiesIteratorGetNextResponse
84{
85}
86
87#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
88pub struct DebugEnableDevToolsRequest {
89    pub listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
93    for DebugEnableDevToolsRequest
94{
95}
96
97#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct DevToolsListenerOnContextDevToolsAvailableRequest {
99    pub listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103    for DevToolsListenerOnContextDevToolsAvailableRequest
104{
105}
106
107#[derive(Debug, PartialEq)]
108pub struct FrameAddBeforeLoadJavaScriptRequest {
109    pub id: u64,
110    pub origins: Vec<String>,
111    pub script: fidl_fuchsia_mem::Buffer,
112}
113
114impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
115    for FrameAddBeforeLoadJavaScriptRequest
116{
117}
118
119#[derive(Debug, PartialEq)]
120pub struct FrameCreateView2Request {
121    pub args: CreateView2Args,
122}
123
124impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameCreateView2Request {}
125
126#[derive(Debug, PartialEq)]
127pub struct FrameCreateViewRequest {
128    pub view_token: fidl_fuchsia_ui_views::ViewToken,
129}
130
131impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FrameCreateViewRequest {}
132
133#[derive(Debug, PartialEq)]
134pub struct FrameCreateViewWithViewRefRequest {
135    pub view_token: fidl_fuchsia_ui_views::ViewToken,
136    pub view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
137    pub view_ref: fidl_fuchsia_ui_views::ViewRef,
138}
139
140impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
141    for FrameCreateViewWithViewRefRequest
142{
143}
144
145#[derive(Debug, PartialEq)]
146pub struct FrameExecuteJavaScriptNoResultRequest {
147    pub origins: Vec<String>,
148    pub script: fidl_fuchsia_mem::Buffer,
149}
150
151impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
152    for FrameExecuteJavaScriptNoResultRequest
153{
154}
155
156#[derive(Debug, PartialEq)]
157pub struct FrameExecuteJavaScriptRequest {
158    pub origins: Vec<String>,
159    pub script: fidl_fuchsia_mem::Buffer,
160}
161
162impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
163    for FrameExecuteJavaScriptRequest
164{
165}
166
167#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
168pub struct FrameGetMediaPlayerRequest {
169    pub player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
170}
171
172impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
173    for FrameGetMediaPlayerRequest
174{
175}
176
177#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
178pub struct FrameGetNavigationControllerRequest {
179    pub controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
180}
181
182impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
183    for FrameGetNavigationControllerRequest
184{
185}
186
187#[derive(Debug, PartialEq)]
188pub struct FrameHostCreateFrameWithParamsRequest {
189    pub params: CreateFrameParams,
190    pub frame: fidl::endpoints::ServerEnd<FrameMarker>,
191}
192
193impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
194    for FrameHostCreateFrameWithParamsRequest
195{
196}
197
198#[derive(Debug, PartialEq)]
199pub struct FramePostMessageRequest {
200    pub target_origin: String,
201    pub message: WebMessage,
202}
203
204impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for FramePostMessageRequest {}
205
206#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
207pub struct FrameSetConsoleLogSinkRequest {
208    pub sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
209}
210
211impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
212    for FrameSetConsoleLogSinkRequest
213{
214}
215
216#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
217pub struct FrameSetNavigationEventListener2Request {
218    pub listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
219    pub flags: NavigationEventListenerFlags,
220}
221
222impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
223    for FrameSetNavigationEventListener2Request
224{
225}
226
227#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
228pub struct FrameSetNavigationEventListenerRequest {
229    pub listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
230}
231
232impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
233    for FrameSetNavigationEventListenerRequest
234{
235}
236
237#[derive(Debug, PartialEq)]
238pub struct FrameSetNavigationPolicyProviderRequest {
239    pub params: NavigationPolicyProviderParams,
240    pub provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
241}
242
243impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
244    for FrameSetNavigationPolicyProviderRequest
245{
246}
247
248#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
249pub struct FrameSetPopupFrameCreationListenerRequest {
250    pub listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
251}
252
253impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
254    for FrameSetPopupFrameCreationListenerRequest
255{
256}
257
258#[derive(Debug, PartialEq)]
259pub struct FrameExecuteJavaScriptResponse {
260    pub result: fidl_fuchsia_mem::Buffer,
261}
262
263impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
264    for FrameExecuteJavaScriptResponse
265{
266}
267
268#[derive(Debug, PartialEq)]
269pub struct MessagePortPostMessageRequest {
270    pub message: WebMessage,
271}
272
273impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
274    for MessagePortPostMessageRequest
275{
276}
277
278#[derive(Debug, PartialEq)]
279pub struct MessagePortReceiveMessageResponse {
280    pub message: WebMessage,
281}
282
283impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
284    for MessagePortReceiveMessageResponse
285{
286}
287
288#[derive(Debug, PartialEq)]
289pub struct NavigationControllerLoadUrlRequest {
290    pub url: String,
291    pub params: LoadUrlParams,
292}
293
294impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
295    for NavigationControllerLoadUrlRequest
296{
297}
298
299#[derive(Debug, PartialEq)]
300pub struct NavigationEventListenerOnNavigationStateChangedRequest {
301    pub change: NavigationState,
302}
303
304impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
305    for NavigationEventListenerOnNavigationStateChangedRequest
306{
307}
308
309#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
310pub struct NavigationPolicyProviderEvaluateRequestedNavigationResponse {
311    pub decision: NavigationDecision,
312}
313
314impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
315    for NavigationPolicyProviderEvaluateRequestedNavigationResponse
316{
317}
318
319#[derive(Debug, PartialEq)]
320pub struct PopupFrameCreationListenerOnPopupFrameCreatedRequest {
321    pub frame: fidl::endpoints::ClientEnd<FrameMarker>,
322    pub info: PopupFrameCreationInfo,
323}
324
325impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
326    for PopupFrameCreationListenerOnPopupFrameCreatedRequest
327{
328}
329
330/// Defines a provider which hosts resources from a [`fuchsia.io/Directory`]. Content can `GET`
331/// resource files via the provider, but not enumerate directories. Resources can be accessed by
332/// their URLs: `fuchsia-dir://<provider-name>/<path/to/resource>`
333///
334/// By default the MIME types of files are determined automatically by "sniffing" the contents of
335/// the files. No content encoding will be declared, which browsers will interpret as meaning
336/// `"text/plain"`.
337///
338/// Content type and encoding metadata may optionally be specified explicitly by metadata files,
339/// which reside alongside the file. Metadata is expressed in JSON files, named after the files
340/// they describe with a `"._metadata"` suffix.
341///
342/// For example, the file `"index.html"` would have the a metadata file called
343/// `"index.html._metadata"`, with the following contents:
344/// ```
345/// {
346///   "charset": "utf-8",
347///   "mime": "text/html"
348/// }
349/// ```
350#[derive(Debug, Default, PartialEq)]
351pub struct ContentDirectoryProvider {
352    /// Name of the provider. Must be non-empty and composed solely of alphanumerics, dots, and
353    /// dashes.
354    pub name: Option<String>,
355    /// Directory containing the files served by this provider.
356    pub directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
357    #[doc(hidden)]
358    pub __source_breaking: fidl::marker::SourceBreaking,
359}
360
361impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ContentDirectoryProvider {}
362
363#[derive(Debug, Default, PartialEq)]
364pub struct Cookie {
365    /// A table with fields to identify a cookie.
366    pub id: Option<CookieId>,
367    /// The cookie value.
368    /// RFC6265 does not specify an upper limit on cookie size, but recommends
369    /// that at least 4096 bytes are supported.
370    pub value: Option<String>,
371    #[doc(hidden)]
372    pub __source_breaking: fidl::marker::SourceBreaking,
373}
374
375impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Cookie {}
376
377/// Parameters specifying the configuration for a new [`Context`].
378#[derive(Debug, Default, PartialEq)]
379pub struct CreateContextParams {
380    /// Service directory to be used by the context.
381    ///
382    /// The following services must be present in the service directory:
383    ///
384    /// - [`fuchsia.buildinfo/Provider`]
385    /// - [`fuchsia.device/NameProvider`]
386    /// - [`fuchsia.fonts/Provider`]
387    /// - [`fuchsia.hwinfo.Product`]
388    /// - [`fuchsia.intl/PropertyProvider`]
389    /// - [`fuchsia.kernel/VmexResource`] (unless [`ContextFeatureFlags.DISABLE_DYNAMIC_CODE_GENERATION`] is set)
390    /// - [`fuchsia.logger/LogSink`]
391    /// - [`fuchsia.memorypressure/Provider`]
392    /// - [`fuchsia.process/Launcher`]
393    /// - [`fuchsia.sysmem/Allocator`]
394    ///
395    /// The following services are recommended to be present in order to allow CPU scheduling
396    /// profiles to be applied to threads to tune their performance, especially for media rendering.
397    /// - [`fuchsia.media.ProfileProvider`] (requirement will be removed in 2025)
398    /// - [`fuchsia.scheduler.RoleManager`]
399    ///
400    /// The following services must be present in order to render web content in a Scenic view
401    /// using [`Frame.CreateView`], [`Frame.CreateViewWithViewRef`] or [`Frame.CreateView2`]]:
402    /// - [`fuchsia.accessibility.semantics/SemanticsManager`]
403    /// - [`fuchsia.ui.composition/Allocator`]
404    /// - [`fuchsia.ui.composition/Flatland`]
405    /// - [`fuchsia.ui.scenic/Scenic`]
406    ///
407    /// The following service must be present in order to collect diagnostic tracing data.
408    /// - [`fuchsia.tracing.perfetto.ProducerConnector`]
409    pub service_directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
410    /// Handle to the directory that will contain the [`Context`]'s persistent data. If it is left
411    /// unset, then the created [`Context`] will be stateless, with all of its data discarded upon
412    /// [`Context`] destruction.
413    ///
414    /// If set, `data_directory` must not be shared with any other [`Context`].
415    pub data_directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
416    /// Optional string describing the embedding product to append to the User-Agent string.
417    /// See the specification for the
418    /// [HTTP User-Agent header](https://tools.ietf.org/html/rfc7231#section-5.5.3).
419    /// Requires that `user_agent_version` is also specified.
420    pub user_agent_product: Option<String>,
421    /// Optional version for the embedding product to append to the User-Agent string.
422    ///
423    /// Requires that `user_agent_product` is also specified.
424    pub user_agent_version: Option<String>,
425    /// Enables Frames to be created with remote debugging enabled using the DevTools protocol. If
426    /// `port` is 0, then an ephemeral port will be used, which can be queried via the
427    /// [`Context.GetRemoteDebuggingPort`] API.
428    ///
429    /// Because remote debugging uses TCP, it is not valid to set a remote
430    /// debugging port without having also set [`ContextFeatureFlags.NETWORK`]
431    /// for the context.
432    pub remote_debugging_port: Option<u16>,
433    /// List of providers whose contents will be served by `fuchsia-dir://` URLs.
434    pub content_directories: Option<Vec<ContentDirectoryProvider>>,
435    /// Optional features that should be enabled for this context. Some features may also require
436    /// additional services in `service_directory`.
437    pub features: Option<ContextFeatureFlags>,
438    /// Enables PlayReady CDM for the Context using the specified string as a key system
439    /// string. The string should be a reverse domain name, as required by
440    /// [EME API](https://www.w3.org/TR/encrypted-media/#key-system).
441    ///
442    /// - Requires [`fuchsia.media.drm/PlayReady`] service.
443    /// - Requires that a `cdm_data_directory` be specified in [`CreateContextParams`].
444    pub playready_key_system: Option<String>,
445    /// Treat given insecure origins as secure origins. For the definition of secure contexts, see
446    /// [Secure Contexts](https://w3c.github.io/webappsec-secure-contexts/) and
447    /// [origin trustworthiness](https://www.w3.org/TR/powerful-features/#is-origin-trustworthy).
448    ///
449    /// Example value: `{"http://a.com", "http://b.com"}`.
450    pub unsafely_treat_insecure_origins_as_secure: Option<Vec<String>>,
451    /// Specifies a set of header names for which [Cross-Origin Resource Sharing
452    /// (CORS)](https://www.w3.org/TR/cors/) checks should not be enforced.
453    pub cors_exempt_headers: Option<Vec<Vec<u8>>>,
454    /// Specifies the storage to use to persistent content licensing related data (e.g.
455    /// provisioning data, persistent session data). By default these data will be placed under the
456    /// `data_directory`, if specified.
457    ///
458    /// If neither `data_directory` nor `cdm_data_directory` are specified, then content licensing
459    /// features requiring persistent storage (e.g. persistent licensing sessions) will not be
460    /// available to the [`Context`].
461    ///
462    /// Note that not all content licensing systems support persistent sessions, regardless of
463    /// whether persistent storage is provided.
464    pub cdm_data_directory: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>>,
465    /// Specifies a target maximum size for `cdm_data_directory` contents, in bytes. If the amount
466    /// of persisted CDM data exceeds this threshold, then the [`Context`] will attempt to purge
467    /// some data to meet the specified quota.
468    pub cdm_data_quota_bytes: Option<u64>,
469    /// Specifies a target maximum size for `data_directory` contents, in bytes.
470    /// The [`Context`] will attempt to limit browsing state (e.g. cookies, LocalStorage) to
471    /// not exceed the specified size.
472    pub data_quota_bytes: Option<u64>,
473    #[doc(hidden)]
474    pub __source_breaking: fidl::marker::SourceBreaking,
475}
476
477impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateContextParams {}
478
479/// Parameters specifying the configuration for a new [`Frame`].
480#[derive(Debug, Default, PartialEq)]
481pub struct CreateFrameParams {
482    /// Set to true to enable remote debugging. The [`Frame`] will be closed with
483    /// `ERR_INVALID_ARGS` if `remote_debugging_port` was not set in
484    /// [`CreateContextParams`].
485    pub enable_remote_debugging: Option<bool>,
486    /// Set to give the Frame a name to help distinguish it in debug contexts , such as system log
487    /// output. For example, the name may be added to messages from web content when they are logged
488    /// to the system logger. The name does not affect user- or web-visible behavior.
489    /// Popup Frames created by the Frame will have a name derived from the parent Frame's name.
490    pub debug_name: Option<String>,
491    /// Enables automatic blocking of navigations to explicit sites, and specifies the error page
492    /// content, in HTML, to be loaded in the Frame when a navigation is canceled by the filter.
493    /// Applies to navigations in all frames within the Frame.
494    /// When navigation of the main document is canceled, the Frame's [`NavigationState.PageType`]
495    /// is `ERROR`.
496    /// If set to an empty buffer, a default error message will be displayed.
497    /// If set and such filtering is not supported, the [`Frame`] will disconnect with
498    /// `ZX_ERR_NOT_SUPPORTED`.
499    pub explicit_sites_filter_error_page: Option<fidl_fuchsia_mem::Data>,
500    #[doc(hidden)]
501    pub __source_breaking: fidl::marker::SourceBreaking,
502}
503
504impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateFrameParams {}
505
506/// Args for Frame.CreateView2(), see above.
507#[derive(Debug, Default, PartialEq)]
508pub struct CreateView2Args {
509    /// Non-optional. This token is provided to attach the client's Flatland view to the parent's
510    /// viewport.
511    pub view_creation_token: Option<fidl_fuchsia_ui_views::ViewCreationToken>,
512    #[doc(hidden)]
513    pub __source_breaking: fidl::marker::SourceBreaking,
514}
515
516impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateView2Args {}
517
518/// Used to represent a favicon for a page. An empty table (all fields are unset) is used to indicate
519/// that the page doesn't have a favicon.
520#[derive(Debug, Default, PartialEq)]
521pub struct Favicon {
522    /// The image content encoded as an RGBA bitmap with premultiplied alpha channel. The data is
523    /// densely packed, so the stride is always `4 * width` and the total size is
524    /// `4 * width * height`.
525    pub data: Option<fidl_fuchsia_mem::Buffer>,
526    /// The width of the image.
527    pub width: Option<u32>,
528    /// The height of the image.
529    pub height: Option<u32>,
530    #[doc(hidden)]
531    pub __source_breaking: fidl::marker::SourceBreaking,
532}
533
534impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Favicon {}
535
536/// Additional parameters for modifying the behavior of [`NavigationController.LoadUrl`].
537#[derive(Debug, Default, PartialEq)]
538pub struct LoadUrlParams {
539    /// Provides a hint to the browser UI about how [`NavigationController.LoadUrl`] was triggered.
540    pub type_: Option<LoadUrlReason>,
541    /// The URL that linked to the resource being requested.
542    pub referrer_url: Option<String>,
543    /// Should be set to true to propagate user activation to the frame. User activation implies
544    /// that the user is interacting with the web frame. It enables some web features that are not
545    /// available otherwise. For example, autoplay will work only when this flag is set to true.
546    pub was_user_activated: Option<bool>,
547    /// Custom HTTP headers. RFC7540 does not specify a limit on the number nor
548    /// size of headers.
549    pub headers: Option<Vec<fidl_fuchsia_net_http::Header>>,
550    #[doc(hidden)]
551    pub __source_breaking: fidl::marker::SourceBreaking,
552}
553
554impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LoadUrlParams {}
555
556/// Contains information about the [`Frame`]'s navigation state.
557#[derive(Debug, Default, PartialEq)]
558pub struct NavigationState {
559    /// The page's URL.
560    pub url: Option<String>,
561    /// The user-visible page title. While W3C style recommendation is that HTML
562    /// TITLE tags not exceed 64 characters in length, there is no actual limit.
563    pub title: Option<String>,
564    /// Indicates whether this was a navigation to an error page.
565    pub page_type: Option<PageType>,
566    /// Indicates if there is a following navigation.
567    pub can_go_forward: Option<bool>,
568    /// Indicates if there is a previous navigation.
569    pub can_go_back: Option<bool>,
570    /// Indicates that the main document's statically declared resources have been loaded.
571    pub is_main_document_loaded: Option<bool>,
572    /// Current favicon for the page. The field is set only when the `FAVICON` flag is set for the
573    /// `NavigationEventListener` and the favicon has changed.
574    pub favicon: Option<Favicon>,
575    /// Indicates type of the error when `page_type` is set to `ERROR`.
576    pub error_detail: Option<ErrorDetail>,
577    #[doc(hidden)]
578    pub __source_breaking: fidl::marker::SourceBreaking,
579}
580
581impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NavigationState {}
582
583/// Specifies additional information about a newly created popup frame.
584#[derive(Debug, Default, PartialEq)]
585pub struct PopupFrameCreationInfo {
586    /// The URL to which the popup frame was initially navigated.
587    pub initial_url: Option<String>,
588    /// Set if the popup frame was created in response to UI interaction from the user (e.g. a
589    /// link was clicked).
590    pub initiated_by_user: Option<bool>,
591    #[doc(hidden)]
592    pub __source_breaking: fidl::marker::SourceBreaking,
593}
594
595impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PopupFrameCreationInfo {}
596
597#[derive(Debug, Default, PartialEq)]
598pub struct WebMessage {
599    /// The message payload, encoded as an UTF-8 string. This is a required property.
600    pub data: Option<fidl_fuchsia_mem::Buffer>,
601    /// Optional list of objects transferred into the [`MessagePort`] from the FIDL client.
602    pub incoming_transfer: Option<Vec<IncomingTransferable>>,
603    /// Optional list of objects transferred out of the [`MessagePort`] to the FIDL client.
604    pub outgoing_transfer: Option<Vec<OutgoingTransferable>>,
605    #[doc(hidden)]
606    pub __source_breaking: fidl::marker::SourceBreaking,
607}
608
609impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WebMessage {}
610
611#[derive(Debug)]
612pub enum IncomingTransferable {
613    MessagePort(fidl::endpoints::ClientEnd<MessagePortMarker>),
614    #[doc(hidden)]
615    __SourceBreaking {
616        unknown_ordinal: u64,
617    },
618}
619
620/// Pattern that matches an unknown `IncomingTransferable` member.
621#[macro_export]
622macro_rules! IncomingTransferableUnknown {
623    () => {
624        _
625    };
626}
627
628// Custom PartialEq so that unknown variants are not equal to themselves.
629impl PartialEq for IncomingTransferable {
630    fn eq(&self, other: &Self) -> bool {
631        match (self, other) {
632            (Self::MessagePort(x), Self::MessagePort(y)) => *x == *y,
633            _ => false,
634        }
635    }
636}
637
638impl IncomingTransferable {
639    #[inline]
640    pub fn ordinal(&self) -> u64 {
641        match *self {
642            Self::MessagePort(_) => 1,
643            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
644        }
645    }
646
647    #[inline]
648    pub fn unknown_variant_for_testing() -> Self {
649        Self::__SourceBreaking { unknown_ordinal: 0 }
650    }
651
652    #[inline]
653    pub fn is_unknown(&self) -> bool {
654        match self {
655            Self::__SourceBreaking { .. } => true,
656            _ => false,
657        }
658    }
659}
660
661impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IncomingTransferable {}
662
663/// Navigation action that should be taken in response to a navigation request. Returned from
664/// [`NavigationPolicyProvider.EvaluateRequestedNavigation`].
665#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
666pub enum NavigationDecision {
667    /// Navigation should proceed normally.
668    Proceed(NoArgumentsAction),
669    /// Navigation should be aborted. The frame should stay on the current page.
670    Abort(NoArgumentsAction),
671}
672
673impl NavigationDecision {
674    #[inline]
675    pub fn ordinal(&self) -> u64 {
676        match *self {
677            Self::Proceed(_) => 1,
678            Self::Abort(_) => 2,
679        }
680    }
681}
682
683impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for NavigationDecision {}
684
685#[derive(Debug)]
686pub enum OutgoingTransferable {
687    MessagePort(fidl::endpoints::ServerEnd<MessagePortMarker>),
688    #[doc(hidden)]
689    __SourceBreaking {
690        unknown_ordinal: u64,
691    },
692}
693
694/// Pattern that matches an unknown `OutgoingTransferable` member.
695#[macro_export]
696macro_rules! OutgoingTransferableUnknown {
697    () => {
698        _
699    };
700}
701
702// Custom PartialEq so that unknown variants are not equal to themselves.
703impl PartialEq for OutgoingTransferable {
704    fn eq(&self, other: &Self) -> bool {
705        match (self, other) {
706            (Self::MessagePort(x), Self::MessagePort(y)) => *x == *y,
707            _ => false,
708        }
709    }
710}
711
712impl OutgoingTransferable {
713    #[inline]
714    pub fn ordinal(&self) -> u64 {
715        match *self {
716            Self::MessagePort(_) => 1,
717            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
718        }
719    }
720
721    #[inline]
722    pub fn unknown_variant_for_testing() -> Self {
723        Self::__SourceBreaking { unknown_ordinal: 0 }
724    }
725
726    #[inline]
727    pub fn is_unknown(&self) -> bool {
728        match self {
729            Self::__SourceBreaking { .. } => true,
730            _ => false,
731        }
732    }
733}
734
735impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for OutgoingTransferable {}
736
737#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
738pub struct ContextMarker;
739
740impl fidl::endpoints::ProtocolMarker for ContextMarker {
741    type Proxy = ContextProxy;
742    type RequestStream = ContextRequestStream;
743    #[cfg(target_os = "fuchsia")]
744    type SynchronousProxy = ContextSynchronousProxy;
745
746    const DEBUG_NAME: &'static str = "fuchsia.web.Context";
747}
748impl fidl::endpoints::DiscoverableProtocolMarker for ContextMarker {}
749pub type ContextGetRemoteDebuggingPortResult = Result<u16, ContextError>;
750
751pub trait ContextProxyInterface: Send + Sync {
752    fn r#create_frame(
753        &self,
754        frame: fidl::endpoints::ServerEnd<FrameMarker>,
755    ) -> Result<(), fidl::Error>;
756    fn r#create_frame_with_params(
757        &self,
758        params: CreateFrameParams,
759        frame: fidl::endpoints::ServerEnd<FrameMarker>,
760    ) -> Result<(), fidl::Error>;
761    fn r#get_cookie_manager(
762        &self,
763        manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
764    ) -> Result<(), fidl::Error>;
765    type GetRemoteDebuggingPortResponseFut: std::future::Future<Output = Result<ContextGetRemoteDebuggingPortResult, fidl::Error>>
766        + Send;
767    fn r#get_remote_debugging_port(&self) -> Self::GetRemoteDebuggingPortResponseFut;
768}
769#[derive(Debug)]
770#[cfg(target_os = "fuchsia")]
771pub struct ContextSynchronousProxy {
772    client: fidl::client::sync::Client,
773}
774
775#[cfg(target_os = "fuchsia")]
776impl fidl::endpoints::SynchronousProxy for ContextSynchronousProxy {
777    type Proxy = ContextProxy;
778    type Protocol = ContextMarker;
779
780    fn from_channel(inner: fidl::Channel) -> Self {
781        Self::new(inner)
782    }
783
784    fn into_channel(self) -> fidl::Channel {
785        self.client.into_channel()
786    }
787
788    fn as_channel(&self) -> &fidl::Channel {
789        self.client.as_channel()
790    }
791}
792
793#[cfg(target_os = "fuchsia")]
794impl ContextSynchronousProxy {
795    pub fn new(channel: fidl::Channel) -> Self {
796        let protocol_name = <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
797        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
798    }
799
800    pub fn into_channel(self) -> fidl::Channel {
801        self.client.into_channel()
802    }
803
804    /// Waits until an event arrives and returns it. It is safe for other
805    /// threads to make concurrent requests while waiting for an event.
806    pub fn wait_for_event(
807        &self,
808        deadline: zx::MonotonicInstant,
809    ) -> Result<ContextEvent, fidl::Error> {
810        ContextEvent::decode(self.client.wait_for_event(deadline)?)
811    }
812
813    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
814    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
815    /// component but cannot be shared across multiple components.
816    ///
817    /// - `frame`: An interface request that will be bound to the created [`Frame`].
818    pub fn r#create_frame(
819        &self,
820        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
821    ) -> Result<(), fidl::Error> {
822        self.client.send::<ContextCreateFrameRequest>(
823            (frame,),
824            0x5440a38db7cd7d8f,
825            fidl::encoding::DynamicFlags::empty(),
826        )
827    }
828
829    /// Similar to [`Context.CreateFrame`], with extra parameters.
830    ///
831    /// - `params`: The configuration used to create the [`Frame`].
832    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
833    /// - `frame`: An interface request that will be bound to the created [`Frame`].
834    pub fn r#create_frame_with_params(
835        &self,
836        mut params: CreateFrameParams,
837        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
838    ) -> Result<(), fidl::Error> {
839        self.client.send::<ContextCreateFrameWithParamsRequest>(
840            (&mut params, frame),
841            0x2c968a330787be96,
842            fidl::encoding::DynamicFlags::empty(),
843        )
844    }
845
846    /// Used to observe cookies for sites hosted under this Context.
847    pub fn r#get_cookie_manager(
848        &self,
849        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
850    ) -> Result<(), fidl::Error> {
851        self.client.send::<ContextGetCookieManagerRequest>(
852            (manager,),
853            0x7396cda568e3fca,
854            fidl::encoding::DynamicFlags::empty(),
855        )
856    }
857
858    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
859    /// number. Multiple calls may be queued to received the port number.
860    ///
861    /// If an error occurred, the [`ContextError`] will be set to this value:
862    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
863    ///   [`CreateContextParams`] or the remote debugging service failed to start.
864    pub fn r#get_remote_debugging_port(
865        &self,
866        ___deadline: zx::MonotonicInstant,
867    ) -> Result<ContextGetRemoteDebuggingPortResult, fidl::Error> {
868        let _response =
869            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
870                ContextGetRemoteDebuggingPortResponse,
871                ContextError,
872            >>(
873                (),
874                0x4ac6a26fe972f29,
875                fidl::encoding::DynamicFlags::empty(),
876                ___deadline,
877            )?;
878        Ok(_response.map(|x| x.port))
879    }
880}
881
882#[cfg(target_os = "fuchsia")]
883impl From<ContextSynchronousProxy> for zx::NullableHandle {
884    fn from(value: ContextSynchronousProxy) -> Self {
885        value.into_channel().into()
886    }
887}
888
889#[cfg(target_os = "fuchsia")]
890impl From<fidl::Channel> for ContextSynchronousProxy {
891    fn from(value: fidl::Channel) -> Self {
892        Self::new(value)
893    }
894}
895
896#[cfg(target_os = "fuchsia")]
897impl fidl::endpoints::FromClient for ContextSynchronousProxy {
898    type Protocol = ContextMarker;
899
900    fn from_client(value: fidl::endpoints::ClientEnd<ContextMarker>) -> Self {
901        Self::new(value.into_channel())
902    }
903}
904
905#[derive(Debug, Clone)]
906pub struct ContextProxy {
907    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
908}
909
910impl fidl::endpoints::Proxy for ContextProxy {
911    type Protocol = ContextMarker;
912
913    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
914        Self::new(inner)
915    }
916
917    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
918        self.client.into_channel().map_err(|client| Self { client })
919    }
920
921    fn as_channel(&self) -> &::fidl::AsyncChannel {
922        self.client.as_channel()
923    }
924}
925
926impl ContextProxy {
927    /// Create a new Proxy for fuchsia.web/Context.
928    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
929        let protocol_name = <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
930        Self { client: fidl::client::Client::new(channel, protocol_name) }
931    }
932
933    /// Get a Stream of events from the remote end of the protocol.
934    ///
935    /// # Panics
936    ///
937    /// Panics if the event stream was already taken.
938    pub fn take_event_stream(&self) -> ContextEventStream {
939        ContextEventStream { event_receiver: self.client.take_event_receiver() }
940    }
941
942    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
943    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
944    /// component but cannot be shared across multiple components.
945    ///
946    /// - `frame`: An interface request that will be bound to the created [`Frame`].
947    pub fn r#create_frame(
948        &self,
949        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
950    ) -> Result<(), fidl::Error> {
951        ContextProxyInterface::r#create_frame(self, frame)
952    }
953
954    /// Similar to [`Context.CreateFrame`], with extra parameters.
955    ///
956    /// - `params`: The configuration used to create the [`Frame`].
957    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
958    /// - `frame`: An interface request that will be bound to the created [`Frame`].
959    pub fn r#create_frame_with_params(
960        &self,
961        mut params: CreateFrameParams,
962        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
963    ) -> Result<(), fidl::Error> {
964        ContextProxyInterface::r#create_frame_with_params(self, params, frame)
965    }
966
967    /// Used to observe cookies for sites hosted under this Context.
968    pub fn r#get_cookie_manager(
969        &self,
970        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
971    ) -> Result<(), fidl::Error> {
972        ContextProxyInterface::r#get_cookie_manager(self, manager)
973    }
974
975    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
976    /// number. Multiple calls may be queued to received the port number.
977    ///
978    /// If an error occurred, the [`ContextError`] will be set to this value:
979    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
980    ///   [`CreateContextParams`] or the remote debugging service failed to start.
981    pub fn r#get_remote_debugging_port(
982        &self,
983    ) -> fidl::client::QueryResponseFut<
984        ContextGetRemoteDebuggingPortResult,
985        fidl::encoding::DefaultFuchsiaResourceDialect,
986    > {
987        ContextProxyInterface::r#get_remote_debugging_port(self)
988    }
989}
990
991impl ContextProxyInterface for ContextProxy {
992    fn r#create_frame(
993        &self,
994        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
995    ) -> Result<(), fidl::Error> {
996        self.client.send::<ContextCreateFrameRequest>(
997            (frame,),
998            0x5440a38db7cd7d8f,
999            fidl::encoding::DynamicFlags::empty(),
1000        )
1001    }
1002
1003    fn r#create_frame_with_params(
1004        &self,
1005        mut params: CreateFrameParams,
1006        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
1007    ) -> Result<(), fidl::Error> {
1008        self.client.send::<ContextCreateFrameWithParamsRequest>(
1009            (&mut params, frame),
1010            0x2c968a330787be96,
1011            fidl::encoding::DynamicFlags::empty(),
1012        )
1013    }
1014
1015    fn r#get_cookie_manager(
1016        &self,
1017        mut manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
1018    ) -> Result<(), fidl::Error> {
1019        self.client.send::<ContextGetCookieManagerRequest>(
1020            (manager,),
1021            0x7396cda568e3fca,
1022            fidl::encoding::DynamicFlags::empty(),
1023        )
1024    }
1025
1026    type GetRemoteDebuggingPortResponseFut = fidl::client::QueryResponseFut<
1027        ContextGetRemoteDebuggingPortResult,
1028        fidl::encoding::DefaultFuchsiaResourceDialect,
1029    >;
1030    fn r#get_remote_debugging_port(&self) -> Self::GetRemoteDebuggingPortResponseFut {
1031        fn _decode(
1032            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1033        ) -> Result<ContextGetRemoteDebuggingPortResult, fidl::Error> {
1034            let _response = fidl::client::decode_transaction_body::<
1035                fidl::encoding::ResultType<ContextGetRemoteDebuggingPortResponse, ContextError>,
1036                fidl::encoding::DefaultFuchsiaResourceDialect,
1037                0x4ac6a26fe972f29,
1038            >(_buf?)?;
1039            Ok(_response.map(|x| x.port))
1040        }
1041        self.client.send_query_and_decode::<
1042            fidl::encoding::EmptyPayload,
1043            ContextGetRemoteDebuggingPortResult,
1044        >(
1045            (),
1046            0x4ac6a26fe972f29,
1047            fidl::encoding::DynamicFlags::empty(),
1048            _decode,
1049        )
1050    }
1051}
1052
1053pub struct ContextEventStream {
1054    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1055}
1056
1057impl std::marker::Unpin for ContextEventStream {}
1058
1059impl futures::stream::FusedStream for ContextEventStream {
1060    fn is_terminated(&self) -> bool {
1061        self.event_receiver.is_terminated()
1062    }
1063}
1064
1065impl futures::Stream for ContextEventStream {
1066    type Item = Result<ContextEvent, fidl::Error>;
1067
1068    fn poll_next(
1069        mut self: std::pin::Pin<&mut Self>,
1070        cx: &mut std::task::Context<'_>,
1071    ) -> std::task::Poll<Option<Self::Item>> {
1072        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1073            &mut self.event_receiver,
1074            cx
1075        )?) {
1076            Some(buf) => std::task::Poll::Ready(Some(ContextEvent::decode(buf))),
1077            None => std::task::Poll::Ready(None),
1078        }
1079    }
1080}
1081
1082#[derive(Debug)]
1083pub enum ContextEvent {}
1084
1085impl ContextEvent {
1086    /// Decodes a message buffer as a [`ContextEvent`].
1087    fn decode(
1088        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1089    ) -> Result<ContextEvent, fidl::Error> {
1090        let (bytes, _handles) = buf.split_mut();
1091        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1092        debug_assert_eq!(tx_header.tx_id, 0);
1093        match tx_header.ordinal {
1094            _ => Err(fidl::Error::UnknownOrdinal {
1095                ordinal: tx_header.ordinal,
1096                protocol_name: <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1097            }),
1098        }
1099    }
1100}
1101
1102/// A Stream of incoming requests for fuchsia.web/Context.
1103pub struct ContextRequestStream {
1104    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1105    is_terminated: bool,
1106}
1107
1108impl std::marker::Unpin for ContextRequestStream {}
1109
1110impl futures::stream::FusedStream for ContextRequestStream {
1111    fn is_terminated(&self) -> bool {
1112        self.is_terminated
1113    }
1114}
1115
1116impl fidl::endpoints::RequestStream for ContextRequestStream {
1117    type Protocol = ContextMarker;
1118    type ControlHandle = ContextControlHandle;
1119
1120    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1121        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1122    }
1123
1124    fn control_handle(&self) -> Self::ControlHandle {
1125        ContextControlHandle { inner: self.inner.clone() }
1126    }
1127
1128    fn into_inner(
1129        self,
1130    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1131    {
1132        (self.inner, self.is_terminated)
1133    }
1134
1135    fn from_inner(
1136        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1137        is_terminated: bool,
1138    ) -> Self {
1139        Self { inner, is_terminated }
1140    }
1141}
1142
1143impl futures::Stream for ContextRequestStream {
1144    type Item = Result<ContextRequest, fidl::Error>;
1145
1146    fn poll_next(
1147        mut self: std::pin::Pin<&mut Self>,
1148        cx: &mut std::task::Context<'_>,
1149    ) -> std::task::Poll<Option<Self::Item>> {
1150        let this = &mut *self;
1151        if this.inner.check_shutdown(cx) {
1152            this.is_terminated = true;
1153            return std::task::Poll::Ready(None);
1154        }
1155        if this.is_terminated {
1156            panic!("polled ContextRequestStream after completion");
1157        }
1158        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1159            |bytes, handles| {
1160                match this.inner.channel().read_etc(cx, bytes, handles) {
1161                    std::task::Poll::Ready(Ok(())) => {}
1162                    std::task::Poll::Pending => return std::task::Poll::Pending,
1163                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1164                        this.is_terminated = true;
1165                        return std::task::Poll::Ready(None);
1166                    }
1167                    std::task::Poll::Ready(Err(e)) => {
1168                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1169                            e.into(),
1170                        ))));
1171                    }
1172                }
1173
1174                // A message has been received from the channel
1175                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1176
1177                std::task::Poll::Ready(Some(match header.ordinal {
1178                    0x5440a38db7cd7d8f => {
1179                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1180                        let mut req = fidl::new_empty!(
1181                            ContextCreateFrameRequest,
1182                            fidl::encoding::DefaultFuchsiaResourceDialect
1183                        );
1184                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextCreateFrameRequest>(&header, _body_bytes, handles, &mut req)?;
1185                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1186                        Ok(ContextRequest::CreateFrame { frame: req.frame, control_handle })
1187                    }
1188                    0x2c968a330787be96 => {
1189                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1190                        let mut req = fidl::new_empty!(
1191                            ContextCreateFrameWithParamsRequest,
1192                            fidl::encoding::DefaultFuchsiaResourceDialect
1193                        );
1194                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextCreateFrameWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
1195                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1196                        Ok(ContextRequest::CreateFrameWithParams {
1197                            params: req.params,
1198                            frame: req.frame,
1199
1200                            control_handle,
1201                        })
1202                    }
1203                    0x7396cda568e3fca => {
1204                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1205                        let mut req = fidl::new_empty!(
1206                            ContextGetCookieManagerRequest,
1207                            fidl::encoding::DefaultFuchsiaResourceDialect
1208                        );
1209                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextGetCookieManagerRequest>(&header, _body_bytes, handles, &mut req)?;
1210                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1211                        Ok(ContextRequest::GetCookieManager {
1212                            manager: req.manager,
1213
1214                            control_handle,
1215                        })
1216                    }
1217                    0x4ac6a26fe972f29 => {
1218                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1219                        let mut req = fidl::new_empty!(
1220                            fidl::encoding::EmptyPayload,
1221                            fidl::encoding::DefaultFuchsiaResourceDialect
1222                        );
1223                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1224                        let control_handle = ContextControlHandle { inner: this.inner.clone() };
1225                        Ok(ContextRequest::GetRemoteDebuggingPort {
1226                            responder: ContextGetRemoteDebuggingPortResponder {
1227                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1228                                tx_id: header.tx_id,
1229                            },
1230                        })
1231                    }
1232                    _ => Err(fidl::Error::UnknownOrdinal {
1233                        ordinal: header.ordinal,
1234                        protocol_name:
1235                            <ContextMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1236                    }),
1237                }))
1238            },
1239        )
1240    }
1241}
1242
1243/// Manages browsing state (e.g. LocalStorage, cookies, etc) associated with a set of [`Frame`].
1244#[derive(Debug)]
1245pub enum ContextRequest {
1246    /// Creates a new [`Frame`] under this [`Context`]. Destruction of a [`Context`] triggers the
1247    /// destruction of all of its associated [`Frame`]. [`Frame`] can be transferred to another
1248    /// component but cannot be shared across multiple components.
1249    ///
1250    /// - `frame`: An interface request that will be bound to the created [`Frame`].
1251    CreateFrame {
1252        frame: fidl::endpoints::ServerEnd<FrameMarker>,
1253        control_handle: ContextControlHandle,
1254    },
1255    /// Similar to [`Context.CreateFrame`], with extra parameters.
1256    ///
1257    /// - `params`: The configuration used to create the [`Frame`].
1258    ///   This method will fail with `ZX_ERR_INVALID_ARGS` if the table is not clonable.
1259    /// - `frame`: An interface request that will be bound to the created [`Frame`].
1260    CreateFrameWithParams {
1261        params: CreateFrameParams,
1262        frame: fidl::endpoints::ServerEnd<FrameMarker>,
1263        control_handle: ContextControlHandle,
1264    },
1265    /// Used to observe cookies for sites hosted under this Context.
1266    GetCookieManager {
1267        manager: fidl::endpoints::ServerEnd<CookieManagerMarker>,
1268        control_handle: ContextControlHandle,
1269    },
1270    /// Waits until debugging is available on one or more Frames, and returns the DevTools port
1271    /// number. Multiple calls may be queued to received the port number.
1272    ///
1273    /// If an error occurred, the [`ContextError`] will be set to this value:
1274    /// - `REMOTE_DEBUGGING_PORT_NOT_OPENED`: `remote_debugging_port` was not set in
1275    ///   [`CreateContextParams`] or the remote debugging service failed to start.
1276    GetRemoteDebuggingPort { responder: ContextGetRemoteDebuggingPortResponder },
1277}
1278
1279impl ContextRequest {
1280    #[allow(irrefutable_let_patterns)]
1281    pub fn into_create_frame(
1282        self,
1283    ) -> Option<(fidl::endpoints::ServerEnd<FrameMarker>, ContextControlHandle)> {
1284        if let ContextRequest::CreateFrame { frame, control_handle } = self {
1285            Some((frame, control_handle))
1286        } else {
1287            None
1288        }
1289    }
1290
1291    #[allow(irrefutable_let_patterns)]
1292    pub fn into_create_frame_with_params(
1293        self,
1294    ) -> Option<(CreateFrameParams, fidl::endpoints::ServerEnd<FrameMarker>, ContextControlHandle)>
1295    {
1296        if let ContextRequest::CreateFrameWithParams { params, frame, control_handle } = self {
1297            Some((params, frame, control_handle))
1298        } else {
1299            None
1300        }
1301    }
1302
1303    #[allow(irrefutable_let_patterns)]
1304    pub fn into_get_cookie_manager(
1305        self,
1306    ) -> Option<(fidl::endpoints::ServerEnd<CookieManagerMarker>, ContextControlHandle)> {
1307        if let ContextRequest::GetCookieManager { manager, control_handle } = self {
1308            Some((manager, control_handle))
1309        } else {
1310            None
1311        }
1312    }
1313
1314    #[allow(irrefutable_let_patterns)]
1315    pub fn into_get_remote_debugging_port(
1316        self,
1317    ) -> Option<(ContextGetRemoteDebuggingPortResponder)> {
1318        if let ContextRequest::GetRemoteDebuggingPort { responder } = self {
1319            Some((responder))
1320        } else {
1321            None
1322        }
1323    }
1324
1325    /// Name of the method defined in FIDL
1326    pub fn method_name(&self) -> &'static str {
1327        match *self {
1328            ContextRequest::CreateFrame { .. } => "create_frame",
1329            ContextRequest::CreateFrameWithParams { .. } => "create_frame_with_params",
1330            ContextRequest::GetCookieManager { .. } => "get_cookie_manager",
1331            ContextRequest::GetRemoteDebuggingPort { .. } => "get_remote_debugging_port",
1332        }
1333    }
1334}
1335
1336#[derive(Debug, Clone)]
1337pub struct ContextControlHandle {
1338    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1339}
1340
1341impl fidl::endpoints::ControlHandle for ContextControlHandle {
1342    fn shutdown(&self) {
1343        self.inner.shutdown()
1344    }
1345
1346    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1347        self.inner.shutdown_with_epitaph(status)
1348    }
1349
1350    fn is_closed(&self) -> bool {
1351        self.inner.channel().is_closed()
1352    }
1353    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1354        self.inner.channel().on_closed()
1355    }
1356
1357    #[cfg(target_os = "fuchsia")]
1358    fn signal_peer(
1359        &self,
1360        clear_mask: zx::Signals,
1361        set_mask: zx::Signals,
1362    ) -> Result<(), zx_status::Status> {
1363        use fidl::Peered;
1364        self.inner.channel().signal_peer(clear_mask, set_mask)
1365    }
1366}
1367
1368impl ContextControlHandle {}
1369
1370#[must_use = "FIDL methods require a response to be sent"]
1371#[derive(Debug)]
1372pub struct ContextGetRemoteDebuggingPortResponder {
1373    control_handle: std::mem::ManuallyDrop<ContextControlHandle>,
1374    tx_id: u32,
1375}
1376
1377/// Set the the channel to be shutdown (see [`ContextControlHandle::shutdown`])
1378/// if the responder is dropped without sending a response, so that the client
1379/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1380impl std::ops::Drop for ContextGetRemoteDebuggingPortResponder {
1381    fn drop(&mut self) {
1382        self.control_handle.shutdown();
1383        // Safety: drops once, never accessed again
1384        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1385    }
1386}
1387
1388impl fidl::endpoints::Responder for ContextGetRemoteDebuggingPortResponder {
1389    type ControlHandle = ContextControlHandle;
1390
1391    fn control_handle(&self) -> &ContextControlHandle {
1392        &self.control_handle
1393    }
1394
1395    fn drop_without_shutdown(mut self) {
1396        // Safety: drops once, never accessed again due to mem::forget
1397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1398        // Prevent Drop from running (which would shut down the channel)
1399        std::mem::forget(self);
1400    }
1401}
1402
1403impl ContextGetRemoteDebuggingPortResponder {
1404    /// Sends a response to the FIDL transaction.
1405    ///
1406    /// Sets the channel to shutdown if an error occurs.
1407    pub fn send(self, mut result: Result<u16, ContextError>) -> Result<(), fidl::Error> {
1408        let _result = self.send_raw(result);
1409        if _result.is_err() {
1410            self.control_handle.shutdown();
1411        }
1412        self.drop_without_shutdown();
1413        _result
1414    }
1415
1416    /// Similar to "send" but does not shutdown the channel if an error occurs.
1417    pub fn send_no_shutdown_on_err(
1418        self,
1419        mut result: Result<u16, ContextError>,
1420    ) -> Result<(), fidl::Error> {
1421        let _result = self.send_raw(result);
1422        self.drop_without_shutdown();
1423        _result
1424    }
1425
1426    fn send_raw(&self, mut result: Result<u16, ContextError>) -> Result<(), fidl::Error> {
1427        self.control_handle.inner.send::<fidl::encoding::ResultType<
1428            ContextGetRemoteDebuggingPortResponse,
1429            ContextError,
1430        >>(
1431            result.map(|port| (port,)),
1432            self.tx_id,
1433            0x4ac6a26fe972f29,
1434            fidl::encoding::DynamicFlags::empty(),
1435        )
1436    }
1437}
1438
1439#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1440pub struct ContextProviderMarker;
1441
1442impl fidl::endpoints::ProtocolMarker for ContextProviderMarker {
1443    type Proxy = ContextProviderProxy;
1444    type RequestStream = ContextProviderRequestStream;
1445    #[cfg(target_os = "fuchsia")]
1446    type SynchronousProxy = ContextProviderSynchronousProxy;
1447
1448    const DEBUG_NAME: &'static str = "fuchsia.web.ContextProvider";
1449}
1450impl fidl::endpoints::DiscoverableProtocolMarker for ContextProviderMarker {}
1451
1452pub trait ContextProviderProxyInterface: Send + Sync {
1453    fn r#create(
1454        &self,
1455        params: CreateContextParams,
1456        context: fidl::endpoints::ServerEnd<ContextMarker>,
1457    ) -> Result<(), fidl::Error>;
1458}
1459#[derive(Debug)]
1460#[cfg(target_os = "fuchsia")]
1461pub struct ContextProviderSynchronousProxy {
1462    client: fidl::client::sync::Client,
1463}
1464
1465#[cfg(target_os = "fuchsia")]
1466impl fidl::endpoints::SynchronousProxy for ContextProviderSynchronousProxy {
1467    type Proxy = ContextProviderProxy;
1468    type Protocol = ContextProviderMarker;
1469
1470    fn from_channel(inner: fidl::Channel) -> Self {
1471        Self::new(inner)
1472    }
1473
1474    fn into_channel(self) -> fidl::Channel {
1475        self.client.into_channel()
1476    }
1477
1478    fn as_channel(&self) -> &fidl::Channel {
1479        self.client.as_channel()
1480    }
1481}
1482
1483#[cfg(target_os = "fuchsia")]
1484impl ContextProviderSynchronousProxy {
1485    pub fn new(channel: fidl::Channel) -> Self {
1486        let protocol_name = <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1487        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1488    }
1489
1490    pub fn into_channel(self) -> fidl::Channel {
1491        self.client.into_channel()
1492    }
1493
1494    /// Waits until an event arrives and returns it. It is safe for other
1495    /// threads to make concurrent requests while waiting for an event.
1496    pub fn wait_for_event(
1497        &self,
1498        deadline: zx::MonotonicInstant,
1499    ) -> Result<ContextProviderEvent, fidl::Error> {
1500        ContextProviderEvent::decode(self.client.wait_for_event(deadline)?)
1501    }
1502
1503    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1504    /// [`Context`](`Contexts`).
1505    ///
1506    /// - `params`: The configuration used to create the [`Context`].
1507    /// - `context`: An interface request which will receive a bound [`Context`]
1508    ///   service.
1509    pub fn r#create(
1510        &self,
1511        mut params: CreateContextParams,
1512        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1513    ) -> Result<(), fidl::Error> {
1514        self.client.send::<ContextProviderCreateRequest>(
1515            (&mut params, context),
1516            0x6ee6fa35978eb98d,
1517            fidl::encoding::DynamicFlags::empty(),
1518        )
1519    }
1520}
1521
1522#[cfg(target_os = "fuchsia")]
1523impl From<ContextProviderSynchronousProxy> for zx::NullableHandle {
1524    fn from(value: ContextProviderSynchronousProxy) -> Self {
1525        value.into_channel().into()
1526    }
1527}
1528
1529#[cfg(target_os = "fuchsia")]
1530impl From<fidl::Channel> for ContextProviderSynchronousProxy {
1531    fn from(value: fidl::Channel) -> Self {
1532        Self::new(value)
1533    }
1534}
1535
1536#[cfg(target_os = "fuchsia")]
1537impl fidl::endpoints::FromClient for ContextProviderSynchronousProxy {
1538    type Protocol = ContextProviderMarker;
1539
1540    fn from_client(value: fidl::endpoints::ClientEnd<ContextProviderMarker>) -> Self {
1541        Self::new(value.into_channel())
1542    }
1543}
1544
1545#[derive(Debug, Clone)]
1546pub struct ContextProviderProxy {
1547    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1548}
1549
1550impl fidl::endpoints::Proxy for ContextProviderProxy {
1551    type Protocol = ContextProviderMarker;
1552
1553    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1554        Self::new(inner)
1555    }
1556
1557    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1558        self.client.into_channel().map_err(|client| Self { client })
1559    }
1560
1561    fn as_channel(&self) -> &::fidl::AsyncChannel {
1562        self.client.as_channel()
1563    }
1564}
1565
1566impl ContextProviderProxy {
1567    /// Create a new Proxy for fuchsia.web/ContextProvider.
1568    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1569        let protocol_name = <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1570        Self { client: fidl::client::Client::new(channel, protocol_name) }
1571    }
1572
1573    /// Get a Stream of events from the remote end of the protocol.
1574    ///
1575    /// # Panics
1576    ///
1577    /// Panics if the event stream was already taken.
1578    pub fn take_event_stream(&self) -> ContextProviderEventStream {
1579        ContextProviderEventStream { event_receiver: self.client.take_event_receiver() }
1580    }
1581
1582    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1583    /// [`Context`](`Contexts`).
1584    ///
1585    /// - `params`: The configuration used to create the [`Context`].
1586    /// - `context`: An interface request which will receive a bound [`Context`]
1587    ///   service.
1588    pub fn r#create(
1589        &self,
1590        mut params: CreateContextParams,
1591        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1592    ) -> Result<(), fidl::Error> {
1593        ContextProviderProxyInterface::r#create(self, params, context)
1594    }
1595}
1596
1597impl ContextProviderProxyInterface for ContextProviderProxy {
1598    fn r#create(
1599        &self,
1600        mut params: CreateContextParams,
1601        mut context: fidl::endpoints::ServerEnd<ContextMarker>,
1602    ) -> Result<(), fidl::Error> {
1603        self.client.send::<ContextProviderCreateRequest>(
1604            (&mut params, context),
1605            0x6ee6fa35978eb98d,
1606            fidl::encoding::DynamicFlags::empty(),
1607        )
1608    }
1609}
1610
1611pub struct ContextProviderEventStream {
1612    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1613}
1614
1615impl std::marker::Unpin for ContextProviderEventStream {}
1616
1617impl futures::stream::FusedStream for ContextProviderEventStream {
1618    fn is_terminated(&self) -> bool {
1619        self.event_receiver.is_terminated()
1620    }
1621}
1622
1623impl futures::Stream for ContextProviderEventStream {
1624    type Item = Result<ContextProviderEvent, fidl::Error>;
1625
1626    fn poll_next(
1627        mut self: std::pin::Pin<&mut Self>,
1628        cx: &mut std::task::Context<'_>,
1629    ) -> std::task::Poll<Option<Self::Item>> {
1630        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1631            &mut self.event_receiver,
1632            cx
1633        )?) {
1634            Some(buf) => std::task::Poll::Ready(Some(ContextProviderEvent::decode(buf))),
1635            None => std::task::Poll::Ready(None),
1636        }
1637    }
1638}
1639
1640#[derive(Debug)]
1641pub enum ContextProviderEvent {}
1642
1643impl ContextProviderEvent {
1644    /// Decodes a message buffer as a [`ContextProviderEvent`].
1645    fn decode(
1646        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1647    ) -> Result<ContextProviderEvent, fidl::Error> {
1648        let (bytes, _handles) = buf.split_mut();
1649        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1650        debug_assert_eq!(tx_header.tx_id, 0);
1651        match tx_header.ordinal {
1652            _ => Err(fidl::Error::UnknownOrdinal {
1653                ordinal: tx_header.ordinal,
1654                protocol_name:
1655                    <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1656            }),
1657        }
1658    }
1659}
1660
1661/// A Stream of incoming requests for fuchsia.web/ContextProvider.
1662pub struct ContextProviderRequestStream {
1663    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1664    is_terminated: bool,
1665}
1666
1667impl std::marker::Unpin for ContextProviderRequestStream {}
1668
1669impl futures::stream::FusedStream for ContextProviderRequestStream {
1670    fn is_terminated(&self) -> bool {
1671        self.is_terminated
1672    }
1673}
1674
1675impl fidl::endpoints::RequestStream for ContextProviderRequestStream {
1676    type Protocol = ContextProviderMarker;
1677    type ControlHandle = ContextProviderControlHandle;
1678
1679    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1680        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1681    }
1682
1683    fn control_handle(&self) -> Self::ControlHandle {
1684        ContextProviderControlHandle { inner: self.inner.clone() }
1685    }
1686
1687    fn into_inner(
1688        self,
1689    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1690    {
1691        (self.inner, self.is_terminated)
1692    }
1693
1694    fn from_inner(
1695        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1696        is_terminated: bool,
1697    ) -> Self {
1698        Self { inner, is_terminated }
1699    }
1700}
1701
1702impl futures::Stream for ContextProviderRequestStream {
1703    type Item = Result<ContextProviderRequest, fidl::Error>;
1704
1705    fn poll_next(
1706        mut self: std::pin::Pin<&mut Self>,
1707        cx: &mut std::task::Context<'_>,
1708    ) -> std::task::Poll<Option<Self::Item>> {
1709        let this = &mut *self;
1710        if this.inner.check_shutdown(cx) {
1711            this.is_terminated = true;
1712            return std::task::Poll::Ready(None);
1713        }
1714        if this.is_terminated {
1715            panic!("polled ContextProviderRequestStream after completion");
1716        }
1717        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1718            |bytes, handles| {
1719                match this.inner.channel().read_etc(cx, bytes, handles) {
1720                    std::task::Poll::Ready(Ok(())) => {}
1721                    std::task::Poll::Pending => return std::task::Poll::Pending,
1722                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1723                        this.is_terminated = true;
1724                        return std::task::Poll::Ready(None);
1725                    }
1726                    std::task::Poll::Ready(Err(e)) => {
1727                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1728                            e.into(),
1729                        ))));
1730                    }
1731                }
1732
1733                // A message has been received from the channel
1734                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1735
1736                std::task::Poll::Ready(Some(match header.ordinal {
1737                    0x6ee6fa35978eb98d => {
1738                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1739                        let mut req = fidl::new_empty!(
1740                            ContextProviderCreateRequest,
1741                            fidl::encoding::DefaultFuchsiaResourceDialect
1742                        );
1743                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ContextProviderCreateRequest>(&header, _body_bytes, handles, &mut req)?;
1744                        let control_handle =
1745                            ContextProviderControlHandle { inner: this.inner.clone() };
1746                        Ok(ContextProviderRequest::Create {
1747                            params: req.params,
1748                            context: req.context,
1749
1750                            control_handle,
1751                        })
1752                    }
1753                    _ => Err(fidl::Error::UnknownOrdinal {
1754                        ordinal: header.ordinal,
1755                        protocol_name:
1756                            <ContextProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1757                    }),
1758                }))
1759            },
1760        )
1761    }
1762}
1763
1764/// The top-level service interface which allows for the creation of Context resources.
1765#[derive(Debug)]
1766pub enum ContextProviderRequest {
1767    /// Creates a new browser [`Context`] whose state is wholly independent and isolated from other
1768    /// [`Context`](`Contexts`).
1769    ///
1770    /// - `params`: The configuration used to create the [`Context`].
1771    /// - `context`: An interface request which will receive a bound [`Context`]
1772    ///   service.
1773    Create {
1774        params: CreateContextParams,
1775        context: fidl::endpoints::ServerEnd<ContextMarker>,
1776        control_handle: ContextProviderControlHandle,
1777    },
1778}
1779
1780impl ContextProviderRequest {
1781    #[allow(irrefutable_let_patterns)]
1782    pub fn into_create(
1783        self,
1784    ) -> Option<(
1785        CreateContextParams,
1786        fidl::endpoints::ServerEnd<ContextMarker>,
1787        ContextProviderControlHandle,
1788    )> {
1789        if let ContextProviderRequest::Create { params, context, control_handle } = self {
1790            Some((params, context, control_handle))
1791        } else {
1792            None
1793        }
1794    }
1795
1796    /// Name of the method defined in FIDL
1797    pub fn method_name(&self) -> &'static str {
1798        match *self {
1799            ContextProviderRequest::Create { .. } => "create",
1800        }
1801    }
1802}
1803
1804#[derive(Debug, Clone)]
1805pub struct ContextProviderControlHandle {
1806    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1807}
1808
1809impl fidl::endpoints::ControlHandle for ContextProviderControlHandle {
1810    fn shutdown(&self) {
1811        self.inner.shutdown()
1812    }
1813
1814    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1815        self.inner.shutdown_with_epitaph(status)
1816    }
1817
1818    fn is_closed(&self) -> bool {
1819        self.inner.channel().is_closed()
1820    }
1821    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1822        self.inner.channel().on_closed()
1823    }
1824
1825    #[cfg(target_os = "fuchsia")]
1826    fn signal_peer(
1827        &self,
1828        clear_mask: zx::Signals,
1829        set_mask: zx::Signals,
1830    ) -> Result<(), zx_status::Status> {
1831        use fidl::Peered;
1832        self.inner.channel().signal_peer(clear_mask, set_mask)
1833    }
1834}
1835
1836impl ContextProviderControlHandle {}
1837
1838#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1839pub struct CookieManagerMarker;
1840
1841impl fidl::endpoints::ProtocolMarker for CookieManagerMarker {
1842    type Proxy = CookieManagerProxy;
1843    type RequestStream = CookieManagerRequestStream;
1844    #[cfg(target_os = "fuchsia")]
1845    type SynchronousProxy = CookieManagerSynchronousProxy;
1846
1847    const DEBUG_NAME: &'static str = "(anonymous) CookieManager";
1848}
1849
1850pub trait CookieManagerProxyInterface: Send + Sync {
1851    fn r#observe_cookie_changes(
1852        &self,
1853        url: Option<&str>,
1854        name: Option<&str>,
1855        changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1856    ) -> Result<(), fidl::Error>;
1857    fn r#get_cookie_list(
1858        &self,
1859        url: Option<&str>,
1860        name: Option<&str>,
1861        cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1862    ) -> Result<(), fidl::Error>;
1863}
1864#[derive(Debug)]
1865#[cfg(target_os = "fuchsia")]
1866pub struct CookieManagerSynchronousProxy {
1867    client: fidl::client::sync::Client,
1868}
1869
1870#[cfg(target_os = "fuchsia")]
1871impl fidl::endpoints::SynchronousProxy for CookieManagerSynchronousProxy {
1872    type Proxy = CookieManagerProxy;
1873    type Protocol = CookieManagerMarker;
1874
1875    fn from_channel(inner: fidl::Channel) -> Self {
1876        Self::new(inner)
1877    }
1878
1879    fn into_channel(self) -> fidl::Channel {
1880        self.client.into_channel()
1881    }
1882
1883    fn as_channel(&self) -> &fidl::Channel {
1884        self.client.as_channel()
1885    }
1886}
1887
1888#[cfg(target_os = "fuchsia")]
1889impl CookieManagerSynchronousProxy {
1890    pub fn new(channel: fidl::Channel) -> Self {
1891        let protocol_name = <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1892        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1893    }
1894
1895    pub fn into_channel(self) -> fidl::Channel {
1896        self.client.into_channel()
1897    }
1898
1899    /// Waits until an event arrives and returns it. It is safe for other
1900    /// threads to make concurrent requests while waiting for an event.
1901    pub fn wait_for_event(
1902        &self,
1903        deadline: zx::MonotonicInstant,
1904    ) -> Result<CookieManagerEvent, fidl::Error> {
1905        CookieManagerEvent::decode(self.client.wait_for_event(deadline)?)
1906    }
1907
1908    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
1909    ///
1910    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
1911    /// then all cookies for that URL are observed. If both are set then only cookies matching both
1912    /// fields are observed.
1913    ///
1914    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
1915    /// complete cookies, while deletions are expressed as cookies with no `value` set.
1916    pub fn r#observe_cookie_changes(
1917        &self,
1918        mut url: Option<&str>,
1919        mut name: Option<&str>,
1920        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1921    ) -> Result<(), fidl::Error> {
1922        self.client.send::<CookieManagerObserveCookieChangesRequest>(
1923            (url, name, changes),
1924            0x49d8259726088b2,
1925            fidl::encoding::DynamicFlags::empty(),
1926        )
1927    }
1928
1929    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
1930    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
1931    pub fn r#get_cookie_list(
1932        &self,
1933        mut url: Option<&str>,
1934        mut name: Option<&str>,
1935        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
1936    ) -> Result<(), fidl::Error> {
1937        self.client.send::<CookieManagerGetCookieListRequest>(
1938            (url, name, cookies),
1939            0x391d79f54044f334,
1940            fidl::encoding::DynamicFlags::empty(),
1941        )
1942    }
1943}
1944
1945#[cfg(target_os = "fuchsia")]
1946impl From<CookieManagerSynchronousProxy> for zx::NullableHandle {
1947    fn from(value: CookieManagerSynchronousProxy) -> Self {
1948        value.into_channel().into()
1949    }
1950}
1951
1952#[cfg(target_os = "fuchsia")]
1953impl From<fidl::Channel> for CookieManagerSynchronousProxy {
1954    fn from(value: fidl::Channel) -> Self {
1955        Self::new(value)
1956    }
1957}
1958
1959#[cfg(target_os = "fuchsia")]
1960impl fidl::endpoints::FromClient for CookieManagerSynchronousProxy {
1961    type Protocol = CookieManagerMarker;
1962
1963    fn from_client(value: fidl::endpoints::ClientEnd<CookieManagerMarker>) -> Self {
1964        Self::new(value.into_channel())
1965    }
1966}
1967
1968#[derive(Debug, Clone)]
1969pub struct CookieManagerProxy {
1970    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1971}
1972
1973impl fidl::endpoints::Proxy for CookieManagerProxy {
1974    type Protocol = CookieManagerMarker;
1975
1976    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1977        Self::new(inner)
1978    }
1979
1980    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1981        self.client.into_channel().map_err(|client| Self { client })
1982    }
1983
1984    fn as_channel(&self) -> &::fidl::AsyncChannel {
1985        self.client.as_channel()
1986    }
1987}
1988
1989impl CookieManagerProxy {
1990    /// Create a new Proxy for fuchsia.web/CookieManager.
1991    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1992        let protocol_name = <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1993        Self { client: fidl::client::Client::new(channel, protocol_name) }
1994    }
1995
1996    /// Get a Stream of events from the remote end of the protocol.
1997    ///
1998    /// # Panics
1999    ///
2000    /// Panics if the event stream was already taken.
2001    pub fn take_event_stream(&self) -> CookieManagerEventStream {
2002        CookieManagerEventStream { event_receiver: self.client.take_event_receiver() }
2003    }
2004
2005    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
2006    ///
2007    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
2008    /// then all cookies for that URL are observed. If both are set then only cookies matching both
2009    /// fields are observed.
2010    ///
2011    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
2012    /// complete cookies, while deletions are expressed as cookies with no `value` set.
2013    pub fn r#observe_cookie_changes(
2014        &self,
2015        mut url: Option<&str>,
2016        mut name: Option<&str>,
2017        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2018    ) -> Result<(), fidl::Error> {
2019        CookieManagerProxyInterface::r#observe_cookie_changes(self, url, name, changes)
2020    }
2021
2022    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
2023    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
2024    pub fn r#get_cookie_list(
2025        &self,
2026        mut url: Option<&str>,
2027        mut name: Option<&str>,
2028        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2029    ) -> Result<(), fidl::Error> {
2030        CookieManagerProxyInterface::r#get_cookie_list(self, url, name, cookies)
2031    }
2032}
2033
2034impl CookieManagerProxyInterface for CookieManagerProxy {
2035    fn r#observe_cookie_changes(
2036        &self,
2037        mut url: Option<&str>,
2038        mut name: Option<&str>,
2039        mut changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2040    ) -> Result<(), fidl::Error> {
2041        self.client.send::<CookieManagerObserveCookieChangesRequest>(
2042            (url, name, changes),
2043            0x49d8259726088b2,
2044            fidl::encoding::DynamicFlags::empty(),
2045        )
2046    }
2047
2048    fn r#get_cookie_list(
2049        &self,
2050        mut url: Option<&str>,
2051        mut name: Option<&str>,
2052        mut cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2053    ) -> Result<(), fidl::Error> {
2054        self.client.send::<CookieManagerGetCookieListRequest>(
2055            (url, name, cookies),
2056            0x391d79f54044f334,
2057            fidl::encoding::DynamicFlags::empty(),
2058        )
2059    }
2060}
2061
2062pub struct CookieManagerEventStream {
2063    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2064}
2065
2066impl std::marker::Unpin for CookieManagerEventStream {}
2067
2068impl futures::stream::FusedStream for CookieManagerEventStream {
2069    fn is_terminated(&self) -> bool {
2070        self.event_receiver.is_terminated()
2071    }
2072}
2073
2074impl futures::Stream for CookieManagerEventStream {
2075    type Item = Result<CookieManagerEvent, fidl::Error>;
2076
2077    fn poll_next(
2078        mut self: std::pin::Pin<&mut Self>,
2079        cx: &mut std::task::Context<'_>,
2080    ) -> std::task::Poll<Option<Self::Item>> {
2081        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2082            &mut self.event_receiver,
2083            cx
2084        )?) {
2085            Some(buf) => std::task::Poll::Ready(Some(CookieManagerEvent::decode(buf))),
2086            None => std::task::Poll::Ready(None),
2087        }
2088    }
2089}
2090
2091#[derive(Debug)]
2092pub enum CookieManagerEvent {}
2093
2094impl CookieManagerEvent {
2095    /// Decodes a message buffer as a [`CookieManagerEvent`].
2096    fn decode(
2097        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2098    ) -> Result<CookieManagerEvent, fidl::Error> {
2099        let (bytes, _handles) = buf.split_mut();
2100        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2101        debug_assert_eq!(tx_header.tx_id, 0);
2102        match tx_header.ordinal {
2103            _ => Err(fidl::Error::UnknownOrdinal {
2104                ordinal: tx_header.ordinal,
2105                protocol_name: <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2106            }),
2107        }
2108    }
2109}
2110
2111/// A Stream of incoming requests for fuchsia.web/CookieManager.
2112pub struct CookieManagerRequestStream {
2113    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2114    is_terminated: bool,
2115}
2116
2117impl std::marker::Unpin for CookieManagerRequestStream {}
2118
2119impl futures::stream::FusedStream for CookieManagerRequestStream {
2120    fn is_terminated(&self) -> bool {
2121        self.is_terminated
2122    }
2123}
2124
2125impl fidl::endpoints::RequestStream for CookieManagerRequestStream {
2126    type Protocol = CookieManagerMarker;
2127    type ControlHandle = CookieManagerControlHandle;
2128
2129    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2130        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2131    }
2132
2133    fn control_handle(&self) -> Self::ControlHandle {
2134        CookieManagerControlHandle { inner: self.inner.clone() }
2135    }
2136
2137    fn into_inner(
2138        self,
2139    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2140    {
2141        (self.inner, self.is_terminated)
2142    }
2143
2144    fn from_inner(
2145        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2146        is_terminated: bool,
2147    ) -> Self {
2148        Self { inner, is_terminated }
2149    }
2150}
2151
2152impl futures::Stream for CookieManagerRequestStream {
2153    type Item = Result<CookieManagerRequest, fidl::Error>;
2154
2155    fn poll_next(
2156        mut self: std::pin::Pin<&mut Self>,
2157        cx: &mut std::task::Context<'_>,
2158    ) -> std::task::Poll<Option<Self::Item>> {
2159        let this = &mut *self;
2160        if this.inner.check_shutdown(cx) {
2161            this.is_terminated = true;
2162            return std::task::Poll::Ready(None);
2163        }
2164        if this.is_terminated {
2165            panic!("polled CookieManagerRequestStream after completion");
2166        }
2167        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2168            |bytes, handles| {
2169                match this.inner.channel().read_etc(cx, bytes, handles) {
2170                    std::task::Poll::Ready(Ok(())) => {}
2171                    std::task::Poll::Pending => return std::task::Poll::Pending,
2172                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2173                        this.is_terminated = true;
2174                        return std::task::Poll::Ready(None);
2175                    }
2176                    std::task::Poll::Ready(Err(e)) => {
2177                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2178                            e.into(),
2179                        ))));
2180                    }
2181                }
2182
2183                // A message has been received from the channel
2184                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2185
2186                std::task::Poll::Ready(Some(match header.ordinal {
2187                    0x49d8259726088b2 => {
2188                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2189                        let mut req = fidl::new_empty!(
2190                            CookieManagerObserveCookieChangesRequest,
2191                            fidl::encoding::DefaultFuchsiaResourceDialect
2192                        );
2193                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CookieManagerObserveCookieChangesRequest>(&header, _body_bytes, handles, &mut req)?;
2194                        let control_handle =
2195                            CookieManagerControlHandle { inner: this.inner.clone() };
2196                        Ok(CookieManagerRequest::ObserveCookieChanges {
2197                            url: req.url,
2198                            name: req.name,
2199                            changes: req.changes,
2200
2201                            control_handle,
2202                        })
2203                    }
2204                    0x391d79f54044f334 => {
2205                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2206                        let mut req = fidl::new_empty!(
2207                            CookieManagerGetCookieListRequest,
2208                            fidl::encoding::DefaultFuchsiaResourceDialect
2209                        );
2210                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CookieManagerGetCookieListRequest>(&header, _body_bytes, handles, &mut req)?;
2211                        let control_handle =
2212                            CookieManagerControlHandle { inner: this.inner.clone() };
2213                        Ok(CookieManagerRequest::GetCookieList {
2214                            url: req.url,
2215                            name: req.name,
2216                            cookies: req.cookies,
2217
2218                            control_handle,
2219                        })
2220                    }
2221                    _ => Err(fidl::Error::UnknownOrdinal {
2222                        ordinal: header.ordinal,
2223                        protocol_name:
2224                            <CookieManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2225                    }),
2226                }))
2227            },
2228        )
2229    }
2230}
2231
2232/// Provides methods for monitoring and accessing browser cookie state.
2233#[derive(Debug)]
2234pub enum CookieManagerRequest {
2235    /// Observe changes to all cookies named `name` that would be sent in a request to `url`.
2236    ///
2237    /// If neither `url` nor `name` are set then all cookies are observed. If only `url` is set
2238    /// then all cookies for that URL are observed. If both are set then only cookies matching both
2239    /// fields are observed.
2240    ///
2241    /// `changes` iterates over a stream of cookie changes. Additions or updates are expressed as
2242    /// complete cookies, while deletions are expressed as cookies with no `value` set.
2243    ObserveCookieChanges {
2244        url: Option<String>,
2245        name: Option<String>,
2246        changes: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2247        control_handle: CookieManagerControlHandle,
2248    },
2249    /// Returns a list of Cookies, optionally limited to those matching `url`, and optionally
2250    /// `name`. `cookies` iterates over the matching cookies, including their `value`s.
2251    GetCookieList {
2252        url: Option<String>,
2253        name: Option<String>,
2254        cookies: fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2255        control_handle: CookieManagerControlHandle,
2256    },
2257}
2258
2259impl CookieManagerRequest {
2260    #[allow(irrefutable_let_patterns)]
2261    pub fn into_observe_cookie_changes(
2262        self,
2263    ) -> Option<(
2264        Option<String>,
2265        Option<String>,
2266        fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2267        CookieManagerControlHandle,
2268    )> {
2269        if let CookieManagerRequest::ObserveCookieChanges { url, name, changes, control_handle } =
2270            self
2271        {
2272            Some((url, name, changes, control_handle))
2273        } else {
2274            None
2275        }
2276    }
2277
2278    #[allow(irrefutable_let_patterns)]
2279    pub fn into_get_cookie_list(
2280        self,
2281    ) -> Option<(
2282        Option<String>,
2283        Option<String>,
2284        fidl::endpoints::ServerEnd<CookiesIteratorMarker>,
2285        CookieManagerControlHandle,
2286    )> {
2287        if let CookieManagerRequest::GetCookieList { url, name, cookies, control_handle } = self {
2288            Some((url, name, cookies, control_handle))
2289        } else {
2290            None
2291        }
2292    }
2293
2294    /// Name of the method defined in FIDL
2295    pub fn method_name(&self) -> &'static str {
2296        match *self {
2297            CookieManagerRequest::ObserveCookieChanges { .. } => "observe_cookie_changes",
2298            CookieManagerRequest::GetCookieList { .. } => "get_cookie_list",
2299        }
2300    }
2301}
2302
2303#[derive(Debug, Clone)]
2304pub struct CookieManagerControlHandle {
2305    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2306}
2307
2308impl fidl::endpoints::ControlHandle for CookieManagerControlHandle {
2309    fn shutdown(&self) {
2310        self.inner.shutdown()
2311    }
2312
2313    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2314        self.inner.shutdown_with_epitaph(status)
2315    }
2316
2317    fn is_closed(&self) -> bool {
2318        self.inner.channel().is_closed()
2319    }
2320    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2321        self.inner.channel().on_closed()
2322    }
2323
2324    #[cfg(target_os = "fuchsia")]
2325    fn signal_peer(
2326        &self,
2327        clear_mask: zx::Signals,
2328        set_mask: zx::Signals,
2329    ) -> Result<(), zx_status::Status> {
2330        use fidl::Peered;
2331        self.inner.channel().signal_peer(clear_mask, set_mask)
2332    }
2333}
2334
2335impl CookieManagerControlHandle {}
2336
2337#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2338pub struct CookiesIteratorMarker;
2339
2340impl fidl::endpoints::ProtocolMarker for CookiesIteratorMarker {
2341    type Proxy = CookiesIteratorProxy;
2342    type RequestStream = CookiesIteratorRequestStream;
2343    #[cfg(target_os = "fuchsia")]
2344    type SynchronousProxy = CookiesIteratorSynchronousProxy;
2345
2346    const DEBUG_NAME: &'static str = "(anonymous) CookiesIterator";
2347}
2348
2349pub trait CookiesIteratorProxyInterface: Send + Sync {
2350    type GetNextResponseFut: std::future::Future<Output = Result<Vec<Cookie>, fidl::Error>> + Send;
2351    fn r#get_next(&self) -> Self::GetNextResponseFut;
2352}
2353#[derive(Debug)]
2354#[cfg(target_os = "fuchsia")]
2355pub struct CookiesIteratorSynchronousProxy {
2356    client: fidl::client::sync::Client,
2357}
2358
2359#[cfg(target_os = "fuchsia")]
2360impl fidl::endpoints::SynchronousProxy for CookiesIteratorSynchronousProxy {
2361    type Proxy = CookiesIteratorProxy;
2362    type Protocol = CookiesIteratorMarker;
2363
2364    fn from_channel(inner: fidl::Channel) -> Self {
2365        Self::new(inner)
2366    }
2367
2368    fn into_channel(self) -> fidl::Channel {
2369        self.client.into_channel()
2370    }
2371
2372    fn as_channel(&self) -> &fidl::Channel {
2373        self.client.as_channel()
2374    }
2375}
2376
2377#[cfg(target_os = "fuchsia")]
2378impl CookiesIteratorSynchronousProxy {
2379    pub fn new(channel: fidl::Channel) -> Self {
2380        let protocol_name = <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2381        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2382    }
2383
2384    pub fn into_channel(self) -> fidl::Channel {
2385        self.client.into_channel()
2386    }
2387
2388    /// Waits until an event arrives and returns it. It is safe for other
2389    /// threads to make concurrent requests while waiting for an event.
2390    pub fn wait_for_event(
2391        &self,
2392        deadline: zx::MonotonicInstant,
2393    ) -> Result<CookiesIteratorEvent, fidl::Error> {
2394        CookiesIteratorEvent::decode(self.client.wait_for_event(deadline)?)
2395    }
2396
2397    /// Fetches the next batch of cookies, or of changes to cookies.
2398    /// RFC6265 does not specify an upper-bound on the number of cookies which
2399    /// may be stored.
2400    pub fn r#get_next(
2401        &self,
2402        ___deadline: zx::MonotonicInstant,
2403    ) -> Result<Vec<Cookie>, fidl::Error> {
2404        let _response = self
2405            .client
2406            .send_query::<fidl::encoding::EmptyPayload, CookiesIteratorGetNextResponse>(
2407                (),
2408                0x61b55ebf67ec457d,
2409                fidl::encoding::DynamicFlags::empty(),
2410                ___deadline,
2411            )?;
2412        Ok(_response.changed_cookies)
2413    }
2414}
2415
2416#[cfg(target_os = "fuchsia")]
2417impl From<CookiesIteratorSynchronousProxy> for zx::NullableHandle {
2418    fn from(value: CookiesIteratorSynchronousProxy) -> Self {
2419        value.into_channel().into()
2420    }
2421}
2422
2423#[cfg(target_os = "fuchsia")]
2424impl From<fidl::Channel> for CookiesIteratorSynchronousProxy {
2425    fn from(value: fidl::Channel) -> Self {
2426        Self::new(value)
2427    }
2428}
2429
2430#[cfg(target_os = "fuchsia")]
2431impl fidl::endpoints::FromClient for CookiesIteratorSynchronousProxy {
2432    type Protocol = CookiesIteratorMarker;
2433
2434    fn from_client(value: fidl::endpoints::ClientEnd<CookiesIteratorMarker>) -> Self {
2435        Self::new(value.into_channel())
2436    }
2437}
2438
2439#[derive(Debug, Clone)]
2440pub struct CookiesIteratorProxy {
2441    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2442}
2443
2444impl fidl::endpoints::Proxy for CookiesIteratorProxy {
2445    type Protocol = CookiesIteratorMarker;
2446
2447    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2448        Self::new(inner)
2449    }
2450
2451    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2452        self.client.into_channel().map_err(|client| Self { client })
2453    }
2454
2455    fn as_channel(&self) -> &::fidl::AsyncChannel {
2456        self.client.as_channel()
2457    }
2458}
2459
2460impl CookiesIteratorProxy {
2461    /// Create a new Proxy for fuchsia.web/CookiesIterator.
2462    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2463        let protocol_name = <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2464        Self { client: fidl::client::Client::new(channel, protocol_name) }
2465    }
2466
2467    /// Get a Stream of events from the remote end of the protocol.
2468    ///
2469    /// # Panics
2470    ///
2471    /// Panics if the event stream was already taken.
2472    pub fn take_event_stream(&self) -> CookiesIteratorEventStream {
2473        CookiesIteratorEventStream { event_receiver: self.client.take_event_receiver() }
2474    }
2475
2476    /// Fetches the next batch of cookies, or of changes to cookies.
2477    /// RFC6265 does not specify an upper-bound on the number of cookies which
2478    /// may be stored.
2479    pub fn r#get_next(
2480        &self,
2481    ) -> fidl::client::QueryResponseFut<Vec<Cookie>, fidl::encoding::DefaultFuchsiaResourceDialect>
2482    {
2483        CookiesIteratorProxyInterface::r#get_next(self)
2484    }
2485}
2486
2487impl CookiesIteratorProxyInterface for CookiesIteratorProxy {
2488    type GetNextResponseFut =
2489        fidl::client::QueryResponseFut<Vec<Cookie>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2490    fn r#get_next(&self) -> Self::GetNextResponseFut {
2491        fn _decode(
2492            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2493        ) -> Result<Vec<Cookie>, fidl::Error> {
2494            let _response = fidl::client::decode_transaction_body::<
2495                CookiesIteratorGetNextResponse,
2496                fidl::encoding::DefaultFuchsiaResourceDialect,
2497                0x61b55ebf67ec457d,
2498            >(_buf?)?;
2499            Ok(_response.changed_cookies)
2500        }
2501        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Cookie>>(
2502            (),
2503            0x61b55ebf67ec457d,
2504            fidl::encoding::DynamicFlags::empty(),
2505            _decode,
2506        )
2507    }
2508}
2509
2510pub struct CookiesIteratorEventStream {
2511    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2512}
2513
2514impl std::marker::Unpin for CookiesIteratorEventStream {}
2515
2516impl futures::stream::FusedStream for CookiesIteratorEventStream {
2517    fn is_terminated(&self) -> bool {
2518        self.event_receiver.is_terminated()
2519    }
2520}
2521
2522impl futures::Stream for CookiesIteratorEventStream {
2523    type Item = Result<CookiesIteratorEvent, fidl::Error>;
2524
2525    fn poll_next(
2526        mut self: std::pin::Pin<&mut Self>,
2527        cx: &mut std::task::Context<'_>,
2528    ) -> std::task::Poll<Option<Self::Item>> {
2529        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2530            &mut self.event_receiver,
2531            cx
2532        )?) {
2533            Some(buf) => std::task::Poll::Ready(Some(CookiesIteratorEvent::decode(buf))),
2534            None => std::task::Poll::Ready(None),
2535        }
2536    }
2537}
2538
2539#[derive(Debug)]
2540pub enum CookiesIteratorEvent {}
2541
2542impl CookiesIteratorEvent {
2543    /// Decodes a message buffer as a [`CookiesIteratorEvent`].
2544    fn decode(
2545        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2546    ) -> Result<CookiesIteratorEvent, fidl::Error> {
2547        let (bytes, _handles) = buf.split_mut();
2548        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2549        debug_assert_eq!(tx_header.tx_id, 0);
2550        match tx_header.ordinal {
2551            _ => Err(fidl::Error::UnknownOrdinal {
2552                ordinal: tx_header.ordinal,
2553                protocol_name:
2554                    <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2555            }),
2556        }
2557    }
2558}
2559
2560/// A Stream of incoming requests for fuchsia.web/CookiesIterator.
2561pub struct CookiesIteratorRequestStream {
2562    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2563    is_terminated: bool,
2564}
2565
2566impl std::marker::Unpin for CookiesIteratorRequestStream {}
2567
2568impl futures::stream::FusedStream for CookiesIteratorRequestStream {
2569    fn is_terminated(&self) -> bool {
2570        self.is_terminated
2571    }
2572}
2573
2574impl fidl::endpoints::RequestStream for CookiesIteratorRequestStream {
2575    type Protocol = CookiesIteratorMarker;
2576    type ControlHandle = CookiesIteratorControlHandle;
2577
2578    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2579        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2580    }
2581
2582    fn control_handle(&self) -> Self::ControlHandle {
2583        CookiesIteratorControlHandle { inner: self.inner.clone() }
2584    }
2585
2586    fn into_inner(
2587        self,
2588    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2589    {
2590        (self.inner, self.is_terminated)
2591    }
2592
2593    fn from_inner(
2594        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2595        is_terminated: bool,
2596    ) -> Self {
2597        Self { inner, is_terminated }
2598    }
2599}
2600
2601impl futures::Stream for CookiesIteratorRequestStream {
2602    type Item = Result<CookiesIteratorRequest, fidl::Error>;
2603
2604    fn poll_next(
2605        mut self: std::pin::Pin<&mut Self>,
2606        cx: &mut std::task::Context<'_>,
2607    ) -> std::task::Poll<Option<Self::Item>> {
2608        let this = &mut *self;
2609        if this.inner.check_shutdown(cx) {
2610            this.is_terminated = true;
2611            return std::task::Poll::Ready(None);
2612        }
2613        if this.is_terminated {
2614            panic!("polled CookiesIteratorRequestStream after completion");
2615        }
2616        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2617            |bytes, handles| {
2618                match this.inner.channel().read_etc(cx, bytes, handles) {
2619                    std::task::Poll::Ready(Ok(())) => {}
2620                    std::task::Poll::Pending => return std::task::Poll::Pending,
2621                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2622                        this.is_terminated = true;
2623                        return std::task::Poll::Ready(None);
2624                    }
2625                    std::task::Poll::Ready(Err(e)) => {
2626                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2627                            e.into(),
2628                        ))));
2629                    }
2630                }
2631
2632                // A message has been received from the channel
2633                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2634
2635                std::task::Poll::Ready(Some(match header.ordinal {
2636                    0x61b55ebf67ec457d => {
2637                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2638                        let mut req = fidl::new_empty!(
2639                            fidl::encoding::EmptyPayload,
2640                            fidl::encoding::DefaultFuchsiaResourceDialect
2641                        );
2642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2643                        let control_handle =
2644                            CookiesIteratorControlHandle { inner: this.inner.clone() };
2645                        Ok(CookiesIteratorRequest::GetNext {
2646                            responder: CookiesIteratorGetNextResponder {
2647                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2648                                tx_id: header.tx_id,
2649                            },
2650                        })
2651                    }
2652                    _ => Err(fidl::Error::UnknownOrdinal {
2653                        ordinal: header.ordinal,
2654                        protocol_name:
2655                            <CookiesIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2656                    }),
2657                }))
2658            },
2659        )
2660    }
2661}
2662
2663/// Used to iterator over a set of cookies, or a stream of changes to cookies.
2664#[derive(Debug)]
2665pub enum CookiesIteratorRequest {
2666    /// Fetches the next batch of cookies, or of changes to cookies.
2667    /// RFC6265 does not specify an upper-bound on the number of cookies which
2668    /// may be stored.
2669    GetNext { responder: CookiesIteratorGetNextResponder },
2670}
2671
2672impl CookiesIteratorRequest {
2673    #[allow(irrefutable_let_patterns)]
2674    pub fn into_get_next(self) -> Option<(CookiesIteratorGetNextResponder)> {
2675        if let CookiesIteratorRequest::GetNext { responder } = self {
2676            Some((responder))
2677        } else {
2678            None
2679        }
2680    }
2681
2682    /// Name of the method defined in FIDL
2683    pub fn method_name(&self) -> &'static str {
2684        match *self {
2685            CookiesIteratorRequest::GetNext { .. } => "get_next",
2686        }
2687    }
2688}
2689
2690#[derive(Debug, Clone)]
2691pub struct CookiesIteratorControlHandle {
2692    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2693}
2694
2695impl fidl::endpoints::ControlHandle for CookiesIteratorControlHandle {
2696    fn shutdown(&self) {
2697        self.inner.shutdown()
2698    }
2699
2700    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2701        self.inner.shutdown_with_epitaph(status)
2702    }
2703
2704    fn is_closed(&self) -> bool {
2705        self.inner.channel().is_closed()
2706    }
2707    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2708        self.inner.channel().on_closed()
2709    }
2710
2711    #[cfg(target_os = "fuchsia")]
2712    fn signal_peer(
2713        &self,
2714        clear_mask: zx::Signals,
2715        set_mask: zx::Signals,
2716    ) -> Result<(), zx_status::Status> {
2717        use fidl::Peered;
2718        self.inner.channel().signal_peer(clear_mask, set_mask)
2719    }
2720}
2721
2722impl CookiesIteratorControlHandle {}
2723
2724#[must_use = "FIDL methods require a response to be sent"]
2725#[derive(Debug)]
2726pub struct CookiesIteratorGetNextResponder {
2727    control_handle: std::mem::ManuallyDrop<CookiesIteratorControlHandle>,
2728    tx_id: u32,
2729}
2730
2731/// Set the the channel to be shutdown (see [`CookiesIteratorControlHandle::shutdown`])
2732/// if the responder is dropped without sending a response, so that the client
2733/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2734impl std::ops::Drop for CookiesIteratorGetNextResponder {
2735    fn drop(&mut self) {
2736        self.control_handle.shutdown();
2737        // Safety: drops once, never accessed again
2738        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2739    }
2740}
2741
2742impl fidl::endpoints::Responder for CookiesIteratorGetNextResponder {
2743    type ControlHandle = CookiesIteratorControlHandle;
2744
2745    fn control_handle(&self) -> &CookiesIteratorControlHandle {
2746        &self.control_handle
2747    }
2748
2749    fn drop_without_shutdown(mut self) {
2750        // Safety: drops once, never accessed again due to mem::forget
2751        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2752        // Prevent Drop from running (which would shut down the channel)
2753        std::mem::forget(self);
2754    }
2755}
2756
2757impl CookiesIteratorGetNextResponder {
2758    /// Sends a response to the FIDL transaction.
2759    ///
2760    /// Sets the channel to shutdown if an error occurs.
2761    pub fn send(self, mut changed_cookies: Vec<Cookie>) -> Result<(), fidl::Error> {
2762        let _result = self.send_raw(changed_cookies);
2763        if _result.is_err() {
2764            self.control_handle.shutdown();
2765        }
2766        self.drop_without_shutdown();
2767        _result
2768    }
2769
2770    /// Similar to "send" but does not shutdown the channel if an error occurs.
2771    pub fn send_no_shutdown_on_err(
2772        self,
2773        mut changed_cookies: Vec<Cookie>,
2774    ) -> Result<(), fidl::Error> {
2775        let _result = self.send_raw(changed_cookies);
2776        self.drop_without_shutdown();
2777        _result
2778    }
2779
2780    fn send_raw(&self, mut changed_cookies: Vec<Cookie>) -> Result<(), fidl::Error> {
2781        self.control_handle.inner.send::<CookiesIteratorGetNextResponse>(
2782            (changed_cookies.as_mut(),),
2783            self.tx_id,
2784            0x61b55ebf67ec457d,
2785            fidl::encoding::DynamicFlags::empty(),
2786        )
2787    }
2788}
2789
2790#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2791pub struct DebugMarker;
2792
2793impl fidl::endpoints::ProtocolMarker for DebugMarker {
2794    type Proxy = DebugProxy;
2795    type RequestStream = DebugRequestStream;
2796    #[cfg(target_os = "fuchsia")]
2797    type SynchronousProxy = DebugSynchronousProxy;
2798
2799    const DEBUG_NAME: &'static str = "fuchsia.web.Debug";
2800}
2801impl fidl::endpoints::DiscoverableProtocolMarker for DebugMarker {}
2802
2803pub trait DebugProxyInterface: Send + Sync {
2804    type EnableDevToolsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2805    fn r#enable_dev_tools(
2806        &self,
2807        listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2808    ) -> Self::EnableDevToolsResponseFut;
2809}
2810#[derive(Debug)]
2811#[cfg(target_os = "fuchsia")]
2812pub struct DebugSynchronousProxy {
2813    client: fidl::client::sync::Client,
2814}
2815
2816#[cfg(target_os = "fuchsia")]
2817impl fidl::endpoints::SynchronousProxy for DebugSynchronousProxy {
2818    type Proxy = DebugProxy;
2819    type Protocol = DebugMarker;
2820
2821    fn from_channel(inner: fidl::Channel) -> Self {
2822        Self::new(inner)
2823    }
2824
2825    fn into_channel(self) -> fidl::Channel {
2826        self.client.into_channel()
2827    }
2828
2829    fn as_channel(&self) -> &fidl::Channel {
2830        self.client.as_channel()
2831    }
2832}
2833
2834#[cfg(target_os = "fuchsia")]
2835impl DebugSynchronousProxy {
2836    pub fn new(channel: fidl::Channel) -> Self {
2837        let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2838        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2839    }
2840
2841    pub fn into_channel(self) -> fidl::Channel {
2842        self.client.into_channel()
2843    }
2844
2845    /// Waits until an event arrives and returns it. It is safe for other
2846    /// threads to make concurrent requests while waiting for an event.
2847    pub fn wait_for_event(
2848        &self,
2849        deadline: zx::MonotonicInstant,
2850    ) -> Result<DebugEvent, fidl::Error> {
2851        DebugEvent::decode(self.client.wait_for_event(deadline)?)
2852    }
2853
2854    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
2855    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
2856    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
2857    /// this method.
2858    ///
2859    /// Because DevTools debugging is exposed using TCP as its transport, only
2860    /// [`Context`]s created with access to network capabilities will report
2861    /// themselves as available for debugging.
2862    pub fn r#enable_dev_tools(
2863        &self,
2864        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2865        ___deadline: zx::MonotonicInstant,
2866    ) -> Result<(), fidl::Error> {
2867        let _response =
2868            self.client.send_query::<DebugEnableDevToolsRequest, fidl::encoding::EmptyPayload>(
2869                (listener,),
2870                0x44b5e1f4e4c548e4,
2871                fidl::encoding::DynamicFlags::empty(),
2872                ___deadline,
2873            )?;
2874        Ok(_response)
2875    }
2876}
2877
2878#[cfg(target_os = "fuchsia")]
2879impl From<DebugSynchronousProxy> for zx::NullableHandle {
2880    fn from(value: DebugSynchronousProxy) -> Self {
2881        value.into_channel().into()
2882    }
2883}
2884
2885#[cfg(target_os = "fuchsia")]
2886impl From<fidl::Channel> for DebugSynchronousProxy {
2887    fn from(value: fidl::Channel) -> Self {
2888        Self::new(value)
2889    }
2890}
2891
2892#[cfg(target_os = "fuchsia")]
2893impl fidl::endpoints::FromClient for DebugSynchronousProxy {
2894    type Protocol = DebugMarker;
2895
2896    fn from_client(value: fidl::endpoints::ClientEnd<DebugMarker>) -> Self {
2897        Self::new(value.into_channel())
2898    }
2899}
2900
2901#[derive(Debug, Clone)]
2902pub struct DebugProxy {
2903    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2904}
2905
2906impl fidl::endpoints::Proxy for DebugProxy {
2907    type Protocol = DebugMarker;
2908
2909    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2910        Self::new(inner)
2911    }
2912
2913    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2914        self.client.into_channel().map_err(|client| Self { client })
2915    }
2916
2917    fn as_channel(&self) -> &::fidl::AsyncChannel {
2918        self.client.as_channel()
2919    }
2920}
2921
2922impl DebugProxy {
2923    /// Create a new Proxy for fuchsia.web/Debug.
2924    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2925        let protocol_name = <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2926        Self { client: fidl::client::Client::new(channel, protocol_name) }
2927    }
2928
2929    /// Get a Stream of events from the remote end of the protocol.
2930    ///
2931    /// # Panics
2932    ///
2933    /// Panics if the event stream was already taken.
2934    pub fn take_event_stream(&self) -> DebugEventStream {
2935        DebugEventStream { event_receiver: self.client.take_event_receiver() }
2936    }
2937
2938    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
2939    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
2940    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
2941    /// this method.
2942    ///
2943    /// Because DevTools debugging is exposed using TCP as its transport, only
2944    /// [`Context`]s created with access to network capabilities will report
2945    /// themselves as available for debugging.
2946    pub fn r#enable_dev_tools(
2947        &self,
2948        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2949    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2950        DebugProxyInterface::r#enable_dev_tools(self, listener)
2951    }
2952}
2953
2954impl DebugProxyInterface for DebugProxy {
2955    type EnableDevToolsResponseFut =
2956        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2957    fn r#enable_dev_tools(
2958        &self,
2959        mut listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
2960    ) -> Self::EnableDevToolsResponseFut {
2961        fn _decode(
2962            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2963        ) -> Result<(), fidl::Error> {
2964            let _response = fidl::client::decode_transaction_body::<
2965                fidl::encoding::EmptyPayload,
2966                fidl::encoding::DefaultFuchsiaResourceDialect,
2967                0x44b5e1f4e4c548e4,
2968            >(_buf?)?;
2969            Ok(_response)
2970        }
2971        self.client.send_query_and_decode::<DebugEnableDevToolsRequest, ()>(
2972            (listener,),
2973            0x44b5e1f4e4c548e4,
2974            fidl::encoding::DynamicFlags::empty(),
2975            _decode,
2976        )
2977    }
2978}
2979
2980pub struct DebugEventStream {
2981    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2982}
2983
2984impl std::marker::Unpin for DebugEventStream {}
2985
2986impl futures::stream::FusedStream for DebugEventStream {
2987    fn is_terminated(&self) -> bool {
2988        self.event_receiver.is_terminated()
2989    }
2990}
2991
2992impl futures::Stream for DebugEventStream {
2993    type Item = Result<DebugEvent, fidl::Error>;
2994
2995    fn poll_next(
2996        mut self: std::pin::Pin<&mut Self>,
2997        cx: &mut std::task::Context<'_>,
2998    ) -> std::task::Poll<Option<Self::Item>> {
2999        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3000            &mut self.event_receiver,
3001            cx
3002        )?) {
3003            Some(buf) => std::task::Poll::Ready(Some(DebugEvent::decode(buf))),
3004            None => std::task::Poll::Ready(None),
3005        }
3006    }
3007}
3008
3009#[derive(Debug)]
3010pub enum DebugEvent {}
3011
3012impl DebugEvent {
3013    /// Decodes a message buffer as a [`DebugEvent`].
3014    fn decode(
3015        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3016    ) -> Result<DebugEvent, fidl::Error> {
3017        let (bytes, _handles) = buf.split_mut();
3018        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3019        debug_assert_eq!(tx_header.tx_id, 0);
3020        match tx_header.ordinal {
3021            _ => Err(fidl::Error::UnknownOrdinal {
3022                ordinal: tx_header.ordinal,
3023                protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3024            }),
3025        }
3026    }
3027}
3028
3029/// A Stream of incoming requests for fuchsia.web/Debug.
3030pub struct DebugRequestStream {
3031    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3032    is_terminated: bool,
3033}
3034
3035impl std::marker::Unpin for DebugRequestStream {}
3036
3037impl futures::stream::FusedStream for DebugRequestStream {
3038    fn is_terminated(&self) -> bool {
3039        self.is_terminated
3040    }
3041}
3042
3043impl fidl::endpoints::RequestStream for DebugRequestStream {
3044    type Protocol = DebugMarker;
3045    type ControlHandle = DebugControlHandle;
3046
3047    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3048        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3049    }
3050
3051    fn control_handle(&self) -> Self::ControlHandle {
3052        DebugControlHandle { inner: self.inner.clone() }
3053    }
3054
3055    fn into_inner(
3056        self,
3057    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3058    {
3059        (self.inner, self.is_terminated)
3060    }
3061
3062    fn from_inner(
3063        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3064        is_terminated: bool,
3065    ) -> Self {
3066        Self { inner, is_terminated }
3067    }
3068}
3069
3070impl futures::Stream for DebugRequestStream {
3071    type Item = Result<DebugRequest, fidl::Error>;
3072
3073    fn poll_next(
3074        mut self: std::pin::Pin<&mut Self>,
3075        cx: &mut std::task::Context<'_>,
3076    ) -> std::task::Poll<Option<Self::Item>> {
3077        let this = &mut *self;
3078        if this.inner.check_shutdown(cx) {
3079            this.is_terminated = true;
3080            return std::task::Poll::Ready(None);
3081        }
3082        if this.is_terminated {
3083            panic!("polled DebugRequestStream after completion");
3084        }
3085        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3086            |bytes, handles| {
3087                match this.inner.channel().read_etc(cx, bytes, handles) {
3088                    std::task::Poll::Ready(Ok(())) => {}
3089                    std::task::Poll::Pending => return std::task::Poll::Pending,
3090                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3091                        this.is_terminated = true;
3092                        return std::task::Poll::Ready(None);
3093                    }
3094                    std::task::Poll::Ready(Err(e)) => {
3095                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3096                            e.into(),
3097                        ))));
3098                    }
3099                }
3100
3101                // A message has been received from the channel
3102                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3103
3104                std::task::Poll::Ready(Some(match header.ordinal {
3105                    0x44b5e1f4e4c548e4 => {
3106                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3107                        let mut req = fidl::new_empty!(
3108                            DebugEnableDevToolsRequest,
3109                            fidl::encoding::DefaultFuchsiaResourceDialect
3110                        );
3111                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugEnableDevToolsRequest>(&header, _body_bytes, handles, &mut req)?;
3112                        let control_handle = DebugControlHandle { inner: this.inner.clone() };
3113                        Ok(DebugRequest::EnableDevTools {
3114                            listener: req.listener,
3115
3116                            responder: DebugEnableDevToolsResponder {
3117                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3118                                tx_id: header.tx_id,
3119                            },
3120                        })
3121                    }
3122                    _ => Err(fidl::Error::UnknownOrdinal {
3123                        ordinal: header.ordinal,
3124                        protocol_name: <DebugMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3125                    }),
3126                }))
3127            },
3128        )
3129    }
3130}
3131
3132/// The debug service which allows to enable the DevTools service on Contexts.
3133#[derive(Debug)]
3134pub enum DebugRequest {
3135    /// Enables the DevTools service on every subsequent [`Context`] creation and delivers
3136    /// subsequent DevTools events to the supplied `listener`. The callback indicates when the
3137    /// WebEngine is in a debuggable state. Events will be sent to every `listener` registered with
3138    /// this method.
3139    ///
3140    /// Because DevTools debugging is exposed using TCP as its transport, only
3141    /// [`Context`]s created with access to network capabilities will report
3142    /// themselves as available for debugging.
3143    EnableDevTools {
3144        listener: fidl::endpoints::ClientEnd<DevToolsListenerMarker>,
3145        responder: DebugEnableDevToolsResponder,
3146    },
3147}
3148
3149impl DebugRequest {
3150    #[allow(irrefutable_let_patterns)]
3151    pub fn into_enable_dev_tools(
3152        self,
3153    ) -> Option<(fidl::endpoints::ClientEnd<DevToolsListenerMarker>, DebugEnableDevToolsResponder)>
3154    {
3155        if let DebugRequest::EnableDevTools { listener, responder } = self {
3156            Some((listener, responder))
3157        } else {
3158            None
3159        }
3160    }
3161
3162    /// Name of the method defined in FIDL
3163    pub fn method_name(&self) -> &'static str {
3164        match *self {
3165            DebugRequest::EnableDevTools { .. } => "enable_dev_tools",
3166        }
3167    }
3168}
3169
3170#[derive(Debug, Clone)]
3171pub struct DebugControlHandle {
3172    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3173}
3174
3175impl fidl::endpoints::ControlHandle for DebugControlHandle {
3176    fn shutdown(&self) {
3177        self.inner.shutdown()
3178    }
3179
3180    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3181        self.inner.shutdown_with_epitaph(status)
3182    }
3183
3184    fn is_closed(&self) -> bool {
3185        self.inner.channel().is_closed()
3186    }
3187    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3188        self.inner.channel().on_closed()
3189    }
3190
3191    #[cfg(target_os = "fuchsia")]
3192    fn signal_peer(
3193        &self,
3194        clear_mask: zx::Signals,
3195        set_mask: zx::Signals,
3196    ) -> Result<(), zx_status::Status> {
3197        use fidl::Peered;
3198        self.inner.channel().signal_peer(clear_mask, set_mask)
3199    }
3200}
3201
3202impl DebugControlHandle {}
3203
3204#[must_use = "FIDL methods require a response to be sent"]
3205#[derive(Debug)]
3206pub struct DebugEnableDevToolsResponder {
3207    control_handle: std::mem::ManuallyDrop<DebugControlHandle>,
3208    tx_id: u32,
3209}
3210
3211/// Set the the channel to be shutdown (see [`DebugControlHandle::shutdown`])
3212/// if the responder is dropped without sending a response, so that the client
3213/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3214impl std::ops::Drop for DebugEnableDevToolsResponder {
3215    fn drop(&mut self) {
3216        self.control_handle.shutdown();
3217        // Safety: drops once, never accessed again
3218        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3219    }
3220}
3221
3222impl fidl::endpoints::Responder for DebugEnableDevToolsResponder {
3223    type ControlHandle = DebugControlHandle;
3224
3225    fn control_handle(&self) -> &DebugControlHandle {
3226        &self.control_handle
3227    }
3228
3229    fn drop_without_shutdown(mut self) {
3230        // Safety: drops once, never accessed again due to mem::forget
3231        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3232        // Prevent Drop from running (which would shut down the channel)
3233        std::mem::forget(self);
3234    }
3235}
3236
3237impl DebugEnableDevToolsResponder {
3238    /// Sends a response to the FIDL transaction.
3239    ///
3240    /// Sets the channel to shutdown if an error occurs.
3241    pub fn send(self) -> Result<(), fidl::Error> {
3242        let _result = self.send_raw();
3243        if _result.is_err() {
3244            self.control_handle.shutdown();
3245        }
3246        self.drop_without_shutdown();
3247        _result
3248    }
3249
3250    /// Similar to "send" but does not shutdown the channel if an error occurs.
3251    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3252        let _result = self.send_raw();
3253        self.drop_without_shutdown();
3254        _result
3255    }
3256
3257    fn send_raw(&self) -> Result<(), fidl::Error> {
3258        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3259            (),
3260            self.tx_id,
3261            0x44b5e1f4e4c548e4,
3262            fidl::encoding::DynamicFlags::empty(),
3263        )
3264    }
3265}
3266
3267#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3268pub struct DevToolsListenerMarker;
3269
3270impl fidl::endpoints::ProtocolMarker for DevToolsListenerMarker {
3271    type Proxy = DevToolsListenerProxy;
3272    type RequestStream = DevToolsListenerRequestStream;
3273    #[cfg(target_os = "fuchsia")]
3274    type SynchronousProxy = DevToolsListenerSynchronousProxy;
3275
3276    const DEBUG_NAME: &'static str = "(anonymous) DevToolsListener";
3277}
3278
3279pub trait DevToolsListenerProxyInterface: Send + Sync {
3280    fn r#on_context_dev_tools_available(
3281        &self,
3282        listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3283    ) -> Result<(), fidl::Error>;
3284}
3285#[derive(Debug)]
3286#[cfg(target_os = "fuchsia")]
3287pub struct DevToolsListenerSynchronousProxy {
3288    client: fidl::client::sync::Client,
3289}
3290
3291#[cfg(target_os = "fuchsia")]
3292impl fidl::endpoints::SynchronousProxy for DevToolsListenerSynchronousProxy {
3293    type Proxy = DevToolsListenerProxy;
3294    type Protocol = DevToolsListenerMarker;
3295
3296    fn from_channel(inner: fidl::Channel) -> Self {
3297        Self::new(inner)
3298    }
3299
3300    fn into_channel(self) -> fidl::Channel {
3301        self.client.into_channel()
3302    }
3303
3304    fn as_channel(&self) -> &fidl::Channel {
3305        self.client.as_channel()
3306    }
3307}
3308
3309#[cfg(target_os = "fuchsia")]
3310impl DevToolsListenerSynchronousProxy {
3311    pub fn new(channel: fidl::Channel) -> Self {
3312        let protocol_name = <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3313        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3314    }
3315
3316    pub fn into_channel(self) -> fidl::Channel {
3317        self.client.into_channel()
3318    }
3319
3320    /// Waits until an event arrives and returns it. It is safe for other
3321    /// threads to make concurrent requests while waiting for an event.
3322    pub fn wait_for_event(
3323        &self,
3324        deadline: zx::MonotonicInstant,
3325    ) -> Result<DevToolsListenerEvent, fidl::Error> {
3326        DevToolsListenerEvent::decode(self.client.wait_for_event(deadline)?)
3327    }
3328
3329    /// Called when the DevTools service is available on a new [`Context`].
3330    ///
3331    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3332    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3333    pub fn r#on_context_dev_tools_available(
3334        &self,
3335        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3336    ) -> Result<(), fidl::Error> {
3337        self.client.send::<DevToolsListenerOnContextDevToolsAvailableRequest>(
3338            (listener,),
3339            0x4b259fb4d7e49e87,
3340            fidl::encoding::DynamicFlags::empty(),
3341        )
3342    }
3343}
3344
3345#[cfg(target_os = "fuchsia")]
3346impl From<DevToolsListenerSynchronousProxy> for zx::NullableHandle {
3347    fn from(value: DevToolsListenerSynchronousProxy) -> Self {
3348        value.into_channel().into()
3349    }
3350}
3351
3352#[cfg(target_os = "fuchsia")]
3353impl From<fidl::Channel> for DevToolsListenerSynchronousProxy {
3354    fn from(value: fidl::Channel) -> Self {
3355        Self::new(value)
3356    }
3357}
3358
3359#[cfg(target_os = "fuchsia")]
3360impl fidl::endpoints::FromClient for DevToolsListenerSynchronousProxy {
3361    type Protocol = DevToolsListenerMarker;
3362
3363    fn from_client(value: fidl::endpoints::ClientEnd<DevToolsListenerMarker>) -> Self {
3364        Self::new(value.into_channel())
3365    }
3366}
3367
3368#[derive(Debug, Clone)]
3369pub struct DevToolsListenerProxy {
3370    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3371}
3372
3373impl fidl::endpoints::Proxy for DevToolsListenerProxy {
3374    type Protocol = DevToolsListenerMarker;
3375
3376    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3377        Self::new(inner)
3378    }
3379
3380    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3381        self.client.into_channel().map_err(|client| Self { client })
3382    }
3383
3384    fn as_channel(&self) -> &::fidl::AsyncChannel {
3385        self.client.as_channel()
3386    }
3387}
3388
3389impl DevToolsListenerProxy {
3390    /// Create a new Proxy for fuchsia.web/DevToolsListener.
3391    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3392        let protocol_name = <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3393        Self { client: fidl::client::Client::new(channel, protocol_name) }
3394    }
3395
3396    /// Get a Stream of events from the remote end of the protocol.
3397    ///
3398    /// # Panics
3399    ///
3400    /// Panics if the event stream was already taken.
3401    pub fn take_event_stream(&self) -> DevToolsListenerEventStream {
3402        DevToolsListenerEventStream { event_receiver: self.client.take_event_receiver() }
3403    }
3404
3405    /// Called when the DevTools service is available on a new [`Context`].
3406    ///
3407    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3408    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3409    pub fn r#on_context_dev_tools_available(
3410        &self,
3411        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3412    ) -> Result<(), fidl::Error> {
3413        DevToolsListenerProxyInterface::r#on_context_dev_tools_available(self, listener)
3414    }
3415}
3416
3417impl DevToolsListenerProxyInterface for DevToolsListenerProxy {
3418    fn r#on_context_dev_tools_available(
3419        &self,
3420        mut listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3421    ) -> Result<(), fidl::Error> {
3422        self.client.send::<DevToolsListenerOnContextDevToolsAvailableRequest>(
3423            (listener,),
3424            0x4b259fb4d7e49e87,
3425            fidl::encoding::DynamicFlags::empty(),
3426        )
3427    }
3428}
3429
3430pub struct DevToolsListenerEventStream {
3431    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3432}
3433
3434impl std::marker::Unpin for DevToolsListenerEventStream {}
3435
3436impl futures::stream::FusedStream for DevToolsListenerEventStream {
3437    fn is_terminated(&self) -> bool {
3438        self.event_receiver.is_terminated()
3439    }
3440}
3441
3442impl futures::Stream for DevToolsListenerEventStream {
3443    type Item = Result<DevToolsListenerEvent, fidl::Error>;
3444
3445    fn poll_next(
3446        mut self: std::pin::Pin<&mut Self>,
3447        cx: &mut std::task::Context<'_>,
3448    ) -> std::task::Poll<Option<Self::Item>> {
3449        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3450            &mut self.event_receiver,
3451            cx
3452        )?) {
3453            Some(buf) => std::task::Poll::Ready(Some(DevToolsListenerEvent::decode(buf))),
3454            None => std::task::Poll::Ready(None),
3455        }
3456    }
3457}
3458
3459#[derive(Debug)]
3460pub enum DevToolsListenerEvent {}
3461
3462impl DevToolsListenerEvent {
3463    /// Decodes a message buffer as a [`DevToolsListenerEvent`].
3464    fn decode(
3465        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3466    ) -> Result<DevToolsListenerEvent, fidl::Error> {
3467        let (bytes, _handles) = buf.split_mut();
3468        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3469        debug_assert_eq!(tx_header.tx_id, 0);
3470        match tx_header.ordinal {
3471            _ => Err(fidl::Error::UnknownOrdinal {
3472                ordinal: tx_header.ordinal,
3473                protocol_name:
3474                    <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3475            }),
3476        }
3477    }
3478}
3479
3480/// A Stream of incoming requests for fuchsia.web/DevToolsListener.
3481pub struct DevToolsListenerRequestStream {
3482    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3483    is_terminated: bool,
3484}
3485
3486impl std::marker::Unpin for DevToolsListenerRequestStream {}
3487
3488impl futures::stream::FusedStream for DevToolsListenerRequestStream {
3489    fn is_terminated(&self) -> bool {
3490        self.is_terminated
3491    }
3492}
3493
3494impl fidl::endpoints::RequestStream for DevToolsListenerRequestStream {
3495    type Protocol = DevToolsListenerMarker;
3496    type ControlHandle = DevToolsListenerControlHandle;
3497
3498    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3499        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3500    }
3501
3502    fn control_handle(&self) -> Self::ControlHandle {
3503        DevToolsListenerControlHandle { inner: self.inner.clone() }
3504    }
3505
3506    fn into_inner(
3507        self,
3508    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3509    {
3510        (self.inner, self.is_terminated)
3511    }
3512
3513    fn from_inner(
3514        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3515        is_terminated: bool,
3516    ) -> Self {
3517        Self { inner, is_terminated }
3518    }
3519}
3520
3521impl futures::Stream for DevToolsListenerRequestStream {
3522    type Item = Result<DevToolsListenerRequest, fidl::Error>;
3523
3524    fn poll_next(
3525        mut self: std::pin::Pin<&mut Self>,
3526        cx: &mut std::task::Context<'_>,
3527    ) -> std::task::Poll<Option<Self::Item>> {
3528        let this = &mut *self;
3529        if this.inner.check_shutdown(cx) {
3530            this.is_terminated = true;
3531            return std::task::Poll::Ready(None);
3532        }
3533        if this.is_terminated {
3534            panic!("polled DevToolsListenerRequestStream after completion");
3535        }
3536        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3537            |bytes, handles| {
3538                match this.inner.channel().read_etc(cx, bytes, handles) {
3539                    std::task::Poll::Ready(Ok(())) => {}
3540                    std::task::Poll::Pending => return std::task::Poll::Pending,
3541                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3542                        this.is_terminated = true;
3543                        return std::task::Poll::Ready(None);
3544                    }
3545                    std::task::Poll::Ready(Err(e)) => {
3546                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3547                            e.into(),
3548                        ))));
3549                    }
3550                }
3551
3552                // A message has been received from the channel
3553                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3554
3555                std::task::Poll::Ready(Some(match header.ordinal {
3556                    0x4b259fb4d7e49e87 => {
3557                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3558                        let mut req = fidl::new_empty!(
3559                            DevToolsListenerOnContextDevToolsAvailableRequest,
3560                            fidl::encoding::DefaultFuchsiaResourceDialect
3561                        );
3562                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevToolsListenerOnContextDevToolsAvailableRequest>(&header, _body_bytes, handles, &mut req)?;
3563                        let control_handle =
3564                            DevToolsListenerControlHandle { inner: this.inner.clone() };
3565                        Ok(DevToolsListenerRequest::OnContextDevToolsAvailable {
3566                            listener: req.listener,
3567
3568                            control_handle,
3569                        })
3570                    }
3571                    _ => Err(fidl::Error::UnknownOrdinal {
3572                        ordinal: header.ordinal,
3573                        protocol_name:
3574                            <DevToolsListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3575                    }),
3576                }))
3577            },
3578        )
3579    }
3580}
3581
3582/// Interface used to observe DevTools service availability events.
3583#[derive(Debug)]
3584pub enum DevToolsListenerRequest {
3585    /// Called when the DevTools service is available on a new [`Context`].
3586    ///
3587    /// - `listener`: Channel over which DevTools events for the new [`Context`] will
3588    ///   be delivered. This channel will disconnect when the [`Context`] is destroyed.
3589    OnContextDevToolsAvailable {
3590        listener: fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3591        control_handle: DevToolsListenerControlHandle,
3592    },
3593}
3594
3595impl DevToolsListenerRequest {
3596    #[allow(irrefutable_let_patterns)]
3597    pub fn into_on_context_dev_tools_available(
3598        self,
3599    ) -> Option<(
3600        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
3601        DevToolsListenerControlHandle,
3602    )> {
3603        if let DevToolsListenerRequest::OnContextDevToolsAvailable { listener, control_handle } =
3604            self
3605        {
3606            Some((listener, control_handle))
3607        } else {
3608            None
3609        }
3610    }
3611
3612    /// Name of the method defined in FIDL
3613    pub fn method_name(&self) -> &'static str {
3614        match *self {
3615            DevToolsListenerRequest::OnContextDevToolsAvailable { .. } => {
3616                "on_context_dev_tools_available"
3617            }
3618        }
3619    }
3620}
3621
3622#[derive(Debug, Clone)]
3623pub struct DevToolsListenerControlHandle {
3624    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3625}
3626
3627impl fidl::endpoints::ControlHandle for DevToolsListenerControlHandle {
3628    fn shutdown(&self) {
3629        self.inner.shutdown()
3630    }
3631
3632    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3633        self.inner.shutdown_with_epitaph(status)
3634    }
3635
3636    fn is_closed(&self) -> bool {
3637        self.inner.channel().is_closed()
3638    }
3639    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3640        self.inner.channel().on_closed()
3641    }
3642
3643    #[cfg(target_os = "fuchsia")]
3644    fn signal_peer(
3645        &self,
3646        clear_mask: zx::Signals,
3647        set_mask: zx::Signals,
3648    ) -> Result<(), zx_status::Status> {
3649        use fidl::Peered;
3650        self.inner.channel().signal_peer(clear_mask, set_mask)
3651    }
3652}
3653
3654impl DevToolsListenerControlHandle {}
3655
3656#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3657pub struct DevToolsPerContextListenerMarker;
3658
3659impl fidl::endpoints::ProtocolMarker for DevToolsPerContextListenerMarker {
3660    type Proxy = DevToolsPerContextListenerProxy;
3661    type RequestStream = DevToolsPerContextListenerRequestStream;
3662    #[cfg(target_os = "fuchsia")]
3663    type SynchronousProxy = DevToolsPerContextListenerSynchronousProxy;
3664
3665    const DEBUG_NAME: &'static str = "(anonymous) DevToolsPerContextListener";
3666}
3667
3668pub trait DevToolsPerContextListenerProxyInterface: Send + Sync {
3669    fn r#on_http_port_open(&self, port: u16) -> Result<(), fidl::Error>;
3670}
3671#[derive(Debug)]
3672#[cfg(target_os = "fuchsia")]
3673pub struct DevToolsPerContextListenerSynchronousProxy {
3674    client: fidl::client::sync::Client,
3675}
3676
3677#[cfg(target_os = "fuchsia")]
3678impl fidl::endpoints::SynchronousProxy for DevToolsPerContextListenerSynchronousProxy {
3679    type Proxy = DevToolsPerContextListenerProxy;
3680    type Protocol = DevToolsPerContextListenerMarker;
3681
3682    fn from_channel(inner: fidl::Channel) -> Self {
3683        Self::new(inner)
3684    }
3685
3686    fn into_channel(self) -> fidl::Channel {
3687        self.client.into_channel()
3688    }
3689
3690    fn as_channel(&self) -> &fidl::Channel {
3691        self.client.as_channel()
3692    }
3693}
3694
3695#[cfg(target_os = "fuchsia")]
3696impl DevToolsPerContextListenerSynchronousProxy {
3697    pub fn new(channel: fidl::Channel) -> Self {
3698        let protocol_name =
3699            <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3700        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3701    }
3702
3703    pub fn into_channel(self) -> fidl::Channel {
3704        self.client.into_channel()
3705    }
3706
3707    /// Waits until an event arrives and returns it. It is safe for other
3708    /// threads to make concurrent requests while waiting for an event.
3709    pub fn wait_for_event(
3710        &self,
3711        deadline: zx::MonotonicInstant,
3712    ) -> Result<DevToolsPerContextListenerEvent, fidl::Error> {
3713        DevToolsPerContextListenerEvent::decode(self.client.wait_for_event(deadline)?)
3714    }
3715
3716    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3717    /// remain open until the [`Context`] is destroyed.
3718    ///
3719    /// - `port`: The port used by the service.
3720    pub fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3721        self.client.send::<DevToolsPerContextListenerOnHttpPortOpenRequest>(
3722            (port,),
3723            0x5e330939b035553b,
3724            fidl::encoding::DynamicFlags::empty(),
3725        )
3726    }
3727}
3728
3729#[cfg(target_os = "fuchsia")]
3730impl From<DevToolsPerContextListenerSynchronousProxy> for zx::NullableHandle {
3731    fn from(value: DevToolsPerContextListenerSynchronousProxy) -> Self {
3732        value.into_channel().into()
3733    }
3734}
3735
3736#[cfg(target_os = "fuchsia")]
3737impl From<fidl::Channel> for DevToolsPerContextListenerSynchronousProxy {
3738    fn from(value: fidl::Channel) -> Self {
3739        Self::new(value)
3740    }
3741}
3742
3743#[cfg(target_os = "fuchsia")]
3744impl fidl::endpoints::FromClient for DevToolsPerContextListenerSynchronousProxy {
3745    type Protocol = DevToolsPerContextListenerMarker;
3746
3747    fn from_client(value: fidl::endpoints::ClientEnd<DevToolsPerContextListenerMarker>) -> Self {
3748        Self::new(value.into_channel())
3749    }
3750}
3751
3752#[derive(Debug, Clone)]
3753pub struct DevToolsPerContextListenerProxy {
3754    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3755}
3756
3757impl fidl::endpoints::Proxy for DevToolsPerContextListenerProxy {
3758    type Protocol = DevToolsPerContextListenerMarker;
3759
3760    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3761        Self::new(inner)
3762    }
3763
3764    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3765        self.client.into_channel().map_err(|client| Self { client })
3766    }
3767
3768    fn as_channel(&self) -> &::fidl::AsyncChannel {
3769        self.client.as_channel()
3770    }
3771}
3772
3773impl DevToolsPerContextListenerProxy {
3774    /// Create a new Proxy for fuchsia.web/DevToolsPerContextListener.
3775    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3776        let protocol_name =
3777            <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3778        Self { client: fidl::client::Client::new(channel, protocol_name) }
3779    }
3780
3781    /// Get a Stream of events from the remote end of the protocol.
3782    ///
3783    /// # Panics
3784    ///
3785    /// Panics if the event stream was already taken.
3786    pub fn take_event_stream(&self) -> DevToolsPerContextListenerEventStream {
3787        DevToolsPerContextListenerEventStream { event_receiver: self.client.take_event_receiver() }
3788    }
3789
3790    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3791    /// remain open until the [`Context`] is destroyed.
3792    ///
3793    /// - `port`: The port used by the service.
3794    pub fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3795        DevToolsPerContextListenerProxyInterface::r#on_http_port_open(self, port)
3796    }
3797}
3798
3799impl DevToolsPerContextListenerProxyInterface for DevToolsPerContextListenerProxy {
3800    fn r#on_http_port_open(&self, mut port: u16) -> Result<(), fidl::Error> {
3801        self.client.send::<DevToolsPerContextListenerOnHttpPortOpenRequest>(
3802            (port,),
3803            0x5e330939b035553b,
3804            fidl::encoding::DynamicFlags::empty(),
3805        )
3806    }
3807}
3808
3809pub struct DevToolsPerContextListenerEventStream {
3810    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3811}
3812
3813impl std::marker::Unpin for DevToolsPerContextListenerEventStream {}
3814
3815impl futures::stream::FusedStream for DevToolsPerContextListenerEventStream {
3816    fn is_terminated(&self) -> bool {
3817        self.event_receiver.is_terminated()
3818    }
3819}
3820
3821impl futures::Stream for DevToolsPerContextListenerEventStream {
3822    type Item = Result<DevToolsPerContextListenerEvent, fidl::Error>;
3823
3824    fn poll_next(
3825        mut self: std::pin::Pin<&mut Self>,
3826        cx: &mut std::task::Context<'_>,
3827    ) -> std::task::Poll<Option<Self::Item>> {
3828        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3829            &mut self.event_receiver,
3830            cx
3831        )?) {
3832            Some(buf) => std::task::Poll::Ready(Some(DevToolsPerContextListenerEvent::decode(buf))),
3833            None => std::task::Poll::Ready(None),
3834        }
3835    }
3836}
3837
3838#[derive(Debug)]
3839pub enum DevToolsPerContextListenerEvent {}
3840
3841impl DevToolsPerContextListenerEvent {
3842    /// Decodes a message buffer as a [`DevToolsPerContextListenerEvent`].
3843    fn decode(
3844        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3845    ) -> Result<DevToolsPerContextListenerEvent, fidl::Error> {
3846        let (bytes, _handles) = buf.split_mut();
3847        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3848        debug_assert_eq!(tx_header.tx_id, 0);
3849        match tx_header.ordinal {
3850            _ => Err(fidl::Error::UnknownOrdinal {
3851                ordinal: tx_header.ordinal,
3852                protocol_name: <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3853            })
3854        }
3855    }
3856}
3857
3858/// A Stream of incoming requests for fuchsia.web/DevToolsPerContextListener.
3859pub struct DevToolsPerContextListenerRequestStream {
3860    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3861    is_terminated: bool,
3862}
3863
3864impl std::marker::Unpin for DevToolsPerContextListenerRequestStream {}
3865
3866impl futures::stream::FusedStream for DevToolsPerContextListenerRequestStream {
3867    fn is_terminated(&self) -> bool {
3868        self.is_terminated
3869    }
3870}
3871
3872impl fidl::endpoints::RequestStream for DevToolsPerContextListenerRequestStream {
3873    type Protocol = DevToolsPerContextListenerMarker;
3874    type ControlHandle = DevToolsPerContextListenerControlHandle;
3875
3876    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3877        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3878    }
3879
3880    fn control_handle(&self) -> Self::ControlHandle {
3881        DevToolsPerContextListenerControlHandle { inner: self.inner.clone() }
3882    }
3883
3884    fn into_inner(
3885        self,
3886    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3887    {
3888        (self.inner, self.is_terminated)
3889    }
3890
3891    fn from_inner(
3892        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3893        is_terminated: bool,
3894    ) -> Self {
3895        Self { inner, is_terminated }
3896    }
3897}
3898
3899impl futures::Stream for DevToolsPerContextListenerRequestStream {
3900    type Item = Result<DevToolsPerContextListenerRequest, fidl::Error>;
3901
3902    fn poll_next(
3903        mut self: std::pin::Pin<&mut Self>,
3904        cx: &mut std::task::Context<'_>,
3905    ) -> std::task::Poll<Option<Self::Item>> {
3906        let this = &mut *self;
3907        if this.inner.check_shutdown(cx) {
3908            this.is_terminated = true;
3909            return std::task::Poll::Ready(None);
3910        }
3911        if this.is_terminated {
3912            panic!("polled DevToolsPerContextListenerRequestStream after completion");
3913        }
3914        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3915            |bytes, handles| {
3916                match this.inner.channel().read_etc(cx, bytes, handles) {
3917                    std::task::Poll::Ready(Ok(())) => {}
3918                    std::task::Poll::Pending => return std::task::Poll::Pending,
3919                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3920                        this.is_terminated = true;
3921                        return std::task::Poll::Ready(None);
3922                    }
3923                    std::task::Poll::Ready(Err(e)) => {
3924                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3925                            e.into(),
3926                        ))));
3927                    }
3928                }
3929
3930                // A message has been received from the channel
3931                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3932
3933                std::task::Poll::Ready(Some(match header.ordinal {
3934                0x5e330939b035553b => {
3935                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3936                    let mut req = fidl::new_empty!(DevToolsPerContextListenerOnHttpPortOpenRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3937                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DevToolsPerContextListenerOnHttpPortOpenRequest>(&header, _body_bytes, handles, &mut req)?;
3938                    let control_handle = DevToolsPerContextListenerControlHandle {
3939                        inner: this.inner.clone(),
3940                    };
3941                    Ok(DevToolsPerContextListenerRequest::OnHttpPortOpen {port: req.port,
3942
3943                        control_handle,
3944                    })
3945                }
3946                _ => Err(fidl::Error::UnknownOrdinal {
3947                    ordinal: header.ordinal,
3948                    protocol_name: <DevToolsPerContextListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3949                }),
3950            }))
3951            },
3952        )
3953    }
3954}
3955
3956/// Interface supplied by the debugging component to observe the DevTools service opening event.
3957#[derive(Debug)]
3958pub enum DevToolsPerContextListenerRequest {
3959    /// Called when the DevTools service starts accepting TCP connections on `port`. `port` will
3960    /// remain open until the [`Context`] is destroyed.
3961    ///
3962    /// - `port`: The port used by the service.
3963    OnHttpPortOpen { port: u16, control_handle: DevToolsPerContextListenerControlHandle },
3964}
3965
3966impl DevToolsPerContextListenerRequest {
3967    #[allow(irrefutable_let_patterns)]
3968    pub fn into_on_http_port_open(self) -> Option<(u16, DevToolsPerContextListenerControlHandle)> {
3969        if let DevToolsPerContextListenerRequest::OnHttpPortOpen { port, control_handle } = self {
3970            Some((port, control_handle))
3971        } else {
3972            None
3973        }
3974    }
3975
3976    /// Name of the method defined in FIDL
3977    pub fn method_name(&self) -> &'static str {
3978        match *self {
3979            DevToolsPerContextListenerRequest::OnHttpPortOpen { .. } => "on_http_port_open",
3980        }
3981    }
3982}
3983
3984#[derive(Debug, Clone)]
3985pub struct DevToolsPerContextListenerControlHandle {
3986    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3987}
3988
3989impl fidl::endpoints::ControlHandle for DevToolsPerContextListenerControlHandle {
3990    fn shutdown(&self) {
3991        self.inner.shutdown()
3992    }
3993
3994    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3995        self.inner.shutdown_with_epitaph(status)
3996    }
3997
3998    fn is_closed(&self) -> bool {
3999        self.inner.channel().is_closed()
4000    }
4001    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4002        self.inner.channel().on_closed()
4003    }
4004
4005    #[cfg(target_os = "fuchsia")]
4006    fn signal_peer(
4007        &self,
4008        clear_mask: zx::Signals,
4009        set_mask: zx::Signals,
4010    ) -> Result<(), zx_status::Status> {
4011        use fidl::Peered;
4012        self.inner.channel().signal_peer(clear_mask, set_mask)
4013    }
4014}
4015
4016impl DevToolsPerContextListenerControlHandle {}
4017
4018#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4019pub struct FrameMarker;
4020
4021impl fidl::endpoints::ProtocolMarker for FrameMarker {
4022    type Proxy = FrameProxy;
4023    type RequestStream = FrameRequestStream;
4024    #[cfg(target_os = "fuchsia")]
4025    type SynchronousProxy = FrameSynchronousProxy;
4026
4027    const DEBUG_NAME: &'static str = "(anonymous) Frame";
4028}
4029pub type FrameExecuteJavaScriptResult = Result<fidl_fuchsia_mem::Buffer, FrameError>;
4030pub type FrameExecuteJavaScriptNoResultResult = Result<(), FrameError>;
4031pub type FrameAddBeforeLoadJavaScriptResult = Result<(), FrameError>;
4032pub type FramePostMessageResult = Result<(), FrameError>;
4033
4034pub trait FrameProxyInterface: Send + Sync {
4035    fn r#create_view(
4036        &self,
4037        view_token: fidl_fuchsia_ui_views::ViewToken,
4038    ) -> Result<(), fidl::Error>;
4039    fn r#create_view_with_view_ref(
4040        &self,
4041        view_token: fidl_fuchsia_ui_views::ViewToken,
4042        view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4043        view_ref: fidl_fuchsia_ui_views::ViewRef,
4044    ) -> Result<(), fidl::Error>;
4045    fn r#create_view2(&self, args: CreateView2Args) -> Result<(), fidl::Error>;
4046    fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error>;
4047    fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error>;
4048    fn r#get_media_player(
4049        &self,
4050        player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4051    ) -> Result<(), fidl::Error>;
4052    fn r#get_navigation_controller(
4053        &self,
4054        controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4055    ) -> Result<(), fidl::Error>;
4056    type ExecuteJavaScriptResponseFut: std::future::Future<Output = Result<FrameExecuteJavaScriptResult, fidl::Error>>
4057        + Send;
4058    fn r#execute_java_script(
4059        &self,
4060        origins: &[String],
4061        script: fidl_fuchsia_mem::Buffer,
4062    ) -> Self::ExecuteJavaScriptResponseFut;
4063    type ExecuteJavaScriptNoResultResponseFut: std::future::Future<Output = Result<FrameExecuteJavaScriptNoResultResult, fidl::Error>>
4064        + Send;
4065    fn r#execute_java_script_no_result(
4066        &self,
4067        origins: &[String],
4068        script: fidl_fuchsia_mem::Buffer,
4069    ) -> Self::ExecuteJavaScriptNoResultResponseFut;
4070    type AddBeforeLoadJavaScriptResponseFut: std::future::Future<Output = Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error>>
4071        + Send;
4072    fn r#add_before_load_java_script(
4073        &self,
4074        id: u64,
4075        origins: &[String],
4076        script: fidl_fuchsia_mem::Buffer,
4077    ) -> Self::AddBeforeLoadJavaScriptResponseFut;
4078    fn r#remove_before_load_java_script(&self, id: u64) -> Result<(), fidl::Error>;
4079    type PostMessageResponseFut: std::future::Future<Output = Result<FramePostMessageResult, fidl::Error>>
4080        + Send;
4081    fn r#post_message(
4082        &self,
4083        target_origin: &str,
4084        message: WebMessage,
4085    ) -> Self::PostMessageResponseFut;
4086    fn r#set_navigation_event_listener(
4087        &self,
4088        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4089    ) -> Result<(), fidl::Error>;
4090    fn r#set_navigation_event_listener2(
4091        &self,
4092        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4093        flags: NavigationEventListenerFlags,
4094    ) -> Result<(), fidl::Error>;
4095    fn r#set_java_script_log_level(&self, level: ConsoleLogLevel) -> Result<(), fidl::Error>;
4096    fn r#set_console_log_sink(
4097        &self,
4098        sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4099    ) -> Result<(), fidl::Error>;
4100    fn r#configure_input_types(
4101        &self,
4102        types: InputTypes,
4103        allow: AllowInputState,
4104    ) -> Result<(), fidl::Error>;
4105    fn r#set_popup_frame_creation_listener(
4106        &self,
4107        listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4108    ) -> Result<(), fidl::Error>;
4109    type SetUrlRequestRewriteRulesResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
4110        + Send;
4111    fn r#set_url_request_rewrite_rules(
4112        &self,
4113        rules: &[UrlRequestRewriteRule],
4114    ) -> Self::SetUrlRequestRewriteRulesResponseFut;
4115    fn r#set_media_settings(&self, settings: &FrameMediaSettings) -> Result<(), fidl::Error>;
4116    fn r#force_content_dimensions(
4117        &self,
4118        web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4119    ) -> Result<(), fidl::Error>;
4120    fn r#set_permission_state(
4121        &self,
4122        permission: &PermissionDescriptor,
4123        web_origin: &str,
4124        state: PermissionState,
4125    ) -> Result<(), fidl::Error>;
4126    fn r#set_block_media_loading(&self, blocked: bool) -> Result<(), fidl::Error>;
4127    type GetPrivateMemorySizeResponseFut: std::future::Future<Output = Result<u64, fidl::Error>>
4128        + Send;
4129    fn r#get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut;
4130    fn r#set_navigation_policy_provider(
4131        &self,
4132        params: &NavigationPolicyProviderParams,
4133        provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
4134    ) -> Result<(), fidl::Error>;
4135    fn r#set_content_area_settings(
4136        &self,
4137        settings: &ContentAreaSettings,
4138    ) -> Result<(), fidl::Error>;
4139    fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error>;
4140    fn r#close(&self, payload: &FrameCloseRequest) -> Result<(), fidl::Error>;
4141}
4142#[derive(Debug)]
4143#[cfg(target_os = "fuchsia")]
4144pub struct FrameSynchronousProxy {
4145    client: fidl::client::sync::Client,
4146}
4147
4148#[cfg(target_os = "fuchsia")]
4149impl fidl::endpoints::SynchronousProxy for FrameSynchronousProxy {
4150    type Proxy = FrameProxy;
4151    type Protocol = FrameMarker;
4152
4153    fn from_channel(inner: fidl::Channel) -> Self {
4154        Self::new(inner)
4155    }
4156
4157    fn into_channel(self) -> fidl::Channel {
4158        self.client.into_channel()
4159    }
4160
4161    fn as_channel(&self) -> &fidl::Channel {
4162        self.client.as_channel()
4163    }
4164}
4165
4166#[cfg(target_os = "fuchsia")]
4167impl FrameSynchronousProxy {
4168    pub fn new(channel: fidl::Channel) -> Self {
4169        let protocol_name = <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4170        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4171    }
4172
4173    pub fn into_channel(self) -> fidl::Channel {
4174        self.client.into_channel()
4175    }
4176
4177    /// Waits until an event arrives and returns it. It is safe for other
4178    /// threads to make concurrent requests while waiting for an event.
4179    pub fn wait_for_event(
4180        &self,
4181        deadline: zx::MonotonicInstant,
4182    ) -> Result<FrameEvent, fidl::Error> {
4183        FrameEvent::decode(self.client.wait_for_event(deadline)?)
4184    }
4185
4186    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4187    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4188    ///
4189    /// See the description of [`CreateContextParams.service_directory`] for additional services
4190    /// that must be present when using this method.
4191    pub fn r#create_view(
4192        &self,
4193        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4194    ) -> Result<(), fidl::Error> {
4195        self.client.send::<FrameCreateViewRequest>(
4196            (&mut view_token,),
4197            0x6a27859439133264,
4198            fidl::encoding::DynamicFlags::empty(),
4199        )
4200    }
4201
4202    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4203    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4204    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
4205    /// track the view.
4206    ///
4207    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
4208    /// and `view_token` will be closed.
4209    ///
4210    /// See the description of [`CreateContextParams.service_directory`] for additional services
4211    /// that must be present when using this method.
4212    pub fn r#create_view_with_view_ref(
4213        &self,
4214        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4215        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4216        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
4217    ) -> Result<(), fidl::Error> {
4218        self.client.send::<FrameCreateViewWithViewRefRequest>(
4219            (&mut view_token, &mut view_ref_control, &mut view_ref),
4220            0x1eb17ab2442326ac,
4221            fidl::encoding::DynamicFlags::empty(),
4222        )
4223    }
4224
4225    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
4226    /// Caller should pass the other end of the token to
4227    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
4228    /// graph.
4229    pub fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
4230        self.client.send::<FrameCreateView2Request>(
4231            (&mut args,),
4232            0x1be7e9512962eb37,
4233            fidl::encoding::DynamicFlags::empty(),
4234        )
4235    }
4236
4237    /// Enables headless rendering of the Frame.
4238    ///
4239    /// This is used when content depends on layout and/or animation events firing normally.
4240    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4241    pub fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
4242        self.client.send::<fidl::encoding::EmptyPayload>(
4243            (),
4244            0x72a81aaae7a80d2b,
4245            fidl::encoding::DynamicFlags::empty(),
4246        )
4247    }
4248
4249    /// Stops headless rendering of the Frame.
4250    ///
4251    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4252    pub fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
4253        self.client.send::<fidl::encoding::EmptyPayload>(
4254            (),
4255            0x5ca38a3d1f7f543a,
4256            fidl::encoding::DynamicFlags::empty(),
4257        )
4258    }
4259
4260    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
4261    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
4262    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
4263    pub fn r#get_media_player(
4264        &self,
4265        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4266    ) -> Result<(), fidl::Error> {
4267        self.client.send::<FrameGetMediaPlayerRequest>(
4268            (player,),
4269            0xaafb639fc0b9eb9,
4270            fidl::encoding::DynamicFlags::empty(),
4271        )
4272    }
4273
4274    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
4275    /// reloaded, etc.
4276    ///
4277    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
4278    ///   [`NavigationController`].
4279    pub fn r#get_navigation_controller(
4280        &self,
4281        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4282    ) -> Result<(), fidl::Error> {
4283        self.client.send::<FrameGetNavigationControllerRequest>(
4284            (controller,),
4285            0x4521cfe95217a688,
4286            fidl::encoding::DynamicFlags::empty(),
4287        )
4288    }
4289
4290    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
4291    /// which matches entries in `origins`.
4292    ///
4293    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4294    /// `origins`, then the script will be evaluated unconditionally.
4295    ///
4296    /// Returns the result of executing `script`, as a JSON-encoded string.
4297    ///
4298    /// Note that scripts share the same execution context as the document,
4299    /// meaning that document may modify variables, classes, or objects set by
4300    /// the script in arbitrary or unpredictable ways.
4301    ///
4302    /// If an error occurred, the FrameError will be set to one of these values:
4303    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4304    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
4305    ///   `origins` or `origins` is an empty vector.
4306    pub fn r#execute_java_script(
4307        &self,
4308        mut origins: &[String],
4309        mut script: fidl_fuchsia_mem::Buffer,
4310        ___deadline: zx::MonotonicInstant,
4311    ) -> Result<FrameExecuteJavaScriptResult, fidl::Error> {
4312        let _response = self.client.send_query::<
4313            FrameExecuteJavaScriptRequest,
4314            fidl::encoding::ResultType<FrameExecuteJavaScriptResponse, FrameError>,
4315        >(
4316            (origins, &mut script,),
4317            0x79abdd4907000542,
4318            fidl::encoding::DynamicFlags::empty(),
4319            ___deadline,
4320        )?;
4321        Ok(_response.map(|x| x.result))
4322    }
4323
4324    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
4325    /// a result.
4326    pub fn r#execute_java_script_no_result(
4327        &self,
4328        mut origins: &[String],
4329        mut script: fidl_fuchsia_mem::Buffer,
4330        ___deadline: zx::MonotonicInstant,
4331    ) -> Result<FrameExecuteJavaScriptNoResultResult, fidl::Error> {
4332        let _response = self.client.send_query::<
4333            FrameExecuteJavaScriptNoResultRequest,
4334            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
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        >(
4372            (id, origins, &mut script,),
4373            0x540ac0da59d823e,
4374            fidl::encoding::DynamicFlags::empty(),
4375            ___deadline,
4376        )?;
4377        Ok(_response.map(|x| x))
4378    }
4379
4380    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
4381    /// is no JavaScript snippet identified by `id`.
4382    pub fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
4383        self.client.send::<FrameRemoveBeforeLoadJavaScriptRequest>(
4384            (id,),
4385            0x17d92b855b61d23a,
4386            fidl::encoding::DynamicFlags::empty(),
4387        )
4388    }
4389
4390    /// Posts a message to the frame's onMessage handler.
4391    ///
4392    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
4393    /// `"*"`, then the message will be sent to the document regardless of its origin.
4394    /// See the
4395    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
4396    /// section 9.4.3 for more details on how the target origin policy is applied.
4397    ///
4398    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4399    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
4400    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
4401    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4402    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
4403    pub fn r#post_message(
4404        &self,
4405        mut target_origin: &str,
4406        mut message: WebMessage,
4407        ___deadline: zx::MonotonicInstant,
4408    ) -> Result<FramePostMessageResult, fidl::Error> {
4409        let _response = self.client.send_query::<
4410            FramePostMessageRequest,
4411            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
4412        >(
4413            (target_origin, &mut message,),
4414            0x751d686eb7caa341,
4415            fidl::encoding::DynamicFlags::empty(),
4416            ___deadline,
4417        )?;
4418        Ok(_response.map(|x| x))
4419    }
4420
4421    /// Sets the listener for handling page navigation events.
4422    ///
4423    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4424    pub fn r#set_navigation_event_listener(
4425        &self,
4426        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4427    ) -> Result<(), fidl::Error> {
4428        self.client.send::<FrameSetNavigationEventListenerRequest>(
4429            (listener,),
4430            0x965ba0fa20e0a56,
4431            fidl::encoding::DynamicFlags::empty(),
4432        )
4433    }
4434
4435    /// Sets the listener for handling page navigation events. The listener will receive the
4436    /// current navigation state immediately. After that, it's notified whenever the state changes.
4437    ///
4438    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4439    /// - `flags`: Flags for optional features that should be enabled for the listener.
4440    pub fn r#set_navigation_event_listener2(
4441        &self,
4442        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4443        mut flags: NavigationEventListenerFlags,
4444    ) -> Result<(), fidl::Error> {
4445        self.client.send::<FrameSetNavigationEventListener2Request>(
4446            (listener, flags),
4447            0x5f8b40607f1f578f,
4448            fidl::encoding::DynamicFlags::empty(),
4449        )
4450    }
4451
4452    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
4453    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
4454    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
4455    /// `error()`).
4456    /// The default value is [`ConsoleLogLevel.NONE`].
4457    ///
4458    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
4459    /// in Incognito and other private browsing modes.
4460    ///
4461    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
4462    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
4463    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
4464    ///   severity.
4465    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
4466    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
4467    pub fn r#set_java_script_log_level(
4468        &self,
4469        mut level: ConsoleLogLevel,
4470    ) -> Result<(), fidl::Error> {
4471        self.client.send::<FrameSetJavaScriptLogLevelRequest>(
4472            (level,),
4473            0x74824b11a71c4b5b,
4474            fidl::encoding::DynamicFlags::empty(),
4475        )
4476    }
4477
4478    /// Specifies where to emit `console` log output to. By default log output will be routed to a
4479    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
4480    ///
4481    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
4482    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
4483    pub fn r#set_console_log_sink(
4484        &self,
4485        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
4486    ) -> Result<(), fidl::Error> {
4487        self.client.send::<FrameSetConsoleLogSinkRequest>(
4488            (sink,),
4489            0x18f5cbc19fa4687b,
4490            fidl::encoding::DynamicFlags::empty(),
4491        )
4492    }
4493
4494    /// Enables or disables the processing of the specified `types` of user inputs.
4495    /// `allow` specifies whether to enable or disable the specified `types`.
4496    /// All input types are enabled by default.
4497    pub fn r#configure_input_types(
4498        &self,
4499        mut types: InputTypes,
4500        mut allow: AllowInputState,
4501    ) -> Result<(), fidl::Error> {
4502        self.client.send::<FrameConfigureInputTypesRequest>(
4503            (types, allow),
4504            0x38e08fe763c6bef6,
4505            fidl::encoding::DynamicFlags::empty(),
4506        )
4507    }
4508
4509    /// Sets the listener for handling popup frame opened by web content. If no listener is
4510    /// present, then any new popup frame will be blocked.
4511    ///
4512    /// - `listener`: The listener to use. Unregisters any existing listener if null.
4513    pub fn r#set_popup_frame_creation_listener(
4514        &self,
4515        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
4516    ) -> Result<(), fidl::Error> {
4517        self.client.send::<FrameSetPopupFrameCreationListenerRequest>(
4518            (listener,),
4519            0x34ddec4e9f11e2aa,
4520            fidl::encoding::DynamicFlags::empty(),
4521        )
4522    }
4523
4524    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
4525    /// - `rules` are cumulative and applied in order.
4526    /// - `rules` are only applied on the first URL request in a redirect chain.
4527    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
4528    ///   will be closed with `ERR_INVALID_ARGS`.
4529    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
4530    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
4531    ///   `ERR_BAD_STATE`.
4532    pub fn r#set_url_request_rewrite_rules(
4533        &self,
4534        mut rules: &[UrlRequestRewriteRule],
4535        ___deadline: zx::MonotonicInstant,
4536    ) -> Result<(), fidl::Error> {
4537        let _response = self
4538            .client
4539            .send_query::<FrameSetUrlRequestRewriteRulesRequest, fidl::encoding::EmptyPayload>(
4540                (rules,),
4541                0x2e3f797350ab3281,
4542                fidl::encoding::DynamicFlags::empty(),
4543                ___deadline,
4544            )?;
4545        Ok(_response)
4546    }
4547
4548    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
4549    /// applied to audio streams that started after this message is processed. Should be called
4550    /// before the Frame is navigated to content in order to ensure that the settings applied to
4551    /// all media streams. Due to request pipelining, this means doing so before calling
4552    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
4553    pub fn r#set_media_settings(
4554        &self,
4555        mut settings: &FrameMediaSettings,
4556    ) -> Result<(), fidl::Error> {
4557        self.client.send::<FrameSetMediaSettingsRequest>(
4558            (settings,),
4559            0x7da879b6d284c143,
4560            fidl::encoding::DynamicFlags::empty(),
4561        )
4562    }
4563
4564    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
4565    /// web content will be adjusted in response to changes in the pixel size of the View,
4566    /// rather than changing the size reported to the content. Call with null `web_dips` to
4567    /// remove any prior forced content dimensions.
4568    pub fn r#force_content_dimensions(
4569        &self,
4570        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
4571    ) -> Result<(), fidl::Error> {
4572        self.client.send::<FrameForceContentDimensionsRequest>(
4573            (web_dips,),
4574            0x8c7024c7149c901,
4575            fidl::encoding::DynamicFlags::empty(),
4576        )
4577    }
4578
4579    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
4580    /// permissions are denied.
4581    pub fn r#set_permission_state(
4582        &self,
4583        mut permission: &PermissionDescriptor,
4584        mut web_origin: &str,
4585        mut state: PermissionState,
4586    ) -> Result<(), fidl::Error> {
4587        self.client.send::<FrameSetPermissionStateRequest>(
4588            (permission, web_origin, state),
4589            0x19574e92a7033f4f,
4590            fidl::encoding::DynamicFlags::empty(),
4591        )
4592    }
4593
4594    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
4595    /// resources.
4596    ///
4597    /// May be used, for example, to prevent loading media in frames that are not visible.
4598    ///
4599    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
4600    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
4601    /// unblocked by a call to this method.
4602    ///
4603    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
4604    /// playing as appropriate.
4605    ///
4606    /// Any elements that have begun fetching or loading media resources for the current source
4607    /// before media loading was blocked will continue to fetch, load, and start playback as
4608    /// appropriate. This includes calls to `play()` even after media loading is blocked.
4609    pub fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
4610        self.client.send::<FrameSetBlockMediaLoadingRequest>(
4611            (blocked,),
4612            0x211071458fc9cf4f,
4613            fidl::encoding::DynamicFlags::empty(),
4614        )
4615    }
4616
4617    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
4618    /// document. The returned size might not reflect the memory usage of embedded iframes.
4619    pub fn r#get_private_memory_size(
4620        &self,
4621        ___deadline: zx::MonotonicInstant,
4622    ) -> Result<u64, fidl::Error> {
4623        let _response = self
4624            .client
4625            .send_query::<fidl::encoding::EmptyPayload, FrameGetPrivateMemorySizeResponse>(
4626                (),
4627                0x6ad4d43da6c129b0,
4628                fidl::encoding::DynamicFlags::empty(),
4629                ___deadline,
4630            )?;
4631        Ok(_response.size_bytes)
4632    }
4633
4634    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
4635    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
4636    /// requests. `params` defines when the message is sent. After sending the
4637    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
4638    /// until it receives a response.
4639    ///
4640    /// Should be called before `GetNavigationController` to ensure that it is applied to all
4641    /// navigations including the first [`NavigationController.LoadURL`] request.
4642    pub fn r#set_navigation_policy_provider(
4643        &self,
4644        mut params: &NavigationPolicyProviderParams,
4645        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
4646    ) -> Result<(), fidl::Error> {
4647        self.client.send::<FrameSetNavigationPolicyProviderRequest>(
4648            (params, provider),
4649            0x602ce35195d66654,
4650            fidl::encoding::DynamicFlags::empty(),
4651        )
4652    }
4653
4654    /// Sets various settings for how web content should be run in the Frame. May be called at any
4655    /// time, including after the URL has loaded. Each call changes only the specified fields,
4656    /// overwriting any prior value.
4657    ///
4658    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
4659    /// is not supported by the Frame.
4660    pub fn r#set_content_area_settings(
4661        &self,
4662        mut settings: &ContentAreaSettings,
4663    ) -> Result<(), fidl::Error> {
4664        self.client.send::<FrameSetContentAreaSettingsRequest>(
4665            (settings,),
4666            0x851f4de50c3c27e,
4667            fidl::encoding::DynamicFlags::empty(),
4668        )
4669    }
4670
4671    /// Reset the Frame's [`ContentAreaSettings`] to default values.
4672    pub fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
4673        self.client.send::<fidl::encoding::EmptyPayload>(
4674            (),
4675            0x6807e04f16f8ee5d,
4676            fidl::encoding::DynamicFlags::empty(),
4677        )
4678    }
4679
4680    /// Request graceful or immediate teardown of the Frame content and notification of completion
4681    /// via Frame epitaph.
4682    ///
4683    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
4684    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
4685    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
4686    /// content to run event handlers.
4687    ///
4688    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
4689    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
4690    ///
4691    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
4692    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
4693    ///   otherwise.
4694    ///
4695    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
4696    ///
4697    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
4698    pub fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
4699        self.client.send::<FrameCloseRequest>(
4700            payload,
4701            0x442e84138e65351,
4702            fidl::encoding::DynamicFlags::empty(),
4703        )
4704    }
4705}
4706
4707#[cfg(target_os = "fuchsia")]
4708impl From<FrameSynchronousProxy> for zx::NullableHandle {
4709    fn from(value: FrameSynchronousProxy) -> Self {
4710        value.into_channel().into()
4711    }
4712}
4713
4714#[cfg(target_os = "fuchsia")]
4715impl From<fidl::Channel> for FrameSynchronousProxy {
4716    fn from(value: fidl::Channel) -> Self {
4717        Self::new(value)
4718    }
4719}
4720
4721#[cfg(target_os = "fuchsia")]
4722impl fidl::endpoints::FromClient for FrameSynchronousProxy {
4723    type Protocol = FrameMarker;
4724
4725    fn from_client(value: fidl::endpoints::ClientEnd<FrameMarker>) -> Self {
4726        Self::new(value.into_channel())
4727    }
4728}
4729
4730#[derive(Debug, Clone)]
4731pub struct FrameProxy {
4732    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4733}
4734
4735impl fidl::endpoints::Proxy for FrameProxy {
4736    type Protocol = FrameMarker;
4737
4738    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4739        Self::new(inner)
4740    }
4741
4742    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4743        self.client.into_channel().map_err(|client| Self { client })
4744    }
4745
4746    fn as_channel(&self) -> &::fidl::AsyncChannel {
4747        self.client.as_channel()
4748    }
4749}
4750
4751impl FrameProxy {
4752    /// Create a new Proxy for fuchsia.web/Frame.
4753    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4754        let protocol_name = <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4755        Self { client: fidl::client::Client::new(channel, protocol_name) }
4756    }
4757
4758    /// Get a Stream of events from the remote end of the protocol.
4759    ///
4760    /// # Panics
4761    ///
4762    /// Panics if the event stream was already taken.
4763    pub fn take_event_stream(&self) -> FrameEventStream {
4764        FrameEventStream { event_receiver: self.client.take_event_receiver() }
4765    }
4766
4767    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4768    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4769    ///
4770    /// See the description of [`CreateContextParams.service_directory`] for additional services
4771    /// that must be present when using this method.
4772    pub fn r#create_view(
4773        &self,
4774        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4775    ) -> Result<(), fidl::Error> {
4776        FrameProxyInterface::r#create_view(self, view_token)
4777    }
4778
4779    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
4780    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
4781    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
4782    /// track the view.
4783    ///
4784    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
4785    /// and `view_token` will be closed.
4786    ///
4787    /// See the description of [`CreateContextParams.service_directory`] for additional services
4788    /// that must be present when using this method.
4789    pub fn r#create_view_with_view_ref(
4790        &self,
4791        mut view_token: fidl_fuchsia_ui_views::ViewToken,
4792        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
4793        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
4794    ) -> Result<(), fidl::Error> {
4795        FrameProxyInterface::r#create_view_with_view_ref(
4796            self,
4797            view_token,
4798            view_ref_control,
4799            view_ref,
4800        )
4801    }
4802
4803    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
4804    /// Caller should pass the other end of the token to
4805    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
4806    /// graph.
4807    pub fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
4808        FrameProxyInterface::r#create_view2(self, args)
4809    }
4810
4811    /// Enables headless rendering of the Frame.
4812    ///
4813    /// This is used when content depends on layout and/or animation events firing normally.
4814    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4815    pub fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
4816        FrameProxyInterface::r#enable_headless_rendering(self)
4817    }
4818
4819    /// Stops headless rendering of the Frame.
4820    ///
4821    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
4822    pub fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
4823        FrameProxyInterface::r#disable_headless_rendering(self)
4824    }
4825
4826    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
4827    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
4828    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
4829    pub fn r#get_media_player(
4830        &self,
4831        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
4832    ) -> Result<(), fidl::Error> {
4833        FrameProxyInterface::r#get_media_player(self, player)
4834    }
4835
4836    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
4837    /// reloaded, etc.
4838    ///
4839    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
4840    ///   [`NavigationController`].
4841    pub fn r#get_navigation_controller(
4842        &self,
4843        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
4844    ) -> Result<(), fidl::Error> {
4845        FrameProxyInterface::r#get_navigation_controller(self, controller)
4846    }
4847
4848    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
4849    /// which matches entries in `origins`.
4850    ///
4851    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4852    /// `origins`, then the script will be evaluated unconditionally.
4853    ///
4854    /// Returns the result of executing `script`, as a JSON-encoded string.
4855    ///
4856    /// Note that scripts share the same execution context as the document,
4857    /// meaning that document may modify variables, classes, or objects set by
4858    /// the script in arbitrary or unpredictable ways.
4859    ///
4860    /// If an error occurred, the FrameError will be set to one of these values:
4861    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4862    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
4863    ///   `origins` or `origins` is an empty vector.
4864    pub fn r#execute_java_script(
4865        &self,
4866        mut origins: &[String],
4867        mut script: fidl_fuchsia_mem::Buffer,
4868    ) -> fidl::client::QueryResponseFut<
4869        FrameExecuteJavaScriptResult,
4870        fidl::encoding::DefaultFuchsiaResourceDialect,
4871    > {
4872        FrameProxyInterface::r#execute_java_script(self, origins, script)
4873    }
4874
4875    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
4876    /// a result.
4877    pub fn r#execute_java_script_no_result(
4878        &self,
4879        mut origins: &[String],
4880        mut script: fidl_fuchsia_mem::Buffer,
4881    ) -> fidl::client::QueryResponseFut<
4882        FrameExecuteJavaScriptNoResultResult,
4883        fidl::encoding::DefaultFuchsiaResourceDialect,
4884    > {
4885        FrameProxyInterface::r#execute_java_script_no_result(self, origins, script)
4886    }
4887
4888    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
4889    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
4890    /// of the document's scripts.
4891    ///
4892    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
4893    /// using the same `id` will be replaced.
4894    ///
4895    /// The order in which multiple bindings are executed is the same as the order in which the
4896    /// bindings were added. If a script is added which clobbers an existing script of the same
4897    /// `id`, the previous script's precedence in the injection order will be preserved.
4898    ///
4899    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
4900    /// `origins`, then the script will be evaluated unconditionally.
4901    ///
4902    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4903    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
4904    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4905    pub fn r#add_before_load_java_script(
4906        &self,
4907        mut id: u64,
4908        mut origins: &[String],
4909        mut script: fidl_fuchsia_mem::Buffer,
4910    ) -> fidl::client::QueryResponseFut<
4911        FrameAddBeforeLoadJavaScriptResult,
4912        fidl::encoding::DefaultFuchsiaResourceDialect,
4913    > {
4914        FrameProxyInterface::r#add_before_load_java_script(self, id, origins, script)
4915    }
4916
4917    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
4918    /// is no JavaScript snippet identified by `id`.
4919    pub fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
4920        FrameProxyInterface::r#remove_before_load_java_script(self, id)
4921    }
4922
4923    /// Posts a message to the frame's onMessage handler.
4924    ///
4925    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
4926    /// `"*"`, then the message will be sent to the document regardless of its origin.
4927    /// See the
4928    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
4929    /// section 9.4.3 for more details on how the target origin policy is applied.
4930    ///
4931    /// If an error occurred, the [`FrameError`] will be set to one of these values:
4932    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
4933    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
4934    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
4935    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
4936    pub fn r#post_message(
4937        &self,
4938        mut target_origin: &str,
4939        mut message: WebMessage,
4940    ) -> fidl::client::QueryResponseFut<
4941        FramePostMessageResult,
4942        fidl::encoding::DefaultFuchsiaResourceDialect,
4943    > {
4944        FrameProxyInterface::r#post_message(self, target_origin, message)
4945    }
4946
4947    /// Sets the listener for handling page navigation events.
4948    ///
4949    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4950    pub fn r#set_navigation_event_listener(
4951        &self,
4952        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4953    ) -> Result<(), fidl::Error> {
4954        FrameProxyInterface::r#set_navigation_event_listener(self, listener)
4955    }
4956
4957    /// Sets the listener for handling page navigation events. The listener will receive the
4958    /// current navigation state immediately. After that, it's notified whenever the state changes.
4959    ///
4960    /// - `listener`: The observer to use. Unregisters any existing listener if null.
4961    /// - `flags`: Flags for optional features that should be enabled for the listener.
4962    pub fn r#set_navigation_event_listener2(
4963        &self,
4964        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
4965        mut flags: NavigationEventListenerFlags,
4966    ) -> Result<(), fidl::Error> {
4967        FrameProxyInterface::r#set_navigation_event_listener2(self, listener, flags)
4968    }
4969
4970    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
4971    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
4972    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
4973    /// `error()`).
4974    /// The default value is [`ConsoleLogLevel.NONE`].
4975    ///
4976    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
4977    /// in Incognito and other private browsing modes.
4978    ///
4979    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
4980    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
4981    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
4982    ///   severity.
4983    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
4984    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
4985    pub fn r#set_java_script_log_level(
4986        &self,
4987        mut level: ConsoleLogLevel,
4988    ) -> Result<(), fidl::Error> {
4989        FrameProxyInterface::r#set_java_script_log_level(self, level)
4990    }
4991
4992    /// Specifies where to emit `console` log output to. By default log output will be routed to a
4993    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
4994    ///
4995    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
4996    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
4997    pub fn r#set_console_log_sink(
4998        &self,
4999        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
5000    ) -> Result<(), fidl::Error> {
5001        FrameProxyInterface::r#set_console_log_sink(self, sink)
5002    }
5003
5004    /// Enables or disables the processing of the specified `types` of user inputs.
5005    /// `allow` specifies whether to enable or disable the specified `types`.
5006    /// All input types are enabled by default.
5007    pub fn r#configure_input_types(
5008        &self,
5009        mut types: InputTypes,
5010        mut allow: AllowInputState,
5011    ) -> Result<(), fidl::Error> {
5012        FrameProxyInterface::r#configure_input_types(self, types, allow)
5013    }
5014
5015    /// Sets the listener for handling popup frame opened by web content. If no listener is
5016    /// present, then any new popup frame will be blocked.
5017    ///
5018    /// - `listener`: The listener to use. Unregisters any existing listener if null.
5019    pub fn r#set_popup_frame_creation_listener(
5020        &self,
5021        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
5022    ) -> Result<(), fidl::Error> {
5023        FrameProxyInterface::r#set_popup_frame_creation_listener(self, listener)
5024    }
5025
5026    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
5027    /// - `rules` are cumulative and applied in order.
5028    /// - `rules` are only applied on the first URL request in a redirect chain.
5029    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
5030    ///   will be closed with `ERR_INVALID_ARGS`.
5031    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
5032    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
5033    ///   `ERR_BAD_STATE`.
5034    pub fn r#set_url_request_rewrite_rules(
5035        &self,
5036        mut rules: &[UrlRequestRewriteRule],
5037    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5038        FrameProxyInterface::r#set_url_request_rewrite_rules(self, rules)
5039    }
5040
5041    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
5042    /// applied to audio streams that started after this message is processed. Should be called
5043    /// before the Frame is navigated to content in order to ensure that the settings applied to
5044    /// all media streams. Due to request pipelining, this means doing so before calling
5045    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
5046    pub fn r#set_media_settings(
5047        &self,
5048        mut settings: &FrameMediaSettings,
5049    ) -> Result<(), fidl::Error> {
5050        FrameProxyInterface::r#set_media_settings(self, settings)
5051    }
5052
5053    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
5054    /// web content will be adjusted in response to changes in the pixel size of the View,
5055    /// rather than changing the size reported to the content. Call with null `web_dips` to
5056    /// remove any prior forced content dimensions.
5057    pub fn r#force_content_dimensions(
5058        &self,
5059        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
5060    ) -> Result<(), fidl::Error> {
5061        FrameProxyInterface::r#force_content_dimensions(self, web_dips)
5062    }
5063
5064    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
5065    /// permissions are denied.
5066    pub fn r#set_permission_state(
5067        &self,
5068        mut permission: &PermissionDescriptor,
5069        mut web_origin: &str,
5070        mut state: PermissionState,
5071    ) -> Result<(), fidl::Error> {
5072        FrameProxyInterface::r#set_permission_state(self, permission, web_origin, state)
5073    }
5074
5075    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
5076    /// resources.
5077    ///
5078    /// May be used, for example, to prevent loading media in frames that are not visible.
5079    ///
5080    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
5081    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
5082    /// unblocked by a call to this method.
5083    ///
5084    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
5085    /// playing as appropriate.
5086    ///
5087    /// Any elements that have begun fetching or loading media resources for the current source
5088    /// before media loading was blocked will continue to fetch, load, and start playback as
5089    /// appropriate. This includes calls to `play()` even after media loading is blocked.
5090    pub fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
5091        FrameProxyInterface::r#set_block_media_loading(self, blocked)
5092    }
5093
5094    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
5095    /// document. The returned size might not reflect the memory usage of embedded iframes.
5096    pub fn r#get_private_memory_size(
5097        &self,
5098    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
5099        FrameProxyInterface::r#get_private_memory_size(self)
5100    }
5101
5102    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
5103    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
5104    /// requests. `params` defines when the message is sent. After sending the
5105    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
5106    /// until it receives a response.
5107    ///
5108    /// Should be called before `GetNavigationController` to ensure that it is applied to all
5109    /// navigations including the first [`NavigationController.LoadURL`] request.
5110    pub fn r#set_navigation_policy_provider(
5111        &self,
5112        mut params: &NavigationPolicyProviderParams,
5113        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
5114    ) -> Result<(), fidl::Error> {
5115        FrameProxyInterface::r#set_navigation_policy_provider(self, params, provider)
5116    }
5117
5118    /// Sets various settings for how web content should be run in the Frame. May be called at any
5119    /// time, including after the URL has loaded. Each call changes only the specified fields,
5120    /// overwriting any prior value.
5121    ///
5122    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
5123    /// is not supported by the Frame.
5124    pub fn r#set_content_area_settings(
5125        &self,
5126        mut settings: &ContentAreaSettings,
5127    ) -> Result<(), fidl::Error> {
5128        FrameProxyInterface::r#set_content_area_settings(self, settings)
5129    }
5130
5131    /// Reset the Frame's [`ContentAreaSettings`] to default values.
5132    pub fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
5133        FrameProxyInterface::r#reset_content_area_settings(self)
5134    }
5135
5136    /// Request graceful or immediate teardown of the Frame content and notification of completion
5137    /// via Frame epitaph.
5138    ///
5139    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
5140    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
5141    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
5142    /// content to run event handlers.
5143    ///
5144    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
5145    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
5146    ///
5147    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
5148    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
5149    ///   otherwise.
5150    ///
5151    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
5152    ///
5153    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
5154    pub fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
5155        FrameProxyInterface::r#close(self, payload)
5156    }
5157}
5158
5159impl FrameProxyInterface for FrameProxy {
5160    fn r#create_view(
5161        &self,
5162        mut view_token: fidl_fuchsia_ui_views::ViewToken,
5163    ) -> Result<(), fidl::Error> {
5164        self.client.send::<FrameCreateViewRequest>(
5165            (&mut view_token,),
5166            0x6a27859439133264,
5167            fidl::encoding::DynamicFlags::empty(),
5168        )
5169    }
5170
5171    fn r#create_view_with_view_ref(
5172        &self,
5173        mut view_token: fidl_fuchsia_ui_views::ViewToken,
5174        mut view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
5175        mut view_ref: fidl_fuchsia_ui_views::ViewRef,
5176    ) -> Result<(), fidl::Error> {
5177        self.client.send::<FrameCreateViewWithViewRefRequest>(
5178            (&mut view_token, &mut view_ref_control, &mut view_ref),
5179            0x1eb17ab2442326ac,
5180            fidl::encoding::DynamicFlags::empty(),
5181        )
5182    }
5183
5184    fn r#create_view2(&self, mut args: CreateView2Args) -> Result<(), fidl::Error> {
5185        self.client.send::<FrameCreateView2Request>(
5186            (&mut args,),
5187            0x1be7e9512962eb37,
5188            fidl::encoding::DynamicFlags::empty(),
5189        )
5190    }
5191
5192    fn r#enable_headless_rendering(&self) -> Result<(), fidl::Error> {
5193        self.client.send::<fidl::encoding::EmptyPayload>(
5194            (),
5195            0x72a81aaae7a80d2b,
5196            fidl::encoding::DynamicFlags::empty(),
5197        )
5198    }
5199
5200    fn r#disable_headless_rendering(&self) -> Result<(), fidl::Error> {
5201        self.client.send::<fidl::encoding::EmptyPayload>(
5202            (),
5203            0x5ca38a3d1f7f543a,
5204            fidl::encoding::DynamicFlags::empty(),
5205        )
5206    }
5207
5208    fn r#get_media_player(
5209        &self,
5210        mut player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
5211    ) -> Result<(), fidl::Error> {
5212        self.client.send::<FrameGetMediaPlayerRequest>(
5213            (player,),
5214            0xaafb639fc0b9eb9,
5215            fidl::encoding::DynamicFlags::empty(),
5216        )
5217    }
5218
5219    fn r#get_navigation_controller(
5220        &self,
5221        mut controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
5222    ) -> Result<(), fidl::Error> {
5223        self.client.send::<FrameGetNavigationControllerRequest>(
5224            (controller,),
5225            0x4521cfe95217a688,
5226            fidl::encoding::DynamicFlags::empty(),
5227        )
5228    }
5229
5230    type ExecuteJavaScriptResponseFut = fidl::client::QueryResponseFut<
5231        FrameExecuteJavaScriptResult,
5232        fidl::encoding::DefaultFuchsiaResourceDialect,
5233    >;
5234    fn r#execute_java_script(
5235        &self,
5236        mut origins: &[String],
5237        mut script: fidl_fuchsia_mem::Buffer,
5238    ) -> Self::ExecuteJavaScriptResponseFut {
5239        fn _decode(
5240            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5241        ) -> Result<FrameExecuteJavaScriptResult, fidl::Error> {
5242            let _response = fidl::client::decode_transaction_body::<
5243                fidl::encoding::ResultType<FrameExecuteJavaScriptResponse, FrameError>,
5244                fidl::encoding::DefaultFuchsiaResourceDialect,
5245                0x79abdd4907000542,
5246            >(_buf?)?;
5247            Ok(_response.map(|x| x.result))
5248        }
5249        self.client
5250            .send_query_and_decode::<FrameExecuteJavaScriptRequest, FrameExecuteJavaScriptResult>(
5251                (origins, &mut script),
5252                0x79abdd4907000542,
5253                fidl::encoding::DynamicFlags::empty(),
5254                _decode,
5255            )
5256    }
5257
5258    type ExecuteJavaScriptNoResultResponseFut = fidl::client::QueryResponseFut<
5259        FrameExecuteJavaScriptNoResultResult,
5260        fidl::encoding::DefaultFuchsiaResourceDialect,
5261    >;
5262    fn r#execute_java_script_no_result(
5263        &self,
5264        mut origins: &[String],
5265        mut script: fidl_fuchsia_mem::Buffer,
5266    ) -> Self::ExecuteJavaScriptNoResultResponseFut {
5267        fn _decode(
5268            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5269        ) -> Result<FrameExecuteJavaScriptNoResultResult, fidl::Error> {
5270            let _response = fidl::client::decode_transaction_body::<
5271                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5272                fidl::encoding::DefaultFuchsiaResourceDialect,
5273                0x16b8491520cbcd63,
5274            >(_buf?)?;
5275            Ok(_response.map(|x| x))
5276        }
5277        self.client.send_query_and_decode::<
5278            FrameExecuteJavaScriptNoResultRequest,
5279            FrameExecuteJavaScriptNoResultResult,
5280        >(
5281            (origins, &mut script,),
5282            0x16b8491520cbcd63,
5283            fidl::encoding::DynamicFlags::empty(),
5284            _decode,
5285        )
5286    }
5287
5288    type AddBeforeLoadJavaScriptResponseFut = fidl::client::QueryResponseFut<
5289        FrameAddBeforeLoadJavaScriptResult,
5290        fidl::encoding::DefaultFuchsiaResourceDialect,
5291    >;
5292    fn r#add_before_load_java_script(
5293        &self,
5294        mut id: u64,
5295        mut origins: &[String],
5296        mut script: fidl_fuchsia_mem::Buffer,
5297    ) -> Self::AddBeforeLoadJavaScriptResponseFut {
5298        fn _decode(
5299            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5300        ) -> Result<FrameAddBeforeLoadJavaScriptResult, fidl::Error> {
5301            let _response = fidl::client::decode_transaction_body::<
5302                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5303                fidl::encoding::DefaultFuchsiaResourceDialect,
5304                0x540ac0da59d823e,
5305            >(_buf?)?;
5306            Ok(_response.map(|x| x))
5307        }
5308        self.client.send_query_and_decode::<
5309            FrameAddBeforeLoadJavaScriptRequest,
5310            FrameAddBeforeLoadJavaScriptResult,
5311        >(
5312            (id, origins, &mut script,),
5313            0x540ac0da59d823e,
5314            fidl::encoding::DynamicFlags::empty(),
5315            _decode,
5316        )
5317    }
5318
5319    fn r#remove_before_load_java_script(&self, mut id: u64) -> Result<(), fidl::Error> {
5320        self.client.send::<FrameRemoveBeforeLoadJavaScriptRequest>(
5321            (id,),
5322            0x17d92b855b61d23a,
5323            fidl::encoding::DynamicFlags::empty(),
5324        )
5325    }
5326
5327    type PostMessageResponseFut = fidl::client::QueryResponseFut<
5328        FramePostMessageResult,
5329        fidl::encoding::DefaultFuchsiaResourceDialect,
5330    >;
5331    fn r#post_message(
5332        &self,
5333        mut target_origin: &str,
5334        mut message: WebMessage,
5335    ) -> Self::PostMessageResponseFut {
5336        fn _decode(
5337            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5338        ) -> Result<FramePostMessageResult, fidl::Error> {
5339            let _response = fidl::client::decode_transaction_body::<
5340                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
5341                fidl::encoding::DefaultFuchsiaResourceDialect,
5342                0x751d686eb7caa341,
5343            >(_buf?)?;
5344            Ok(_response.map(|x| x))
5345        }
5346        self.client.send_query_and_decode::<FramePostMessageRequest, FramePostMessageResult>(
5347            (target_origin, &mut message),
5348            0x751d686eb7caa341,
5349            fidl::encoding::DynamicFlags::empty(),
5350            _decode,
5351        )
5352    }
5353
5354    fn r#set_navigation_event_listener(
5355        &self,
5356        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
5357    ) -> Result<(), fidl::Error> {
5358        self.client.send::<FrameSetNavigationEventListenerRequest>(
5359            (listener,),
5360            0x965ba0fa20e0a56,
5361            fidl::encoding::DynamicFlags::empty(),
5362        )
5363    }
5364
5365    fn r#set_navigation_event_listener2(
5366        &self,
5367        mut listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
5368        mut flags: NavigationEventListenerFlags,
5369    ) -> Result<(), fidl::Error> {
5370        self.client.send::<FrameSetNavigationEventListener2Request>(
5371            (listener, flags),
5372            0x5f8b40607f1f578f,
5373            fidl::encoding::DynamicFlags::empty(),
5374        )
5375    }
5376
5377    fn r#set_java_script_log_level(&self, mut level: ConsoleLogLevel) -> Result<(), fidl::Error> {
5378        self.client.send::<FrameSetJavaScriptLogLevelRequest>(
5379            (level,),
5380            0x74824b11a71c4b5b,
5381            fidl::encoding::DynamicFlags::empty(),
5382        )
5383    }
5384
5385    fn r#set_console_log_sink(
5386        &self,
5387        mut sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
5388    ) -> Result<(), fidl::Error> {
5389        self.client.send::<FrameSetConsoleLogSinkRequest>(
5390            (sink,),
5391            0x18f5cbc19fa4687b,
5392            fidl::encoding::DynamicFlags::empty(),
5393        )
5394    }
5395
5396    fn r#configure_input_types(
5397        &self,
5398        mut types: InputTypes,
5399        mut allow: AllowInputState,
5400    ) -> Result<(), fidl::Error> {
5401        self.client.send::<FrameConfigureInputTypesRequest>(
5402            (types, allow),
5403            0x38e08fe763c6bef6,
5404            fidl::encoding::DynamicFlags::empty(),
5405        )
5406    }
5407
5408    fn r#set_popup_frame_creation_listener(
5409        &self,
5410        mut listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
5411    ) -> Result<(), fidl::Error> {
5412        self.client.send::<FrameSetPopupFrameCreationListenerRequest>(
5413            (listener,),
5414            0x34ddec4e9f11e2aa,
5415            fidl::encoding::DynamicFlags::empty(),
5416        )
5417    }
5418
5419    type SetUrlRequestRewriteRulesResponseFut =
5420        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5421    fn r#set_url_request_rewrite_rules(
5422        &self,
5423        mut rules: &[UrlRequestRewriteRule],
5424    ) -> Self::SetUrlRequestRewriteRulesResponseFut {
5425        fn _decode(
5426            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5427        ) -> Result<(), fidl::Error> {
5428            let _response = fidl::client::decode_transaction_body::<
5429                fidl::encoding::EmptyPayload,
5430                fidl::encoding::DefaultFuchsiaResourceDialect,
5431                0x2e3f797350ab3281,
5432            >(_buf?)?;
5433            Ok(_response)
5434        }
5435        self.client.send_query_and_decode::<FrameSetUrlRequestRewriteRulesRequest, ()>(
5436            (rules,),
5437            0x2e3f797350ab3281,
5438            fidl::encoding::DynamicFlags::empty(),
5439            _decode,
5440        )
5441    }
5442
5443    fn r#set_media_settings(&self, mut settings: &FrameMediaSettings) -> Result<(), fidl::Error> {
5444        self.client.send::<FrameSetMediaSettingsRequest>(
5445            (settings,),
5446            0x7da879b6d284c143,
5447            fidl::encoding::DynamicFlags::empty(),
5448        )
5449    }
5450
5451    fn r#force_content_dimensions(
5452        &self,
5453        mut web_dips: Option<&fidl_fuchsia_ui_gfx::Vec2>,
5454    ) -> Result<(), fidl::Error> {
5455        self.client.send::<FrameForceContentDimensionsRequest>(
5456            (web_dips,),
5457            0x8c7024c7149c901,
5458            fidl::encoding::DynamicFlags::empty(),
5459        )
5460    }
5461
5462    fn r#set_permission_state(
5463        &self,
5464        mut permission: &PermissionDescriptor,
5465        mut web_origin: &str,
5466        mut state: PermissionState,
5467    ) -> Result<(), fidl::Error> {
5468        self.client.send::<FrameSetPermissionStateRequest>(
5469            (permission, web_origin, state),
5470            0x19574e92a7033f4f,
5471            fidl::encoding::DynamicFlags::empty(),
5472        )
5473    }
5474
5475    fn r#set_block_media_loading(&self, mut blocked: bool) -> Result<(), fidl::Error> {
5476        self.client.send::<FrameSetBlockMediaLoadingRequest>(
5477            (blocked,),
5478            0x211071458fc9cf4f,
5479            fidl::encoding::DynamicFlags::empty(),
5480        )
5481    }
5482
5483    type GetPrivateMemorySizeResponseFut =
5484        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
5485    fn r#get_private_memory_size(&self) -> Self::GetPrivateMemorySizeResponseFut {
5486        fn _decode(
5487            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5488        ) -> Result<u64, fidl::Error> {
5489            let _response = fidl::client::decode_transaction_body::<
5490                FrameGetPrivateMemorySizeResponse,
5491                fidl::encoding::DefaultFuchsiaResourceDialect,
5492                0x6ad4d43da6c129b0,
5493            >(_buf?)?;
5494            Ok(_response.size_bytes)
5495        }
5496        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
5497            (),
5498            0x6ad4d43da6c129b0,
5499            fidl::encoding::DynamicFlags::empty(),
5500            _decode,
5501        )
5502    }
5503
5504    fn r#set_navigation_policy_provider(
5505        &self,
5506        mut params: &NavigationPolicyProviderParams,
5507        mut provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
5508    ) -> Result<(), fidl::Error> {
5509        self.client.send::<FrameSetNavigationPolicyProviderRequest>(
5510            (params, provider),
5511            0x602ce35195d66654,
5512            fidl::encoding::DynamicFlags::empty(),
5513        )
5514    }
5515
5516    fn r#set_content_area_settings(
5517        &self,
5518        mut settings: &ContentAreaSettings,
5519    ) -> Result<(), fidl::Error> {
5520        self.client.send::<FrameSetContentAreaSettingsRequest>(
5521            (settings,),
5522            0x851f4de50c3c27e,
5523            fidl::encoding::DynamicFlags::empty(),
5524        )
5525    }
5526
5527    fn r#reset_content_area_settings(&self) -> Result<(), fidl::Error> {
5528        self.client.send::<fidl::encoding::EmptyPayload>(
5529            (),
5530            0x6807e04f16f8ee5d,
5531            fidl::encoding::DynamicFlags::empty(),
5532        )
5533    }
5534
5535    fn r#close(&self, mut payload: &FrameCloseRequest) -> Result<(), fidl::Error> {
5536        self.client.send::<FrameCloseRequest>(
5537            payload,
5538            0x442e84138e65351,
5539            fidl::encoding::DynamicFlags::empty(),
5540        )
5541    }
5542}
5543
5544pub struct FrameEventStream {
5545    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5546}
5547
5548impl std::marker::Unpin for FrameEventStream {}
5549
5550impl futures::stream::FusedStream for FrameEventStream {
5551    fn is_terminated(&self) -> bool {
5552        self.event_receiver.is_terminated()
5553    }
5554}
5555
5556impl futures::Stream for FrameEventStream {
5557    type Item = Result<FrameEvent, fidl::Error>;
5558
5559    fn poll_next(
5560        mut self: std::pin::Pin<&mut Self>,
5561        cx: &mut std::task::Context<'_>,
5562    ) -> std::task::Poll<Option<Self::Item>> {
5563        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5564            &mut self.event_receiver,
5565            cx
5566        )?) {
5567            Some(buf) => std::task::Poll::Ready(Some(FrameEvent::decode(buf))),
5568            None => std::task::Poll::Ready(None),
5569        }
5570    }
5571}
5572
5573#[derive(Debug)]
5574pub enum FrameEvent {}
5575
5576impl FrameEvent {
5577    /// Decodes a message buffer as a [`FrameEvent`].
5578    fn decode(
5579        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5580    ) -> Result<FrameEvent, fidl::Error> {
5581        let (bytes, _handles) = buf.split_mut();
5582        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5583        debug_assert_eq!(tx_header.tx_id, 0);
5584        match tx_header.ordinal {
5585            _ => Err(fidl::Error::UnknownOrdinal {
5586                ordinal: tx_header.ordinal,
5587                protocol_name: <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5588            }),
5589        }
5590    }
5591}
5592
5593/// A Stream of incoming requests for fuchsia.web/Frame.
5594pub struct FrameRequestStream {
5595    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5596    is_terminated: bool,
5597}
5598
5599impl std::marker::Unpin for FrameRequestStream {}
5600
5601impl futures::stream::FusedStream for FrameRequestStream {
5602    fn is_terminated(&self) -> bool {
5603        self.is_terminated
5604    }
5605}
5606
5607impl fidl::endpoints::RequestStream for FrameRequestStream {
5608    type Protocol = FrameMarker;
5609    type ControlHandle = FrameControlHandle;
5610
5611    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5612        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5613    }
5614
5615    fn control_handle(&self) -> Self::ControlHandle {
5616        FrameControlHandle { inner: self.inner.clone() }
5617    }
5618
5619    fn into_inner(
5620        self,
5621    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5622    {
5623        (self.inner, self.is_terminated)
5624    }
5625
5626    fn from_inner(
5627        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5628        is_terminated: bool,
5629    ) -> Self {
5630        Self { inner, is_terminated }
5631    }
5632}
5633
5634impl futures::Stream for FrameRequestStream {
5635    type Item = Result<FrameRequest, fidl::Error>;
5636
5637    fn poll_next(
5638        mut self: std::pin::Pin<&mut Self>,
5639        cx: &mut std::task::Context<'_>,
5640    ) -> std::task::Poll<Option<Self::Item>> {
5641        let this = &mut *self;
5642        if this.inner.check_shutdown(cx) {
5643            this.is_terminated = true;
5644            return std::task::Poll::Ready(None);
5645        }
5646        if this.is_terminated {
5647            panic!("polled FrameRequestStream after completion");
5648        }
5649        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5650            |bytes, handles| {
5651                match this.inner.channel().read_etc(cx, bytes, handles) {
5652                    std::task::Poll::Ready(Ok(())) => {}
5653                    std::task::Poll::Pending => return std::task::Poll::Pending,
5654                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5655                        this.is_terminated = true;
5656                        return std::task::Poll::Ready(None);
5657                    }
5658                    std::task::Poll::Ready(Err(e)) => {
5659                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5660                            e.into(),
5661                        ))));
5662                    }
5663                }
5664
5665                // A message has been received from the channel
5666                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5667
5668                std::task::Poll::Ready(Some(match header.ordinal {
5669                    0x6a27859439133264 => {
5670                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5671                        let mut req = fidl::new_empty!(
5672                            FrameCreateViewRequest,
5673                            fidl::encoding::DefaultFuchsiaResourceDialect
5674                        );
5675                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateViewRequest>(&header, _body_bytes, handles, &mut req)?;
5676                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5677                        Ok(FrameRequest::CreateView { view_token: req.view_token, control_handle })
5678                    }
5679                    0x1eb17ab2442326ac => {
5680                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5681                        let mut req = fidl::new_empty!(
5682                            FrameCreateViewWithViewRefRequest,
5683                            fidl::encoding::DefaultFuchsiaResourceDialect
5684                        );
5685                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateViewWithViewRefRequest>(&header, _body_bytes, handles, &mut req)?;
5686                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5687                        Ok(FrameRequest::CreateViewWithViewRef {
5688                            view_token: req.view_token,
5689                            view_ref_control: req.view_ref_control,
5690                            view_ref: req.view_ref,
5691
5692                            control_handle,
5693                        })
5694                    }
5695                    0x1be7e9512962eb37 => {
5696                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5697                        let mut req = fidl::new_empty!(
5698                            FrameCreateView2Request,
5699                            fidl::encoding::DefaultFuchsiaResourceDialect
5700                        );
5701                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCreateView2Request>(&header, _body_bytes, handles, &mut req)?;
5702                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5703                        Ok(FrameRequest::CreateView2 { args: req.args, control_handle })
5704                    }
5705                    0x72a81aaae7a80d2b => {
5706                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5707                        let mut req = fidl::new_empty!(
5708                            fidl::encoding::EmptyPayload,
5709                            fidl::encoding::DefaultFuchsiaResourceDialect
5710                        );
5711                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5712                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5713                        Ok(FrameRequest::EnableHeadlessRendering { control_handle })
5714                    }
5715                    0x5ca38a3d1f7f543a => {
5716                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5717                        let mut req = fidl::new_empty!(
5718                            fidl::encoding::EmptyPayload,
5719                            fidl::encoding::DefaultFuchsiaResourceDialect
5720                        );
5721                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5722                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5723                        Ok(FrameRequest::DisableHeadlessRendering { control_handle })
5724                    }
5725                    0xaafb639fc0b9eb9 => {
5726                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5727                        let mut req = fidl::new_empty!(
5728                            FrameGetMediaPlayerRequest,
5729                            fidl::encoding::DefaultFuchsiaResourceDialect
5730                        );
5731                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameGetMediaPlayerRequest>(&header, _body_bytes, handles, &mut req)?;
5732                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5733                        Ok(FrameRequest::GetMediaPlayer { player: req.player, control_handle })
5734                    }
5735                    0x4521cfe95217a688 => {
5736                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5737                        let mut req = fidl::new_empty!(
5738                            FrameGetNavigationControllerRequest,
5739                            fidl::encoding::DefaultFuchsiaResourceDialect
5740                        );
5741                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameGetNavigationControllerRequest>(&header, _body_bytes, handles, &mut req)?;
5742                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5743                        Ok(FrameRequest::GetNavigationController {
5744                            controller: req.controller,
5745
5746                            control_handle,
5747                        })
5748                    }
5749                    0x79abdd4907000542 => {
5750                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5751                        let mut req = fidl::new_empty!(
5752                            FrameExecuteJavaScriptRequest,
5753                            fidl::encoding::DefaultFuchsiaResourceDialect
5754                        );
5755                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameExecuteJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5756                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5757                        Ok(FrameRequest::ExecuteJavaScript {
5758                            origins: req.origins,
5759                            script: req.script,
5760
5761                            responder: FrameExecuteJavaScriptResponder {
5762                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5763                                tx_id: header.tx_id,
5764                            },
5765                        })
5766                    }
5767                    0x16b8491520cbcd63 => {
5768                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5769                        let mut req = fidl::new_empty!(
5770                            FrameExecuteJavaScriptNoResultRequest,
5771                            fidl::encoding::DefaultFuchsiaResourceDialect
5772                        );
5773                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameExecuteJavaScriptNoResultRequest>(&header, _body_bytes, handles, &mut req)?;
5774                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5775                        Ok(FrameRequest::ExecuteJavaScriptNoResult {
5776                            origins: req.origins,
5777                            script: req.script,
5778
5779                            responder: FrameExecuteJavaScriptNoResultResponder {
5780                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5781                                tx_id: header.tx_id,
5782                            },
5783                        })
5784                    }
5785                    0x540ac0da59d823e => {
5786                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5787                        let mut req = fidl::new_empty!(
5788                            FrameAddBeforeLoadJavaScriptRequest,
5789                            fidl::encoding::DefaultFuchsiaResourceDialect
5790                        );
5791                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameAddBeforeLoadJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5792                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5793                        Ok(FrameRequest::AddBeforeLoadJavaScript {
5794                            id: req.id,
5795                            origins: req.origins,
5796                            script: req.script,
5797
5798                            responder: FrameAddBeforeLoadJavaScriptResponder {
5799                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5800                                tx_id: header.tx_id,
5801                            },
5802                        })
5803                    }
5804                    0x17d92b855b61d23a => {
5805                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5806                        let mut req = fidl::new_empty!(
5807                            FrameRemoveBeforeLoadJavaScriptRequest,
5808                            fidl::encoding::DefaultFuchsiaResourceDialect
5809                        );
5810                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameRemoveBeforeLoadJavaScriptRequest>(&header, _body_bytes, handles, &mut req)?;
5811                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5812                        Ok(FrameRequest::RemoveBeforeLoadJavaScript { id: req.id, control_handle })
5813                    }
5814                    0x751d686eb7caa341 => {
5815                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5816                        let mut req = fidl::new_empty!(
5817                            FramePostMessageRequest,
5818                            fidl::encoding::DefaultFuchsiaResourceDialect
5819                        );
5820                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FramePostMessageRequest>(&header, _body_bytes, handles, &mut req)?;
5821                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5822                        Ok(FrameRequest::PostMessage {
5823                            target_origin: req.target_origin,
5824                            message: req.message,
5825
5826                            responder: FramePostMessageResponder {
5827                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5828                                tx_id: header.tx_id,
5829                            },
5830                        })
5831                    }
5832                    0x965ba0fa20e0a56 => {
5833                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5834                        let mut req = fidl::new_empty!(
5835                            FrameSetNavigationEventListenerRequest,
5836                            fidl::encoding::DefaultFuchsiaResourceDialect
5837                        );
5838                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationEventListenerRequest>(&header, _body_bytes, handles, &mut req)?;
5839                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5840                        Ok(FrameRequest::SetNavigationEventListener {
5841                            listener: req.listener,
5842
5843                            control_handle,
5844                        })
5845                    }
5846                    0x5f8b40607f1f578f => {
5847                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5848                        let mut req = fidl::new_empty!(
5849                            FrameSetNavigationEventListener2Request,
5850                            fidl::encoding::DefaultFuchsiaResourceDialect
5851                        );
5852                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationEventListener2Request>(&header, _body_bytes, handles, &mut req)?;
5853                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5854                        Ok(FrameRequest::SetNavigationEventListener2 {
5855                            listener: req.listener,
5856                            flags: req.flags,
5857
5858                            control_handle,
5859                        })
5860                    }
5861                    0x74824b11a71c4b5b => {
5862                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5863                        let mut req = fidl::new_empty!(
5864                            FrameSetJavaScriptLogLevelRequest,
5865                            fidl::encoding::DefaultFuchsiaResourceDialect
5866                        );
5867                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetJavaScriptLogLevelRequest>(&header, _body_bytes, handles, &mut req)?;
5868                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5869                        Ok(FrameRequest::SetJavaScriptLogLevel { level: req.level, control_handle })
5870                    }
5871                    0x18f5cbc19fa4687b => {
5872                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5873                        let mut req = fidl::new_empty!(
5874                            FrameSetConsoleLogSinkRequest,
5875                            fidl::encoding::DefaultFuchsiaResourceDialect
5876                        );
5877                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetConsoleLogSinkRequest>(&header, _body_bytes, handles, &mut req)?;
5878                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5879                        Ok(FrameRequest::SetConsoleLogSink { sink: req.sink, control_handle })
5880                    }
5881                    0x38e08fe763c6bef6 => {
5882                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5883                        let mut req = fidl::new_empty!(
5884                            FrameConfigureInputTypesRequest,
5885                            fidl::encoding::DefaultFuchsiaResourceDialect
5886                        );
5887                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameConfigureInputTypesRequest>(&header, _body_bytes, handles, &mut req)?;
5888                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5889                        Ok(FrameRequest::ConfigureInputTypes {
5890                            types: req.types,
5891                            allow: req.allow,
5892
5893                            control_handle,
5894                        })
5895                    }
5896                    0x34ddec4e9f11e2aa => {
5897                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5898                        let mut req = fidl::new_empty!(
5899                            FrameSetPopupFrameCreationListenerRequest,
5900                            fidl::encoding::DefaultFuchsiaResourceDialect
5901                        );
5902                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetPopupFrameCreationListenerRequest>(&header, _body_bytes, handles, &mut req)?;
5903                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5904                        Ok(FrameRequest::SetPopupFrameCreationListener {
5905                            listener: req.listener,
5906
5907                            control_handle,
5908                        })
5909                    }
5910                    0x2e3f797350ab3281 => {
5911                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5912                        let mut req = fidl::new_empty!(
5913                            FrameSetUrlRequestRewriteRulesRequest,
5914                            fidl::encoding::DefaultFuchsiaResourceDialect
5915                        );
5916                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetUrlRequestRewriteRulesRequest>(&header, _body_bytes, handles, &mut req)?;
5917                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5918                        Ok(FrameRequest::SetUrlRequestRewriteRules {
5919                            rules: req.rules,
5920
5921                            responder: FrameSetUrlRequestRewriteRulesResponder {
5922                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5923                                tx_id: header.tx_id,
5924                            },
5925                        })
5926                    }
5927                    0x7da879b6d284c143 => {
5928                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5929                        let mut req = fidl::new_empty!(
5930                            FrameSetMediaSettingsRequest,
5931                            fidl::encoding::DefaultFuchsiaResourceDialect
5932                        );
5933                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetMediaSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
5934                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5935                        Ok(FrameRequest::SetMediaSettings {
5936                            settings: req.settings,
5937
5938                            control_handle,
5939                        })
5940                    }
5941                    0x8c7024c7149c901 => {
5942                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5943                        let mut req = fidl::new_empty!(
5944                            FrameForceContentDimensionsRequest,
5945                            fidl::encoding::DefaultFuchsiaResourceDialect
5946                        );
5947                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameForceContentDimensionsRequest>(&header, _body_bytes, handles, &mut req)?;
5948                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5949                        Ok(FrameRequest::ForceContentDimensions {
5950                            web_dips: req.web_dips,
5951
5952                            control_handle,
5953                        })
5954                    }
5955                    0x19574e92a7033f4f => {
5956                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5957                        let mut req = fidl::new_empty!(
5958                            FrameSetPermissionStateRequest,
5959                            fidl::encoding::DefaultFuchsiaResourceDialect
5960                        );
5961                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetPermissionStateRequest>(&header, _body_bytes, handles, &mut req)?;
5962                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5963                        Ok(FrameRequest::SetPermissionState {
5964                            permission: req.permission,
5965                            web_origin: req.web_origin,
5966                            state: req.state,
5967
5968                            control_handle,
5969                        })
5970                    }
5971                    0x211071458fc9cf4f => {
5972                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5973                        let mut req = fidl::new_empty!(
5974                            FrameSetBlockMediaLoadingRequest,
5975                            fidl::encoding::DefaultFuchsiaResourceDialect
5976                        );
5977                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetBlockMediaLoadingRequest>(&header, _body_bytes, handles, &mut req)?;
5978                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5979                        Ok(FrameRequest::SetBlockMediaLoading {
5980                            blocked: req.blocked,
5981
5982                            control_handle,
5983                        })
5984                    }
5985                    0x6ad4d43da6c129b0 => {
5986                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5987                        let mut req = fidl::new_empty!(
5988                            fidl::encoding::EmptyPayload,
5989                            fidl::encoding::DefaultFuchsiaResourceDialect
5990                        );
5991                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5992                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
5993                        Ok(FrameRequest::GetPrivateMemorySize {
5994                            responder: FrameGetPrivateMemorySizeResponder {
5995                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5996                                tx_id: header.tx_id,
5997                            },
5998                        })
5999                    }
6000                    0x602ce35195d66654 => {
6001                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6002                        let mut req = fidl::new_empty!(
6003                            FrameSetNavigationPolicyProviderRequest,
6004                            fidl::encoding::DefaultFuchsiaResourceDialect
6005                        );
6006                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetNavigationPolicyProviderRequest>(&header, _body_bytes, handles, &mut req)?;
6007                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6008                        Ok(FrameRequest::SetNavigationPolicyProvider {
6009                            params: req.params,
6010                            provider: req.provider,
6011
6012                            control_handle,
6013                        })
6014                    }
6015                    0x851f4de50c3c27e => {
6016                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6017                        let mut req = fidl::new_empty!(
6018                            FrameSetContentAreaSettingsRequest,
6019                            fidl::encoding::DefaultFuchsiaResourceDialect
6020                        );
6021                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameSetContentAreaSettingsRequest>(&header, _body_bytes, handles, &mut req)?;
6022                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6023                        Ok(FrameRequest::SetContentAreaSettings {
6024                            settings: req.settings,
6025
6026                            control_handle,
6027                        })
6028                    }
6029                    0x6807e04f16f8ee5d => {
6030                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6031                        let mut req = fidl::new_empty!(
6032                            fidl::encoding::EmptyPayload,
6033                            fidl::encoding::DefaultFuchsiaResourceDialect
6034                        );
6035                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6036                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6037                        Ok(FrameRequest::ResetContentAreaSettings { control_handle })
6038                    }
6039                    0x442e84138e65351 => {
6040                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6041                        let mut req = fidl::new_empty!(
6042                            FrameCloseRequest,
6043                            fidl::encoding::DefaultFuchsiaResourceDialect
6044                        );
6045                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameCloseRequest>(&header, _body_bytes, handles, &mut req)?;
6046                        let control_handle = FrameControlHandle { inner: this.inner.clone() };
6047                        Ok(FrameRequest::Close { payload: req, control_handle })
6048                    }
6049                    _ => Err(fidl::Error::UnknownOrdinal {
6050                        ordinal: header.ordinal,
6051                        protocol_name: <FrameMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6052                    }),
6053                }))
6054            },
6055        )
6056    }
6057}
6058
6059#[derive(Debug)]
6060pub enum FrameRequest {
6061    /// Creates a new view using the specified `view_token`. Caller should pass the other end of
6062    /// the token to [`fuchsia.ui.gfx/ViewHolderArgs`] to attach the new view to a view tree.
6063    ///
6064    /// See the description of [`CreateContextParams.service_directory`] for additional services
6065    /// that must be present when using this method.
6066    CreateView { view_token: fidl_fuchsia_ui_views::ViewToken, control_handle: FrameControlHandle },
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    /// `view_ref` can be cloned before passing it to this method, which will allow clients to
6070    /// track the view.
6071    ///
6072    /// `view_ref_control` must not have the `ZX_RIGHT_DUPLICATE` set, or view creation will fail
6073    /// and `view_token` will be closed.
6074    ///
6075    /// See the description of [`CreateContextParams.service_directory`] for additional services
6076    /// that must be present when using this method.
6077    CreateViewWithViewRef {
6078        view_token: fidl_fuchsia_ui_views::ViewToken,
6079        view_ref_control: fidl_fuchsia_ui_views::ViewRefControl,
6080        view_ref: fidl_fuchsia_ui_views::ViewRef,
6081        control_handle: FrameControlHandle,
6082    },
6083    /// Creates a new Flatland view using the specified `view_creation_token` defined under `args`.
6084    /// Caller should pass the other end of the token to
6085    /// [`fuchsia.ui.composition/Flatland.CreateViewport`] to attach the new Flatland view to its
6086    /// graph.
6087    CreateView2 { args: CreateView2Args, control_handle: FrameControlHandle },
6088    /// Enables headless rendering of the Frame.
6089    ///
6090    /// This is used when content depends on layout and/or animation events firing normally.
6091    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
6092    EnableHeadlessRendering { control_handle: FrameControlHandle },
6093    /// Stops headless rendering of the Frame.
6094    ///
6095    /// May only be used on a Context created with [`ContextFeatureFlags.HEADLESS`].
6096    DisableHeadlessRendering { control_handle: FrameControlHandle },
6097    /// Returns a [`fuchsia.media.sessions2/Player`] interface through which media (i.e.
6098    /// video/audio) playback in the frame may be observed, and/or controlled. Only one
6099    /// [`fuchsia.media.sessions2/Player`] may be active at a time, for each [`Frame`].
6100    GetMediaPlayer {
6101        player: fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
6102        control_handle: FrameControlHandle,
6103    },
6104    /// Returns an interface through which the [`Frame`] may be navigated to a desired URL,
6105    /// reloaded, etc.
6106    ///
6107    /// - `controller`: An asynchronous interface request for the [`Frame`]'s
6108    ///   [`NavigationController`].
6109    GetNavigationController {
6110        controller: fidl::endpoints::ServerEnd<NavigationControllerMarker>,
6111        control_handle: FrameControlHandle,
6112    },
6113    /// Executes a UTF-8 encoded `script` in the [`Frame`] if the [`Frame`]'s URL has an origin
6114    /// which matches entries in `origins`.
6115    ///
6116    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
6117    /// `origins`, then the script will be evaluated unconditionally.
6118    ///
6119    /// Returns the result of executing `script`, as a JSON-encoded string.
6120    ///
6121    /// Note that scripts share the same execution context as the document,
6122    /// meaning that document may modify variables, classes, or objects set by
6123    /// the script in arbitrary or unpredictable ways.
6124    ///
6125    /// If an error occurred, the FrameError will be set to one of these values:
6126    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
6127    /// - `INVALID_ORIGIN`: The [`Frame`]'s current URL does not match any of the values in
6128    ///   `origins` or `origins` is an empty vector.
6129    ExecuteJavaScript {
6130        origins: Vec<String>,
6131        script: fidl_fuchsia_mem::Buffer,
6132        responder: FrameExecuteJavaScriptResponder,
6133    },
6134    /// Variant of [`Frame.ExecuteJavaScript`] which executes the supplied script without returning
6135    /// a result.
6136    ExecuteJavaScriptNoResult {
6137        origins: Vec<String>,
6138        script: fidl_fuchsia_mem::Buffer,
6139        responder: FrameExecuteJavaScriptNoResultResponder,
6140    },
6141    /// Executes a UTF-8 encoded `script` for every subsequent page load where the [`Frame`]'s URL
6142    /// has an origin reflected in `origins`. The script is executed early, prior to the execution
6143    /// of the document's scripts.
6144    ///
6145    /// Scripts are identified by a client-managed identifier `id`. Any script previously injected
6146    /// using the same `id` will be replaced.
6147    ///
6148    /// The order in which multiple bindings are executed is the same as the order in which the
6149    /// bindings were added. If a script is added which clobbers an existing script of the same
6150    /// `id`, the previous script's precedence in the injection order will be preserved.
6151    ///
6152    /// At least one `origins` entry must be specified. If a wildcard `"*"` is specified in
6153    /// `origins`, then the script will be evaluated unconditionally.
6154    ///
6155    /// If an error occurred, the [`FrameError`] will be set to one of these values:
6156    /// - `BUFFER_NOT_UTF8`: `script` is not UTF-8 encoded.
6157    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
6158    AddBeforeLoadJavaScript {
6159        id: u64,
6160        origins: Vec<String>,
6161        script: fidl_fuchsia_mem::Buffer,
6162        responder: FrameAddBeforeLoadJavaScriptResponder,
6163    },
6164    /// Removes a previously added JavaScript snippet identified by `id`. This is a no-op if there
6165    /// is no JavaScript snippet identified by `id`.
6166    RemoveBeforeLoadJavaScript { id: u64, control_handle: FrameControlHandle },
6167    /// Posts a message to the frame's onMessage handler.
6168    ///
6169    /// `target_origin` restricts message delivery to the specified origin. If `target_origin` is
6170    /// `"*"`, then the message will be sent to the document regardless of its origin.
6171    /// See the
6172    /// [HTML spec](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages)
6173    /// section 9.4.3 for more details on how the target origin policy is applied.
6174    ///
6175    /// If an error occurred, the [`FrameError`] will be set to one of these values:
6176    /// - `INTERNAL_ERROR`: The WebEngine failed to create a message pipe.
6177    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
6178    /// - `INVALID_ORIGIN`: `origins` is an empty vector.
6179    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
6180    PostMessage { target_origin: String, message: WebMessage, responder: FramePostMessageResponder },
6181    /// Sets the listener for handling page navigation events.
6182    ///
6183    /// - `listener`: The observer to use. Unregisters any existing listener if null.
6184    SetNavigationEventListener {
6185        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6186        control_handle: FrameControlHandle,
6187    },
6188    /// Sets the listener for handling page navigation events. The listener will receive the
6189    /// current navigation state immediately. After that, it's notified whenever the state changes.
6190    ///
6191    /// - `listener`: The observer to use. Unregisters any existing listener if null.
6192    /// - `flags`: Flags for optional features that should be enabled for the listener.
6193    SetNavigationEventListener2 {
6194        listener: Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6195        flags: NavigationEventListenerFlags,
6196        control_handle: FrameControlHandle,
6197    },
6198    /// If set to a value other than [`ConsoleLogLevel.NONE`], allows web content to log messages
6199    /// to the [`fuchsia.logger/LogSink`] configured for this [`Frame`], via the
6200    /// `console` object (e.g. using `debug()`, `log()`, `info()`, `warn()` and
6201    /// `error()`).
6202    /// The default value is [`ConsoleLogLevel.NONE`].
6203    ///
6204    /// As the system log may be persisted, it is recommended that [`ConsoleLogLevel.NONE`] be used
6205    /// in Incognito and other private browsing modes.
6206    ///
6207    /// Log lines are written to the [`fuchsia.logger/LogsSink`] configured
6208    /// for this [`fuchsia.web/Frame`], with severities mapped as follows:
6209    /// - `debug()`, `log()` and `info()` are logged at [`fuchsia.logger/LogLevelFilter.INFO`]
6210    ///   severity.
6211    /// - `warn()` is logged at [`fuchsia.logger/LogLevelFilter.WARN`] severity.
6212    /// - `error()` is logged at [`fuchsia.logger/LogLevelFilter.ERROR`] severity.
6213    SetJavaScriptLogLevel { level: ConsoleLogLevel, control_handle: FrameControlHandle },
6214    /// Specifies where to emit `console` log output to. By default log output will be routed to a
6215    /// [`fuchsia.logger/LogSink`] obtained via the [`fuchsia.web/Context`]'s service directory.
6216    ///
6217    /// - `sink`: The [`fuchsia.logger/LogSink`] to use to emit logs. Passing a `null` handle
6218    ///   resets logging to use the default [`fuchsia.logger/LogSink`].
6219    SetConsoleLogSink {
6220        sink: Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
6221        control_handle: FrameControlHandle,
6222    },
6223    /// Enables or disables the processing of the specified `types` of user inputs.
6224    /// `allow` specifies whether to enable or disable the specified `types`.
6225    /// All input types are enabled by default.
6226    ConfigureInputTypes {
6227        types: InputTypes,
6228        allow: AllowInputState,
6229        control_handle: FrameControlHandle,
6230    },
6231    /// Sets the listener for handling popup frame opened by web content. If no listener is
6232    /// present, then any new popup frame will be blocked.
6233    ///
6234    /// - `listener`: The listener to use. Unregisters any existing listener if null.
6235    SetPopupFrameCreationListener {
6236        listener: Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
6237        control_handle: FrameControlHandle,
6238    },
6239    /// Supplies a set of [`UrlRequestRewriteRule`] to apply on every subsequent URL request.
6240    /// - `rules` are cumulative and applied in order.
6241    /// - `rules` are only applied on the first URL request in a redirect chain.
6242    /// - `rules` will be validated before being applied. If `rules` are invalid, the [`Frame`]
6243    ///   will be closed with `ERR_INVALID_ARGS`.
6244    /// - [`Frame.SetUrlRequestRewriteRules`] must not be called again until its acknowledgement
6245    ///   callback has been processed. If this happens, the [`Frame`] will be closed with
6246    ///   `ERR_BAD_STATE`.
6247    SetUrlRequestRewriteRules {
6248        rules: Vec<UrlRequestRewriteRule>,
6249        responder: FrameSetUrlRequestRewriteRulesResponder,
6250    },
6251    /// Sets [`fuchsia.media/FrameMediaSettings`] for the frame. The specified parameters are
6252    /// applied to audio streams that started after this message is processed. Should be called
6253    /// before the Frame is navigated to content in order to ensure that the settings applied to
6254    /// all media streams. Due to request pipelining, this means doing so before calling
6255    /// [`Frame.GetNavigationController()`] and [`NavigationController.LoadUrl()`].
6256    SetMediaSettings { settings: FrameMediaSettings, control_handle: FrameControlHandle },
6257    /// Overrides the dimensions reported to web content. The devicePixelRatio reported to
6258    /// web content will be adjusted in response to changes in the pixel size of the View,
6259    /// rather than changing the size reported to the content. Call with null `web_dips` to
6260    /// remove any prior forced content dimensions.
6261    ForceContentDimensions {
6262        web_dips: Option<Box<fidl_fuchsia_ui_gfx::Vec2>>,
6263        control_handle: FrameControlHandle,
6264    },
6265    /// Sets the permission state for the specified `permission` and `web_origin`. By default, all
6266    /// permissions are denied.
6267    SetPermissionState {
6268        permission: PermissionDescriptor,
6269        web_origin: String,
6270        state: PermissionState,
6271        control_handle: FrameControlHandle,
6272    },
6273    /// Sets whether to block all HTMLMediaElements in the frame from fetching and loading media
6274    /// resources.
6275    ///
6276    /// May be used, for example, to prevent loading media in frames that are not visible.
6277    ///
6278    /// While media loading is blocked, elements with `autoplay` set to `true` will not start
6279    /// playback. The promises returned by calls to `play()` will remain unresolved until loading is
6280    /// unblocked by a call to this method.
6281    ///
6282    /// When media loading is unblocked, elements will begin fetching, resource, loading, and
6283    /// playing as appropriate.
6284    ///
6285    /// Any elements that have begun fetching or loading media resources for the current source
6286    /// before media loading was blocked will continue to fetch, load, and start playback as
6287    /// appropriate. This includes calls to `play()` even after media loading is blocked.
6288    SetBlockMediaLoading { blocked: bool, control_handle: FrameControlHandle },
6289    /// Returns the amount of private (non-shared) physical memory used by the Frame's main
6290    /// document. The returned size might not reflect the memory usage of embedded iframes.
6291    GetPrivateMemorySize { responder: FrameGetPrivateMemorySizeResponder },
6292    /// Sets the navigation policy provider for the [`Frame`]. When set, the [`Frame`] sends
6293    /// [`NavigationPolicyProvider.EvaluateRequestedNavigation`] when processing navigation
6294    /// requests. `params` defines when the message is sent. After sending the
6295    /// `EvaluateRequestedNavigation` message, the [`Frame`] blocks the corresponding navigation
6296    /// until it receives a response.
6297    ///
6298    /// Should be called before `GetNavigationController` to ensure that it is applied to all
6299    /// navigations including the first [`NavigationController.LoadURL`] request.
6300    SetNavigationPolicyProvider {
6301        params: NavigationPolicyProviderParams,
6302        provider: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
6303        control_handle: FrameControlHandle,
6304    },
6305    /// Sets various settings for how web content should be run in the Frame. May be called at any
6306    /// time, including after the URL has loaded. Each call changes only the specified fields,
6307    /// overwriting any prior value.
6308    ///
6309    /// This method will fail with `ZX_ERR_NOT_SUPPORTED` if any value in [`ContentAreaSettings`]
6310    /// is not supported by the Frame.
6311    SetContentAreaSettings { settings: ContentAreaSettings, control_handle: FrameControlHandle },
6312    /// Reset the Frame's [`ContentAreaSettings`] to default values.
6313    ResetContentAreaSettings { control_handle: FrameControlHandle },
6314    /// Request graceful or immediate teardown of the Frame content and notification of completion
6315    /// via Frame epitaph.
6316    ///
6317    /// Graceful teardown allows unload and cleanup tasks in the implementation and web content
6318    /// (e.g., `unload` event handlers) to run for up to the specified period of time. Immediate
6319    /// teardown only runs the minimum cleanup tasks in the implementation and does not allow web
6320    /// content to run event handlers.
6321    ///
6322    /// * If `timeout` is zero, an immediate teardown is initiated. The channel will close with
6323    ///   `ZX_OK`. This is equivalent to the caller closing the Frame channel.
6324    ///
6325    /// * If `timeout` is non-zero, a graceful teardown is initiated. The channel will close with
6326    ///   `ZX_OK` if the Frame closes within the specified `timeout` and with `ZX_ERR_TIMED_OUT`
6327    ///   otherwise.
6328    ///
6329    /// * If `timeout` is not specified, a reasonable implementation-specific timeout is applied.
6330    ///
6331    /// Subsequent calls to `Close()` will override any previously specified `Close()` timeout.
6332    Close { payload: FrameCloseRequest, control_handle: FrameControlHandle },
6333}
6334
6335impl FrameRequest {
6336    #[allow(irrefutable_let_patterns)]
6337    pub fn into_create_view(
6338        self,
6339    ) -> Option<(fidl_fuchsia_ui_views::ViewToken, FrameControlHandle)> {
6340        if let FrameRequest::CreateView { view_token, control_handle } = self {
6341            Some((view_token, control_handle))
6342        } else {
6343            None
6344        }
6345    }
6346
6347    #[allow(irrefutable_let_patterns)]
6348    pub fn into_create_view_with_view_ref(
6349        self,
6350    ) -> Option<(
6351        fidl_fuchsia_ui_views::ViewToken,
6352        fidl_fuchsia_ui_views::ViewRefControl,
6353        fidl_fuchsia_ui_views::ViewRef,
6354        FrameControlHandle,
6355    )> {
6356        if let FrameRequest::CreateViewWithViewRef {
6357            view_token,
6358            view_ref_control,
6359            view_ref,
6360            control_handle,
6361        } = self
6362        {
6363            Some((view_token, view_ref_control, view_ref, control_handle))
6364        } else {
6365            None
6366        }
6367    }
6368
6369    #[allow(irrefutable_let_patterns)]
6370    pub fn into_create_view2(self) -> Option<(CreateView2Args, FrameControlHandle)> {
6371        if let FrameRequest::CreateView2 { args, control_handle } = self {
6372            Some((args, control_handle))
6373        } else {
6374            None
6375        }
6376    }
6377
6378    #[allow(irrefutable_let_patterns)]
6379    pub fn into_enable_headless_rendering(self) -> Option<(FrameControlHandle)> {
6380        if let FrameRequest::EnableHeadlessRendering { control_handle } = self {
6381            Some((control_handle))
6382        } else {
6383            None
6384        }
6385    }
6386
6387    #[allow(irrefutable_let_patterns)]
6388    pub fn into_disable_headless_rendering(self) -> Option<(FrameControlHandle)> {
6389        if let FrameRequest::DisableHeadlessRendering { control_handle } = self {
6390            Some((control_handle))
6391        } else {
6392            None
6393        }
6394    }
6395
6396    #[allow(irrefutable_let_patterns)]
6397    pub fn into_get_media_player(
6398        self,
6399    ) -> Option<(
6400        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
6401        FrameControlHandle,
6402    )> {
6403        if let FrameRequest::GetMediaPlayer { player, control_handle } = self {
6404            Some((player, control_handle))
6405        } else {
6406            None
6407        }
6408    }
6409
6410    #[allow(irrefutable_let_patterns)]
6411    pub fn into_get_navigation_controller(
6412        self,
6413    ) -> Option<(fidl::endpoints::ServerEnd<NavigationControllerMarker>, FrameControlHandle)> {
6414        if let FrameRequest::GetNavigationController { controller, control_handle } = self {
6415            Some((controller, control_handle))
6416        } else {
6417            None
6418        }
6419    }
6420
6421    #[allow(irrefutable_let_patterns)]
6422    pub fn into_execute_java_script(
6423        self,
6424    ) -> Option<(Vec<String>, fidl_fuchsia_mem::Buffer, FrameExecuteJavaScriptResponder)> {
6425        if let FrameRequest::ExecuteJavaScript { origins, script, responder } = self {
6426            Some((origins, script, responder))
6427        } else {
6428            None
6429        }
6430    }
6431
6432    #[allow(irrefutable_let_patterns)]
6433    pub fn into_execute_java_script_no_result(
6434        self,
6435    ) -> Option<(Vec<String>, fidl_fuchsia_mem::Buffer, FrameExecuteJavaScriptNoResultResponder)>
6436    {
6437        if let FrameRequest::ExecuteJavaScriptNoResult { origins, script, responder } = self {
6438            Some((origins, script, responder))
6439        } else {
6440            None
6441        }
6442    }
6443
6444    #[allow(irrefutable_let_patterns)]
6445    pub fn into_add_before_load_java_script(
6446        self,
6447    ) -> Option<(u64, Vec<String>, fidl_fuchsia_mem::Buffer, FrameAddBeforeLoadJavaScriptResponder)>
6448    {
6449        if let FrameRequest::AddBeforeLoadJavaScript { id, origins, script, responder } = self {
6450            Some((id, origins, script, responder))
6451        } else {
6452            None
6453        }
6454    }
6455
6456    #[allow(irrefutable_let_patterns)]
6457    pub fn into_remove_before_load_java_script(self) -> Option<(u64, FrameControlHandle)> {
6458        if let FrameRequest::RemoveBeforeLoadJavaScript { id, control_handle } = self {
6459            Some((id, control_handle))
6460        } else {
6461            None
6462        }
6463    }
6464
6465    #[allow(irrefutable_let_patterns)]
6466    pub fn into_post_message(self) -> Option<(String, WebMessage, FramePostMessageResponder)> {
6467        if let FrameRequest::PostMessage { target_origin, message, responder } = self {
6468            Some((target_origin, message, responder))
6469        } else {
6470            None
6471        }
6472    }
6473
6474    #[allow(irrefutable_let_patterns)]
6475    pub fn into_set_navigation_event_listener(
6476        self,
6477    ) -> Option<(
6478        Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6479        FrameControlHandle,
6480    )> {
6481        if let FrameRequest::SetNavigationEventListener { listener, control_handle } = self {
6482            Some((listener, control_handle))
6483        } else {
6484            None
6485        }
6486    }
6487
6488    #[allow(irrefutable_let_patterns)]
6489    pub fn into_set_navigation_event_listener2(
6490        self,
6491    ) -> Option<(
6492        Option<fidl::endpoints::ClientEnd<NavigationEventListenerMarker>>,
6493        NavigationEventListenerFlags,
6494        FrameControlHandle,
6495    )> {
6496        if let FrameRequest::SetNavigationEventListener2 { listener, flags, control_handle } = self
6497        {
6498            Some((listener, flags, control_handle))
6499        } else {
6500            None
6501        }
6502    }
6503
6504    #[allow(irrefutable_let_patterns)]
6505    pub fn into_set_java_script_log_level(self) -> Option<(ConsoleLogLevel, FrameControlHandle)> {
6506        if let FrameRequest::SetJavaScriptLogLevel { level, control_handle } = self {
6507            Some((level, control_handle))
6508        } else {
6509            None
6510        }
6511    }
6512
6513    #[allow(irrefutable_let_patterns)]
6514    pub fn into_set_console_log_sink(
6515        self,
6516    ) -> Option<(
6517        Option<fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>>,
6518        FrameControlHandle,
6519    )> {
6520        if let FrameRequest::SetConsoleLogSink { sink, control_handle } = self {
6521            Some((sink, control_handle))
6522        } else {
6523            None
6524        }
6525    }
6526
6527    #[allow(irrefutable_let_patterns)]
6528    pub fn into_configure_input_types(
6529        self,
6530    ) -> Option<(InputTypes, AllowInputState, FrameControlHandle)> {
6531        if let FrameRequest::ConfigureInputTypes { types, allow, control_handle } = self {
6532            Some((types, allow, control_handle))
6533        } else {
6534            None
6535        }
6536    }
6537
6538    #[allow(irrefutable_let_patterns)]
6539    pub fn into_set_popup_frame_creation_listener(
6540        self,
6541    ) -> Option<(
6542        Option<fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>>,
6543        FrameControlHandle,
6544    )> {
6545        if let FrameRequest::SetPopupFrameCreationListener { listener, control_handle } = self {
6546            Some((listener, control_handle))
6547        } else {
6548            None
6549        }
6550    }
6551
6552    #[allow(irrefutable_let_patterns)]
6553    pub fn into_set_url_request_rewrite_rules(
6554        self,
6555    ) -> Option<(Vec<UrlRequestRewriteRule>, FrameSetUrlRequestRewriteRulesResponder)> {
6556        if let FrameRequest::SetUrlRequestRewriteRules { rules, responder } = self {
6557            Some((rules, responder))
6558        } else {
6559            None
6560        }
6561    }
6562
6563    #[allow(irrefutable_let_patterns)]
6564    pub fn into_set_media_settings(self) -> Option<(FrameMediaSettings, FrameControlHandle)> {
6565        if let FrameRequest::SetMediaSettings { settings, control_handle } = self {
6566            Some((settings, control_handle))
6567        } else {
6568            None
6569        }
6570    }
6571
6572    #[allow(irrefutable_let_patterns)]
6573    pub fn into_force_content_dimensions(
6574        self,
6575    ) -> Option<(Option<Box<fidl_fuchsia_ui_gfx::Vec2>>, FrameControlHandle)> {
6576        if let FrameRequest::ForceContentDimensions { web_dips, control_handle } = self {
6577            Some((web_dips, control_handle))
6578        } else {
6579            None
6580        }
6581    }
6582
6583    #[allow(irrefutable_let_patterns)]
6584    pub fn into_set_permission_state(
6585        self,
6586    ) -> Option<(PermissionDescriptor, String, PermissionState, FrameControlHandle)> {
6587        if let FrameRequest::SetPermissionState { permission, web_origin, state, control_handle } =
6588            self
6589        {
6590            Some((permission, web_origin, state, control_handle))
6591        } else {
6592            None
6593        }
6594    }
6595
6596    #[allow(irrefutable_let_patterns)]
6597    pub fn into_set_block_media_loading(self) -> Option<(bool, FrameControlHandle)> {
6598        if let FrameRequest::SetBlockMediaLoading { blocked, control_handle } = self {
6599            Some((blocked, control_handle))
6600        } else {
6601            None
6602        }
6603    }
6604
6605    #[allow(irrefutable_let_patterns)]
6606    pub fn into_get_private_memory_size(self) -> Option<(FrameGetPrivateMemorySizeResponder)> {
6607        if let FrameRequest::GetPrivateMemorySize { responder } = self {
6608            Some((responder))
6609        } else {
6610            None
6611        }
6612    }
6613
6614    #[allow(irrefutable_let_patterns)]
6615    pub fn into_set_navigation_policy_provider(
6616        self,
6617    ) -> Option<(
6618        NavigationPolicyProviderParams,
6619        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
6620        FrameControlHandle,
6621    )> {
6622        if let FrameRequest::SetNavigationPolicyProvider { params, provider, control_handle } = self
6623        {
6624            Some((params, provider, control_handle))
6625        } else {
6626            None
6627        }
6628    }
6629
6630    #[allow(irrefutable_let_patterns)]
6631    pub fn into_set_content_area_settings(
6632        self,
6633    ) -> Option<(ContentAreaSettings, FrameControlHandle)> {
6634        if let FrameRequest::SetContentAreaSettings { settings, control_handle } = self {
6635            Some((settings, control_handle))
6636        } else {
6637            None
6638        }
6639    }
6640
6641    #[allow(irrefutable_let_patterns)]
6642    pub fn into_reset_content_area_settings(self) -> Option<(FrameControlHandle)> {
6643        if let FrameRequest::ResetContentAreaSettings { control_handle } = self {
6644            Some((control_handle))
6645        } else {
6646            None
6647        }
6648    }
6649
6650    #[allow(irrefutable_let_patterns)]
6651    pub fn into_close(self) -> Option<(FrameCloseRequest, FrameControlHandle)> {
6652        if let FrameRequest::Close { payload, control_handle } = self {
6653            Some((payload, control_handle))
6654        } else {
6655            None
6656        }
6657    }
6658
6659    /// Name of the method defined in FIDL
6660    pub fn method_name(&self) -> &'static str {
6661        match *self {
6662            FrameRequest::CreateView { .. } => "create_view",
6663            FrameRequest::CreateViewWithViewRef { .. } => "create_view_with_view_ref",
6664            FrameRequest::CreateView2 { .. } => "create_view2",
6665            FrameRequest::EnableHeadlessRendering { .. } => "enable_headless_rendering",
6666            FrameRequest::DisableHeadlessRendering { .. } => "disable_headless_rendering",
6667            FrameRequest::GetMediaPlayer { .. } => "get_media_player",
6668            FrameRequest::GetNavigationController { .. } => "get_navigation_controller",
6669            FrameRequest::ExecuteJavaScript { .. } => "execute_java_script",
6670            FrameRequest::ExecuteJavaScriptNoResult { .. } => "execute_java_script_no_result",
6671            FrameRequest::AddBeforeLoadJavaScript { .. } => "add_before_load_java_script",
6672            FrameRequest::RemoveBeforeLoadJavaScript { .. } => "remove_before_load_java_script",
6673            FrameRequest::PostMessage { .. } => "post_message",
6674            FrameRequest::SetNavigationEventListener { .. } => "set_navigation_event_listener",
6675            FrameRequest::SetNavigationEventListener2 { .. } => "set_navigation_event_listener2",
6676            FrameRequest::SetJavaScriptLogLevel { .. } => "set_java_script_log_level",
6677            FrameRequest::SetConsoleLogSink { .. } => "set_console_log_sink",
6678            FrameRequest::ConfigureInputTypes { .. } => "configure_input_types",
6679            FrameRequest::SetPopupFrameCreationListener { .. } => {
6680                "set_popup_frame_creation_listener"
6681            }
6682            FrameRequest::SetUrlRequestRewriteRules { .. } => "set_url_request_rewrite_rules",
6683            FrameRequest::SetMediaSettings { .. } => "set_media_settings",
6684            FrameRequest::ForceContentDimensions { .. } => "force_content_dimensions",
6685            FrameRequest::SetPermissionState { .. } => "set_permission_state",
6686            FrameRequest::SetBlockMediaLoading { .. } => "set_block_media_loading",
6687            FrameRequest::GetPrivateMemorySize { .. } => "get_private_memory_size",
6688            FrameRequest::SetNavigationPolicyProvider { .. } => "set_navigation_policy_provider",
6689            FrameRequest::SetContentAreaSettings { .. } => "set_content_area_settings",
6690            FrameRequest::ResetContentAreaSettings { .. } => "reset_content_area_settings",
6691            FrameRequest::Close { .. } => "close",
6692        }
6693    }
6694}
6695
6696#[derive(Debug, Clone)]
6697pub struct FrameControlHandle {
6698    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6699}
6700
6701impl fidl::endpoints::ControlHandle for FrameControlHandle {
6702    fn shutdown(&self) {
6703        self.inner.shutdown()
6704    }
6705
6706    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6707        self.inner.shutdown_with_epitaph(status)
6708    }
6709
6710    fn is_closed(&self) -> bool {
6711        self.inner.channel().is_closed()
6712    }
6713    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6714        self.inner.channel().on_closed()
6715    }
6716
6717    #[cfg(target_os = "fuchsia")]
6718    fn signal_peer(
6719        &self,
6720        clear_mask: zx::Signals,
6721        set_mask: zx::Signals,
6722    ) -> Result<(), zx_status::Status> {
6723        use fidl::Peered;
6724        self.inner.channel().signal_peer(clear_mask, set_mask)
6725    }
6726}
6727
6728impl FrameControlHandle {}
6729
6730#[must_use = "FIDL methods require a response to be sent"]
6731#[derive(Debug)]
6732pub struct FrameExecuteJavaScriptResponder {
6733    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6734    tx_id: u32,
6735}
6736
6737/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6738/// if the responder is dropped without sending a response, so that the client
6739/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6740impl std::ops::Drop for FrameExecuteJavaScriptResponder {
6741    fn drop(&mut self) {
6742        self.control_handle.shutdown();
6743        // Safety: drops once, never accessed again
6744        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6745    }
6746}
6747
6748impl fidl::endpoints::Responder for FrameExecuteJavaScriptResponder {
6749    type ControlHandle = FrameControlHandle;
6750
6751    fn control_handle(&self) -> &FrameControlHandle {
6752        &self.control_handle
6753    }
6754
6755    fn drop_without_shutdown(mut self) {
6756        // Safety: drops once, never accessed again due to mem::forget
6757        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6758        // Prevent Drop from running (which would shut down the channel)
6759        std::mem::forget(self);
6760    }
6761}
6762
6763impl FrameExecuteJavaScriptResponder {
6764    /// Sends a response to the FIDL transaction.
6765    ///
6766    /// Sets the channel to shutdown if an error occurs.
6767    pub fn send(
6768        self,
6769        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6770    ) -> Result<(), fidl::Error> {
6771        let _result = self.send_raw(result);
6772        if _result.is_err() {
6773            self.control_handle.shutdown();
6774        }
6775        self.drop_without_shutdown();
6776        _result
6777    }
6778
6779    /// Similar to "send" but does not shutdown the channel if an error occurs.
6780    pub fn send_no_shutdown_on_err(
6781        self,
6782        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6783    ) -> Result<(), fidl::Error> {
6784        let _result = self.send_raw(result);
6785        self.drop_without_shutdown();
6786        _result
6787    }
6788
6789    fn send_raw(
6790        &self,
6791        mut result: Result<fidl_fuchsia_mem::Buffer, FrameError>,
6792    ) -> Result<(), fidl::Error> {
6793        self.control_handle.inner.send::<fidl::encoding::ResultType<
6794            FrameExecuteJavaScriptResponse,
6795            FrameError,
6796        >>(
6797            result.as_mut().map_err(|e| *e).map(|result| (result,)),
6798            self.tx_id,
6799            0x79abdd4907000542,
6800            fidl::encoding::DynamicFlags::empty(),
6801        )
6802    }
6803}
6804
6805#[must_use = "FIDL methods require a response to be sent"]
6806#[derive(Debug)]
6807pub struct FrameExecuteJavaScriptNoResultResponder {
6808    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6809    tx_id: u32,
6810}
6811
6812/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6813/// if the responder is dropped without sending a response, so that the client
6814/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6815impl std::ops::Drop for FrameExecuteJavaScriptNoResultResponder {
6816    fn drop(&mut self) {
6817        self.control_handle.shutdown();
6818        // Safety: drops once, never accessed again
6819        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6820    }
6821}
6822
6823impl fidl::endpoints::Responder for FrameExecuteJavaScriptNoResultResponder {
6824    type ControlHandle = FrameControlHandle;
6825
6826    fn control_handle(&self) -> &FrameControlHandle {
6827        &self.control_handle
6828    }
6829
6830    fn drop_without_shutdown(mut self) {
6831        // Safety: drops once, never accessed again due to mem::forget
6832        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6833        // Prevent Drop from running (which would shut down the channel)
6834        std::mem::forget(self);
6835    }
6836}
6837
6838impl FrameExecuteJavaScriptNoResultResponder {
6839    /// Sends a response to the FIDL transaction.
6840    ///
6841    /// Sets the channel to shutdown if an error occurs.
6842    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6843        let _result = self.send_raw(result);
6844        if _result.is_err() {
6845            self.control_handle.shutdown();
6846        }
6847        self.drop_without_shutdown();
6848        _result
6849    }
6850
6851    /// Similar to "send" but does not shutdown the channel if an error occurs.
6852    pub fn send_no_shutdown_on_err(
6853        self,
6854        mut result: Result<(), FrameError>,
6855    ) -> Result<(), fidl::Error> {
6856        let _result = self.send_raw(result);
6857        self.drop_without_shutdown();
6858        _result
6859    }
6860
6861    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6862        self.control_handle
6863            .inner
6864            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6865                result,
6866                self.tx_id,
6867                0x16b8491520cbcd63,
6868                fidl::encoding::DynamicFlags::empty(),
6869            )
6870    }
6871}
6872
6873#[must_use = "FIDL methods require a response to be sent"]
6874#[derive(Debug)]
6875pub struct FrameAddBeforeLoadJavaScriptResponder {
6876    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6877    tx_id: u32,
6878}
6879
6880/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6881/// if the responder is dropped without sending a response, so that the client
6882/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6883impl std::ops::Drop for FrameAddBeforeLoadJavaScriptResponder {
6884    fn drop(&mut self) {
6885        self.control_handle.shutdown();
6886        // Safety: drops once, never accessed again
6887        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6888    }
6889}
6890
6891impl fidl::endpoints::Responder for FrameAddBeforeLoadJavaScriptResponder {
6892    type ControlHandle = FrameControlHandle;
6893
6894    fn control_handle(&self) -> &FrameControlHandle {
6895        &self.control_handle
6896    }
6897
6898    fn drop_without_shutdown(mut self) {
6899        // Safety: drops once, never accessed again due to mem::forget
6900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6901        // Prevent Drop from running (which would shut down the channel)
6902        std::mem::forget(self);
6903    }
6904}
6905
6906impl FrameAddBeforeLoadJavaScriptResponder {
6907    /// Sends a response to the FIDL transaction.
6908    ///
6909    /// Sets the channel to shutdown if an error occurs.
6910    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6911        let _result = self.send_raw(result);
6912        if _result.is_err() {
6913            self.control_handle.shutdown();
6914        }
6915        self.drop_without_shutdown();
6916        _result
6917    }
6918
6919    /// Similar to "send" but does not shutdown the channel if an error occurs.
6920    pub fn send_no_shutdown_on_err(
6921        self,
6922        mut result: Result<(), FrameError>,
6923    ) -> Result<(), fidl::Error> {
6924        let _result = self.send_raw(result);
6925        self.drop_without_shutdown();
6926        _result
6927    }
6928
6929    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6930        self.control_handle
6931            .inner
6932            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
6933                result,
6934                self.tx_id,
6935                0x540ac0da59d823e,
6936                fidl::encoding::DynamicFlags::empty(),
6937            )
6938    }
6939}
6940
6941#[must_use = "FIDL methods require a response to be sent"]
6942#[derive(Debug)]
6943pub struct FramePostMessageResponder {
6944    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
6945    tx_id: u32,
6946}
6947
6948/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
6949/// if the responder is dropped without sending a response, so that the client
6950/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6951impl std::ops::Drop for FramePostMessageResponder {
6952    fn drop(&mut self) {
6953        self.control_handle.shutdown();
6954        // Safety: drops once, never accessed again
6955        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6956    }
6957}
6958
6959impl fidl::endpoints::Responder for FramePostMessageResponder {
6960    type ControlHandle = FrameControlHandle;
6961
6962    fn control_handle(&self) -> &FrameControlHandle {
6963        &self.control_handle
6964    }
6965
6966    fn drop_without_shutdown(mut self) {
6967        // Safety: drops once, never accessed again due to mem::forget
6968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6969        // Prevent Drop from running (which would shut down the channel)
6970        std::mem::forget(self);
6971    }
6972}
6973
6974impl FramePostMessageResponder {
6975    /// Sends a response to the FIDL transaction.
6976    ///
6977    /// Sets the channel to shutdown if an error occurs.
6978    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6979        let _result = self.send_raw(result);
6980        if _result.is_err() {
6981            self.control_handle.shutdown();
6982        }
6983        self.drop_without_shutdown();
6984        _result
6985    }
6986
6987    /// Similar to "send" but does not shutdown the channel if an error occurs.
6988    pub fn send_no_shutdown_on_err(
6989        self,
6990        mut result: Result<(), FrameError>,
6991    ) -> Result<(), fidl::Error> {
6992        let _result = self.send_raw(result);
6993        self.drop_without_shutdown();
6994        _result
6995    }
6996
6997    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
6998        self.control_handle
6999            .inner
7000            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
7001                result,
7002                self.tx_id,
7003                0x751d686eb7caa341,
7004                fidl::encoding::DynamicFlags::empty(),
7005            )
7006    }
7007}
7008
7009#[must_use = "FIDL methods require a response to be sent"]
7010#[derive(Debug)]
7011pub struct FrameSetUrlRequestRewriteRulesResponder {
7012    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
7013    tx_id: u32,
7014}
7015
7016/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
7017/// if the responder is dropped without sending a response, so that the client
7018/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7019impl std::ops::Drop for FrameSetUrlRequestRewriteRulesResponder {
7020    fn drop(&mut self) {
7021        self.control_handle.shutdown();
7022        // Safety: drops once, never accessed again
7023        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7024    }
7025}
7026
7027impl fidl::endpoints::Responder for FrameSetUrlRequestRewriteRulesResponder {
7028    type ControlHandle = FrameControlHandle;
7029
7030    fn control_handle(&self) -> &FrameControlHandle {
7031        &self.control_handle
7032    }
7033
7034    fn drop_without_shutdown(mut self) {
7035        // Safety: drops once, never accessed again due to mem::forget
7036        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7037        // Prevent Drop from running (which would shut down the channel)
7038        std::mem::forget(self);
7039    }
7040}
7041
7042impl FrameSetUrlRequestRewriteRulesResponder {
7043    /// Sends a response to the FIDL transaction.
7044    ///
7045    /// Sets the channel to shutdown if an error occurs.
7046    pub fn send(self) -> Result<(), fidl::Error> {
7047        let _result = self.send_raw();
7048        if _result.is_err() {
7049            self.control_handle.shutdown();
7050        }
7051        self.drop_without_shutdown();
7052        _result
7053    }
7054
7055    /// Similar to "send" but does not shutdown the channel if an error occurs.
7056    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7057        let _result = self.send_raw();
7058        self.drop_without_shutdown();
7059        _result
7060    }
7061
7062    fn send_raw(&self) -> Result<(), fidl::Error> {
7063        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7064            (),
7065            self.tx_id,
7066            0x2e3f797350ab3281,
7067            fidl::encoding::DynamicFlags::empty(),
7068        )
7069    }
7070}
7071
7072#[must_use = "FIDL methods require a response to be sent"]
7073#[derive(Debug)]
7074pub struct FrameGetPrivateMemorySizeResponder {
7075    control_handle: std::mem::ManuallyDrop<FrameControlHandle>,
7076    tx_id: u32,
7077}
7078
7079/// Set the the channel to be shutdown (see [`FrameControlHandle::shutdown`])
7080/// if the responder is dropped without sending a response, so that the client
7081/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7082impl std::ops::Drop for FrameGetPrivateMemorySizeResponder {
7083    fn drop(&mut self) {
7084        self.control_handle.shutdown();
7085        // Safety: drops once, never accessed again
7086        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7087    }
7088}
7089
7090impl fidl::endpoints::Responder for FrameGetPrivateMemorySizeResponder {
7091    type ControlHandle = FrameControlHandle;
7092
7093    fn control_handle(&self) -> &FrameControlHandle {
7094        &self.control_handle
7095    }
7096
7097    fn drop_without_shutdown(mut self) {
7098        // Safety: drops once, never accessed again due to mem::forget
7099        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7100        // Prevent Drop from running (which would shut down the channel)
7101        std::mem::forget(self);
7102    }
7103}
7104
7105impl FrameGetPrivateMemorySizeResponder {
7106    /// Sends a response to the FIDL transaction.
7107    ///
7108    /// Sets the channel to shutdown if an error occurs.
7109    pub fn send(self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7110        let _result = self.send_raw(size_bytes);
7111        if _result.is_err() {
7112            self.control_handle.shutdown();
7113        }
7114        self.drop_without_shutdown();
7115        _result
7116    }
7117
7118    /// Similar to "send" but does not shutdown the channel if an error occurs.
7119    pub fn send_no_shutdown_on_err(self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7120        let _result = self.send_raw(size_bytes);
7121        self.drop_without_shutdown();
7122        _result
7123    }
7124
7125    fn send_raw(&self, mut size_bytes: u64) -> Result<(), fidl::Error> {
7126        self.control_handle.inner.send::<FrameGetPrivateMemorySizeResponse>(
7127            (size_bytes,),
7128            self.tx_id,
7129            0x6ad4d43da6c129b0,
7130            fidl::encoding::DynamicFlags::empty(),
7131        )
7132    }
7133}
7134
7135#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7136pub struct FrameHostMarker;
7137
7138impl fidl::endpoints::ProtocolMarker for FrameHostMarker {
7139    type Proxy = FrameHostProxy;
7140    type RequestStream = FrameHostRequestStream;
7141    #[cfg(target_os = "fuchsia")]
7142    type SynchronousProxy = FrameHostSynchronousProxy;
7143
7144    const DEBUG_NAME: &'static str = "fuchsia.web.FrameHost";
7145}
7146impl fidl::endpoints::DiscoverableProtocolMarker for FrameHostMarker {}
7147
7148pub trait FrameHostProxyInterface: Send + Sync {
7149    fn r#create_frame_with_params(
7150        &self,
7151        params: CreateFrameParams,
7152        frame: fidl::endpoints::ServerEnd<FrameMarker>,
7153    ) -> Result<(), fidl::Error>;
7154}
7155#[derive(Debug)]
7156#[cfg(target_os = "fuchsia")]
7157pub struct FrameHostSynchronousProxy {
7158    client: fidl::client::sync::Client,
7159}
7160
7161#[cfg(target_os = "fuchsia")]
7162impl fidl::endpoints::SynchronousProxy for FrameHostSynchronousProxy {
7163    type Proxy = FrameHostProxy;
7164    type Protocol = FrameHostMarker;
7165
7166    fn from_channel(inner: fidl::Channel) -> Self {
7167        Self::new(inner)
7168    }
7169
7170    fn into_channel(self) -> fidl::Channel {
7171        self.client.into_channel()
7172    }
7173
7174    fn as_channel(&self) -> &fidl::Channel {
7175        self.client.as_channel()
7176    }
7177}
7178
7179#[cfg(target_os = "fuchsia")]
7180impl FrameHostSynchronousProxy {
7181    pub fn new(channel: fidl::Channel) -> Self {
7182        let protocol_name = <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7183        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7184    }
7185
7186    pub fn into_channel(self) -> fidl::Channel {
7187        self.client.into_channel()
7188    }
7189
7190    /// Waits until an event arrives and returns it. It is safe for other
7191    /// threads to make concurrent requests while waiting for an event.
7192    pub fn wait_for_event(
7193        &self,
7194        deadline: zx::MonotonicInstant,
7195    ) -> Result<FrameHostEvent, fidl::Error> {
7196        FrameHostEvent::decode(self.client.wait_for_event(deadline)?)
7197    }
7198
7199    /// Behaves identically to [`Context.CreateFrameWithParams`].
7200    pub fn r#create_frame_with_params(
7201        &self,
7202        mut params: CreateFrameParams,
7203        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7204    ) -> Result<(), fidl::Error> {
7205        self.client.send::<FrameHostCreateFrameWithParamsRequest>(
7206            (&mut params, frame),
7207            0x670186c3a1b3f28,
7208            fidl::encoding::DynamicFlags::empty(),
7209        )
7210    }
7211}
7212
7213#[cfg(target_os = "fuchsia")]
7214impl From<FrameHostSynchronousProxy> for zx::NullableHandle {
7215    fn from(value: FrameHostSynchronousProxy) -> Self {
7216        value.into_channel().into()
7217    }
7218}
7219
7220#[cfg(target_os = "fuchsia")]
7221impl From<fidl::Channel> for FrameHostSynchronousProxy {
7222    fn from(value: fidl::Channel) -> Self {
7223        Self::new(value)
7224    }
7225}
7226
7227#[cfg(target_os = "fuchsia")]
7228impl fidl::endpoints::FromClient for FrameHostSynchronousProxy {
7229    type Protocol = FrameHostMarker;
7230
7231    fn from_client(value: fidl::endpoints::ClientEnd<FrameHostMarker>) -> Self {
7232        Self::new(value.into_channel())
7233    }
7234}
7235
7236#[derive(Debug, Clone)]
7237pub struct FrameHostProxy {
7238    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7239}
7240
7241impl fidl::endpoints::Proxy for FrameHostProxy {
7242    type Protocol = FrameHostMarker;
7243
7244    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7245        Self::new(inner)
7246    }
7247
7248    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7249        self.client.into_channel().map_err(|client| Self { client })
7250    }
7251
7252    fn as_channel(&self) -> &::fidl::AsyncChannel {
7253        self.client.as_channel()
7254    }
7255}
7256
7257impl FrameHostProxy {
7258    /// Create a new Proxy for fuchsia.web/FrameHost.
7259    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7260        let protocol_name = <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7261        Self { client: fidl::client::Client::new(channel, protocol_name) }
7262    }
7263
7264    /// Get a Stream of events from the remote end of the protocol.
7265    ///
7266    /// # Panics
7267    ///
7268    /// Panics if the event stream was already taken.
7269    pub fn take_event_stream(&self) -> FrameHostEventStream {
7270        FrameHostEventStream { event_receiver: self.client.take_event_receiver() }
7271    }
7272
7273    /// Behaves identically to [`Context.CreateFrameWithParams`].
7274    pub fn r#create_frame_with_params(
7275        &self,
7276        mut params: CreateFrameParams,
7277        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7278    ) -> Result<(), fidl::Error> {
7279        FrameHostProxyInterface::r#create_frame_with_params(self, params, frame)
7280    }
7281}
7282
7283impl FrameHostProxyInterface for FrameHostProxy {
7284    fn r#create_frame_with_params(
7285        &self,
7286        mut params: CreateFrameParams,
7287        mut frame: fidl::endpoints::ServerEnd<FrameMarker>,
7288    ) -> Result<(), fidl::Error> {
7289        self.client.send::<FrameHostCreateFrameWithParamsRequest>(
7290            (&mut params, frame),
7291            0x670186c3a1b3f28,
7292            fidl::encoding::DynamicFlags::empty(),
7293        )
7294    }
7295}
7296
7297pub struct FrameHostEventStream {
7298    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7299}
7300
7301impl std::marker::Unpin for FrameHostEventStream {}
7302
7303impl futures::stream::FusedStream for FrameHostEventStream {
7304    fn is_terminated(&self) -> bool {
7305        self.event_receiver.is_terminated()
7306    }
7307}
7308
7309impl futures::Stream for FrameHostEventStream {
7310    type Item = Result<FrameHostEvent, fidl::Error>;
7311
7312    fn poll_next(
7313        mut self: std::pin::Pin<&mut Self>,
7314        cx: &mut std::task::Context<'_>,
7315    ) -> std::task::Poll<Option<Self::Item>> {
7316        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7317            &mut self.event_receiver,
7318            cx
7319        )?) {
7320            Some(buf) => std::task::Poll::Ready(Some(FrameHostEvent::decode(buf))),
7321            None => std::task::Poll::Ready(None),
7322        }
7323    }
7324}
7325
7326#[derive(Debug)]
7327pub enum FrameHostEvent {}
7328
7329impl FrameHostEvent {
7330    /// Decodes a message buffer as a [`FrameHostEvent`].
7331    fn decode(
7332        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7333    ) -> Result<FrameHostEvent, fidl::Error> {
7334        let (bytes, _handles) = buf.split_mut();
7335        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7336        debug_assert_eq!(tx_header.tx_id, 0);
7337        match tx_header.ordinal {
7338            _ => Err(fidl::Error::UnknownOrdinal {
7339                ordinal: tx_header.ordinal,
7340                protocol_name: <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7341            }),
7342        }
7343    }
7344}
7345
7346/// A Stream of incoming requests for fuchsia.web/FrameHost.
7347pub struct FrameHostRequestStream {
7348    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7349    is_terminated: bool,
7350}
7351
7352impl std::marker::Unpin for FrameHostRequestStream {}
7353
7354impl futures::stream::FusedStream for FrameHostRequestStream {
7355    fn is_terminated(&self) -> bool {
7356        self.is_terminated
7357    }
7358}
7359
7360impl fidl::endpoints::RequestStream for FrameHostRequestStream {
7361    type Protocol = FrameHostMarker;
7362    type ControlHandle = FrameHostControlHandle;
7363
7364    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7365        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7366    }
7367
7368    fn control_handle(&self) -> Self::ControlHandle {
7369        FrameHostControlHandle { inner: self.inner.clone() }
7370    }
7371
7372    fn into_inner(
7373        self,
7374    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7375    {
7376        (self.inner, self.is_terminated)
7377    }
7378
7379    fn from_inner(
7380        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7381        is_terminated: bool,
7382    ) -> Self {
7383        Self { inner, is_terminated }
7384    }
7385}
7386
7387impl futures::Stream for FrameHostRequestStream {
7388    type Item = Result<FrameHostRequest, fidl::Error>;
7389
7390    fn poll_next(
7391        mut self: std::pin::Pin<&mut Self>,
7392        cx: &mut std::task::Context<'_>,
7393    ) -> std::task::Poll<Option<Self::Item>> {
7394        let this = &mut *self;
7395        if this.inner.check_shutdown(cx) {
7396            this.is_terminated = true;
7397            return std::task::Poll::Ready(None);
7398        }
7399        if this.is_terminated {
7400            panic!("polled FrameHostRequestStream after completion");
7401        }
7402        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7403            |bytes, handles| {
7404                match this.inner.channel().read_etc(cx, bytes, handles) {
7405                    std::task::Poll::Ready(Ok(())) => {}
7406                    std::task::Poll::Pending => return std::task::Poll::Pending,
7407                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7408                        this.is_terminated = true;
7409                        return std::task::Poll::Ready(None);
7410                    }
7411                    std::task::Poll::Ready(Err(e)) => {
7412                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7413                            e.into(),
7414                        ))));
7415                    }
7416                }
7417
7418                // A message has been received from the channel
7419                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7420
7421                std::task::Poll::Ready(Some(match header.ordinal {
7422                    0x670186c3a1b3f28 => {
7423                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7424                        let mut req = fidl::new_empty!(
7425                            FrameHostCreateFrameWithParamsRequest,
7426                            fidl::encoding::DefaultFuchsiaResourceDialect
7427                        );
7428                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FrameHostCreateFrameWithParamsRequest>(&header, _body_bytes, handles, &mut req)?;
7429                        let control_handle = FrameHostControlHandle { inner: this.inner.clone() };
7430                        Ok(FrameHostRequest::CreateFrameWithParams {
7431                            params: req.params,
7432                            frame: req.frame,
7433
7434                            control_handle,
7435                        })
7436                    }
7437                    _ => Err(fidl::Error::UnknownOrdinal {
7438                        ordinal: header.ordinal,
7439                        protocol_name:
7440                            <FrameHostMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7441                    }),
7442                }))
7443            },
7444        )
7445    }
7446}
7447
7448/// Used by [`Context`] clients to delegate [`Frame`] hosting capabilities to selected peers.
7449#[derive(Debug)]
7450pub enum FrameHostRequest {
7451    /// Behaves identically to [`Context.CreateFrameWithParams`].
7452    CreateFrameWithParams {
7453        params: CreateFrameParams,
7454        frame: fidl::endpoints::ServerEnd<FrameMarker>,
7455        control_handle: FrameHostControlHandle,
7456    },
7457}
7458
7459impl FrameHostRequest {
7460    #[allow(irrefutable_let_patterns)]
7461    pub fn into_create_frame_with_params(
7462        self,
7463    ) -> Option<(CreateFrameParams, fidl::endpoints::ServerEnd<FrameMarker>, FrameHostControlHandle)>
7464    {
7465        if let FrameHostRequest::CreateFrameWithParams { params, frame, control_handle } = self {
7466            Some((params, frame, control_handle))
7467        } else {
7468            None
7469        }
7470    }
7471
7472    /// Name of the method defined in FIDL
7473    pub fn method_name(&self) -> &'static str {
7474        match *self {
7475            FrameHostRequest::CreateFrameWithParams { .. } => "create_frame_with_params",
7476        }
7477    }
7478}
7479
7480#[derive(Debug, Clone)]
7481pub struct FrameHostControlHandle {
7482    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7483}
7484
7485impl fidl::endpoints::ControlHandle for FrameHostControlHandle {
7486    fn shutdown(&self) {
7487        self.inner.shutdown()
7488    }
7489
7490    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7491        self.inner.shutdown_with_epitaph(status)
7492    }
7493
7494    fn is_closed(&self) -> bool {
7495        self.inner.channel().is_closed()
7496    }
7497    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7498        self.inner.channel().on_closed()
7499    }
7500
7501    #[cfg(target_os = "fuchsia")]
7502    fn signal_peer(
7503        &self,
7504        clear_mask: zx::Signals,
7505        set_mask: zx::Signals,
7506    ) -> Result<(), zx_status::Status> {
7507        use fidl::Peered;
7508        self.inner.channel().signal_peer(clear_mask, set_mask)
7509    }
7510}
7511
7512impl FrameHostControlHandle {}
7513
7514#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7515pub struct MessagePortMarker;
7516
7517impl fidl::endpoints::ProtocolMarker for MessagePortMarker {
7518    type Proxy = MessagePortProxy;
7519    type RequestStream = MessagePortRequestStream;
7520    #[cfg(target_os = "fuchsia")]
7521    type SynchronousProxy = MessagePortSynchronousProxy;
7522
7523    const DEBUG_NAME: &'static str = "(anonymous) MessagePort";
7524}
7525pub type MessagePortPostMessageResult = Result<(), FrameError>;
7526
7527pub trait MessagePortProxyInterface: Send + Sync {
7528    type PostMessageResponseFut: std::future::Future<Output = Result<MessagePortPostMessageResult, fidl::Error>>
7529        + Send;
7530    fn r#post_message(&self, message: WebMessage) -> Self::PostMessageResponseFut;
7531    type ReceiveMessageResponseFut: std::future::Future<Output = Result<WebMessage, fidl::Error>>
7532        + Send;
7533    fn r#receive_message(&self) -> Self::ReceiveMessageResponseFut;
7534}
7535#[derive(Debug)]
7536#[cfg(target_os = "fuchsia")]
7537pub struct MessagePortSynchronousProxy {
7538    client: fidl::client::sync::Client,
7539}
7540
7541#[cfg(target_os = "fuchsia")]
7542impl fidl::endpoints::SynchronousProxy for MessagePortSynchronousProxy {
7543    type Proxy = MessagePortProxy;
7544    type Protocol = MessagePortMarker;
7545
7546    fn from_channel(inner: fidl::Channel) -> Self {
7547        Self::new(inner)
7548    }
7549
7550    fn into_channel(self) -> fidl::Channel {
7551        self.client.into_channel()
7552    }
7553
7554    fn as_channel(&self) -> &fidl::Channel {
7555        self.client.as_channel()
7556    }
7557}
7558
7559#[cfg(target_os = "fuchsia")]
7560impl MessagePortSynchronousProxy {
7561    pub fn new(channel: fidl::Channel) -> Self {
7562        let protocol_name = <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7563        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7564    }
7565
7566    pub fn into_channel(self) -> fidl::Channel {
7567        self.client.into_channel()
7568    }
7569
7570    /// Waits until an event arrives and returns it. It is safe for other
7571    /// threads to make concurrent requests while waiting for an event.
7572    pub fn wait_for_event(
7573        &self,
7574        deadline: zx::MonotonicInstant,
7575    ) -> Result<MessagePortEvent, fidl::Error> {
7576        MessagePortEvent::decode(self.client.wait_for_event(deadline)?)
7577    }
7578
7579    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7580    /// time. It is not necessary for the caller to wait for the completion callback before calling
7581    /// [`MessagePort.PostMessage`] again.
7582    ///
7583    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7584    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7585    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7586    pub fn r#post_message(
7587        &self,
7588        mut message: WebMessage,
7589        ___deadline: zx::MonotonicInstant,
7590    ) -> Result<MessagePortPostMessageResult, fidl::Error> {
7591        let _response = self.client.send_query::<
7592            MessagePortPostMessageRequest,
7593            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
7594        >(
7595            (&mut message,),
7596            0x2bcf0a6ed30ffd1f,
7597            fidl::encoding::DynamicFlags::empty(),
7598            ___deadline,
7599        )?;
7600        Ok(_response.map(|x| x))
7601    }
7602
7603    /// Asynchronously reads the next message from the channel. The client should invoke the
7604    /// callback when it is ready to process another message. Unreceived messages are buffered
7605    /// on the sender's side and bounded by its available resources.
7606    pub fn r#receive_message(
7607        &self,
7608        ___deadline: zx::MonotonicInstant,
7609    ) -> Result<WebMessage, fidl::Error> {
7610        let _response = self
7611            .client
7612            .send_query::<fidl::encoding::EmptyPayload, MessagePortReceiveMessageResponse>(
7613                (),
7614                0x6c8a6051690be58d,
7615                fidl::encoding::DynamicFlags::empty(),
7616                ___deadline,
7617            )?;
7618        Ok(_response.message)
7619    }
7620}
7621
7622#[cfg(target_os = "fuchsia")]
7623impl From<MessagePortSynchronousProxy> for zx::NullableHandle {
7624    fn from(value: MessagePortSynchronousProxy) -> Self {
7625        value.into_channel().into()
7626    }
7627}
7628
7629#[cfg(target_os = "fuchsia")]
7630impl From<fidl::Channel> for MessagePortSynchronousProxy {
7631    fn from(value: fidl::Channel) -> Self {
7632        Self::new(value)
7633    }
7634}
7635
7636#[cfg(target_os = "fuchsia")]
7637impl fidl::endpoints::FromClient for MessagePortSynchronousProxy {
7638    type Protocol = MessagePortMarker;
7639
7640    fn from_client(value: fidl::endpoints::ClientEnd<MessagePortMarker>) -> Self {
7641        Self::new(value.into_channel())
7642    }
7643}
7644
7645#[derive(Debug, Clone)]
7646pub struct MessagePortProxy {
7647    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7648}
7649
7650impl fidl::endpoints::Proxy for MessagePortProxy {
7651    type Protocol = MessagePortMarker;
7652
7653    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7654        Self::new(inner)
7655    }
7656
7657    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7658        self.client.into_channel().map_err(|client| Self { client })
7659    }
7660
7661    fn as_channel(&self) -> &::fidl::AsyncChannel {
7662        self.client.as_channel()
7663    }
7664}
7665
7666impl MessagePortProxy {
7667    /// Create a new Proxy for fuchsia.web/MessagePort.
7668    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7669        let protocol_name = <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7670        Self { client: fidl::client::Client::new(channel, protocol_name) }
7671    }
7672
7673    /// Get a Stream of events from the remote end of the protocol.
7674    ///
7675    /// # Panics
7676    ///
7677    /// Panics if the event stream was already taken.
7678    pub fn take_event_stream(&self) -> MessagePortEventStream {
7679        MessagePortEventStream { event_receiver: self.client.take_event_receiver() }
7680    }
7681
7682    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7683    /// time. It is not necessary for the caller to wait for the completion callback before calling
7684    /// [`MessagePort.PostMessage`] again.
7685    ///
7686    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7687    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7688    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7689    pub fn r#post_message(
7690        &self,
7691        mut message: WebMessage,
7692    ) -> fidl::client::QueryResponseFut<
7693        MessagePortPostMessageResult,
7694        fidl::encoding::DefaultFuchsiaResourceDialect,
7695    > {
7696        MessagePortProxyInterface::r#post_message(self, message)
7697    }
7698
7699    /// Asynchronously reads the next message from the channel. The client should invoke the
7700    /// callback when it is ready to process another message. Unreceived messages are buffered
7701    /// on the sender's side and bounded by its available resources.
7702    pub fn r#receive_message(
7703        &self,
7704    ) -> fidl::client::QueryResponseFut<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
7705    {
7706        MessagePortProxyInterface::r#receive_message(self)
7707    }
7708}
7709
7710impl MessagePortProxyInterface for MessagePortProxy {
7711    type PostMessageResponseFut = fidl::client::QueryResponseFut<
7712        MessagePortPostMessageResult,
7713        fidl::encoding::DefaultFuchsiaResourceDialect,
7714    >;
7715    fn r#post_message(&self, mut message: WebMessage) -> Self::PostMessageResponseFut {
7716        fn _decode(
7717            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7718        ) -> Result<MessagePortPostMessageResult, fidl::Error> {
7719            let _response = fidl::client::decode_transaction_body::<
7720                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>,
7721                fidl::encoding::DefaultFuchsiaResourceDialect,
7722                0x2bcf0a6ed30ffd1f,
7723            >(_buf?)?;
7724            Ok(_response.map(|x| x))
7725        }
7726        self.client
7727            .send_query_and_decode::<MessagePortPostMessageRequest, MessagePortPostMessageResult>(
7728                (&mut message,),
7729                0x2bcf0a6ed30ffd1f,
7730                fidl::encoding::DynamicFlags::empty(),
7731                _decode,
7732            )
7733    }
7734
7735    type ReceiveMessageResponseFut =
7736        fidl::client::QueryResponseFut<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>;
7737    fn r#receive_message(&self) -> Self::ReceiveMessageResponseFut {
7738        fn _decode(
7739            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7740        ) -> Result<WebMessage, fidl::Error> {
7741            let _response = fidl::client::decode_transaction_body::<
7742                MessagePortReceiveMessageResponse,
7743                fidl::encoding::DefaultFuchsiaResourceDialect,
7744                0x6c8a6051690be58d,
7745            >(_buf?)?;
7746            Ok(_response.message)
7747        }
7748        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WebMessage>(
7749            (),
7750            0x6c8a6051690be58d,
7751            fidl::encoding::DynamicFlags::empty(),
7752            _decode,
7753        )
7754    }
7755}
7756
7757pub struct MessagePortEventStream {
7758    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7759}
7760
7761impl std::marker::Unpin for MessagePortEventStream {}
7762
7763impl futures::stream::FusedStream for MessagePortEventStream {
7764    fn is_terminated(&self) -> bool {
7765        self.event_receiver.is_terminated()
7766    }
7767}
7768
7769impl futures::Stream for MessagePortEventStream {
7770    type Item = Result<MessagePortEvent, fidl::Error>;
7771
7772    fn poll_next(
7773        mut self: std::pin::Pin<&mut Self>,
7774        cx: &mut std::task::Context<'_>,
7775    ) -> std::task::Poll<Option<Self::Item>> {
7776        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7777            &mut self.event_receiver,
7778            cx
7779        )?) {
7780            Some(buf) => std::task::Poll::Ready(Some(MessagePortEvent::decode(buf))),
7781            None => std::task::Poll::Ready(None),
7782        }
7783    }
7784}
7785
7786#[derive(Debug)]
7787pub enum MessagePortEvent {}
7788
7789impl MessagePortEvent {
7790    /// Decodes a message buffer as a [`MessagePortEvent`].
7791    fn decode(
7792        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7793    ) -> Result<MessagePortEvent, fidl::Error> {
7794        let (bytes, _handles) = buf.split_mut();
7795        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7796        debug_assert_eq!(tx_header.tx_id, 0);
7797        match tx_header.ordinal {
7798            _ => Err(fidl::Error::UnknownOrdinal {
7799                ordinal: tx_header.ordinal,
7800                protocol_name: <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7801            }),
7802        }
7803    }
7804}
7805
7806/// A Stream of incoming requests for fuchsia.web/MessagePort.
7807pub struct MessagePortRequestStream {
7808    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7809    is_terminated: bool,
7810}
7811
7812impl std::marker::Unpin for MessagePortRequestStream {}
7813
7814impl futures::stream::FusedStream for MessagePortRequestStream {
7815    fn is_terminated(&self) -> bool {
7816        self.is_terminated
7817    }
7818}
7819
7820impl fidl::endpoints::RequestStream for MessagePortRequestStream {
7821    type Protocol = MessagePortMarker;
7822    type ControlHandle = MessagePortControlHandle;
7823
7824    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7825        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7826    }
7827
7828    fn control_handle(&self) -> Self::ControlHandle {
7829        MessagePortControlHandle { inner: self.inner.clone() }
7830    }
7831
7832    fn into_inner(
7833        self,
7834    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7835    {
7836        (self.inner, self.is_terminated)
7837    }
7838
7839    fn from_inner(
7840        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7841        is_terminated: bool,
7842    ) -> Self {
7843        Self { inner, is_terminated }
7844    }
7845}
7846
7847impl futures::Stream for MessagePortRequestStream {
7848    type Item = Result<MessagePortRequest, fidl::Error>;
7849
7850    fn poll_next(
7851        mut self: std::pin::Pin<&mut Self>,
7852        cx: &mut std::task::Context<'_>,
7853    ) -> std::task::Poll<Option<Self::Item>> {
7854        let this = &mut *self;
7855        if this.inner.check_shutdown(cx) {
7856            this.is_terminated = true;
7857            return std::task::Poll::Ready(None);
7858        }
7859        if this.is_terminated {
7860            panic!("polled MessagePortRequestStream after completion");
7861        }
7862        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7863            |bytes, handles| {
7864                match this.inner.channel().read_etc(cx, bytes, handles) {
7865                    std::task::Poll::Ready(Ok(())) => {}
7866                    std::task::Poll::Pending => return std::task::Poll::Pending,
7867                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7868                        this.is_terminated = true;
7869                        return std::task::Poll::Ready(None);
7870                    }
7871                    std::task::Poll::Ready(Err(e)) => {
7872                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7873                            e.into(),
7874                        ))));
7875                    }
7876                }
7877
7878                // A message has been received from the channel
7879                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7880
7881                std::task::Poll::Ready(Some(match header.ordinal {
7882                    0x2bcf0a6ed30ffd1f => {
7883                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7884                        let mut req = fidl::new_empty!(
7885                            MessagePortPostMessageRequest,
7886                            fidl::encoding::DefaultFuchsiaResourceDialect
7887                        );
7888                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MessagePortPostMessageRequest>(&header, _body_bytes, handles, &mut req)?;
7889                        let control_handle = MessagePortControlHandle { inner: this.inner.clone() };
7890                        Ok(MessagePortRequest::PostMessage {
7891                            message: req.message,
7892
7893                            responder: MessagePortPostMessageResponder {
7894                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7895                                tx_id: header.tx_id,
7896                            },
7897                        })
7898                    }
7899                    0x6c8a6051690be58d => {
7900                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7901                        let mut req = fidl::new_empty!(
7902                            fidl::encoding::EmptyPayload,
7903                            fidl::encoding::DefaultFuchsiaResourceDialect
7904                        );
7905                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7906                        let control_handle = MessagePortControlHandle { inner: this.inner.clone() };
7907                        Ok(MessagePortRequest::ReceiveMessage {
7908                            responder: MessagePortReceiveMessageResponder {
7909                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7910                                tx_id: header.tx_id,
7911                            },
7912                        })
7913                    }
7914                    _ => Err(fidl::Error::UnknownOrdinal {
7915                        ordinal: header.ordinal,
7916                        protocol_name:
7917                            <MessagePortMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7918                    }),
7919                }))
7920            },
7921        )
7922    }
7923}
7924
7925/// Represents one end of an HTML5 MessageChannel. Can be used to send and exchange Messages with
7926/// the peered MessagePort in the Frame's script context. The port is destroyed when either end of
7927/// the MessagePort channel is torn down.
7928#[derive(Debug)]
7929pub enum MessagePortRequest {
7930    /// Sends a [`WebMessage`] to the peer. These are processed in order, one at a
7931    /// time. It is not necessary for the caller to wait for the completion callback before calling
7932    /// [`MessagePort.PostMessage`] again.
7933    ///
7934    /// If an error occurred, the [`FrameError`] will be set to one of these value:
7935    /// - `BUFFER_NOT_UTF8`: The script in `message`'s `data` property is not UTF-8 encoded.
7936    /// - `NO_DATA_IN_MESSAGE`: The `data` property is missing in `message`.
7937    PostMessage { message: WebMessage, responder: MessagePortPostMessageResponder },
7938    /// Asynchronously reads the next message from the channel. The client should invoke the
7939    /// callback when it is ready to process another message. Unreceived messages are buffered
7940    /// on the sender's side and bounded by its available resources.
7941    ReceiveMessage { responder: MessagePortReceiveMessageResponder },
7942}
7943
7944impl MessagePortRequest {
7945    #[allow(irrefutable_let_patterns)]
7946    pub fn into_post_message(self) -> Option<(WebMessage, MessagePortPostMessageResponder)> {
7947        if let MessagePortRequest::PostMessage { message, responder } = self {
7948            Some((message, responder))
7949        } else {
7950            None
7951        }
7952    }
7953
7954    #[allow(irrefutable_let_patterns)]
7955    pub fn into_receive_message(self) -> Option<(MessagePortReceiveMessageResponder)> {
7956        if let MessagePortRequest::ReceiveMessage { responder } = self {
7957            Some((responder))
7958        } else {
7959            None
7960        }
7961    }
7962
7963    /// Name of the method defined in FIDL
7964    pub fn method_name(&self) -> &'static str {
7965        match *self {
7966            MessagePortRequest::PostMessage { .. } => "post_message",
7967            MessagePortRequest::ReceiveMessage { .. } => "receive_message",
7968        }
7969    }
7970}
7971
7972#[derive(Debug, Clone)]
7973pub struct MessagePortControlHandle {
7974    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7975}
7976
7977impl fidl::endpoints::ControlHandle for MessagePortControlHandle {
7978    fn shutdown(&self) {
7979        self.inner.shutdown()
7980    }
7981
7982    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7983        self.inner.shutdown_with_epitaph(status)
7984    }
7985
7986    fn is_closed(&self) -> bool {
7987        self.inner.channel().is_closed()
7988    }
7989    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7990        self.inner.channel().on_closed()
7991    }
7992
7993    #[cfg(target_os = "fuchsia")]
7994    fn signal_peer(
7995        &self,
7996        clear_mask: zx::Signals,
7997        set_mask: zx::Signals,
7998    ) -> Result<(), zx_status::Status> {
7999        use fidl::Peered;
8000        self.inner.channel().signal_peer(clear_mask, set_mask)
8001    }
8002}
8003
8004impl MessagePortControlHandle {}
8005
8006#[must_use = "FIDL methods require a response to be sent"]
8007#[derive(Debug)]
8008pub struct MessagePortPostMessageResponder {
8009    control_handle: std::mem::ManuallyDrop<MessagePortControlHandle>,
8010    tx_id: u32,
8011}
8012
8013/// Set the the channel to be shutdown (see [`MessagePortControlHandle::shutdown`])
8014/// if the responder is dropped without sending a response, so that the client
8015/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8016impl std::ops::Drop for MessagePortPostMessageResponder {
8017    fn drop(&mut self) {
8018        self.control_handle.shutdown();
8019        // Safety: drops once, never accessed again
8020        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8021    }
8022}
8023
8024impl fidl::endpoints::Responder for MessagePortPostMessageResponder {
8025    type ControlHandle = MessagePortControlHandle;
8026
8027    fn control_handle(&self) -> &MessagePortControlHandle {
8028        &self.control_handle
8029    }
8030
8031    fn drop_without_shutdown(mut self) {
8032        // Safety: drops once, never accessed again due to mem::forget
8033        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8034        // Prevent Drop from running (which would shut down the channel)
8035        std::mem::forget(self);
8036    }
8037}
8038
8039impl MessagePortPostMessageResponder {
8040    /// Sends a response to the FIDL transaction.
8041    ///
8042    /// Sets the channel to shutdown if an error occurs.
8043    pub fn send(self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
8044        let _result = self.send_raw(result);
8045        if _result.is_err() {
8046            self.control_handle.shutdown();
8047        }
8048        self.drop_without_shutdown();
8049        _result
8050    }
8051
8052    /// Similar to "send" but does not shutdown the channel if an error occurs.
8053    pub fn send_no_shutdown_on_err(
8054        self,
8055        mut result: Result<(), FrameError>,
8056    ) -> Result<(), fidl::Error> {
8057        let _result = self.send_raw(result);
8058        self.drop_without_shutdown();
8059        _result
8060    }
8061
8062    fn send_raw(&self, mut result: Result<(), FrameError>) -> Result<(), fidl::Error> {
8063        self.control_handle
8064            .inner
8065            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, FrameError>>(
8066                result,
8067                self.tx_id,
8068                0x2bcf0a6ed30ffd1f,
8069                fidl::encoding::DynamicFlags::empty(),
8070            )
8071    }
8072}
8073
8074#[must_use = "FIDL methods require a response to be sent"]
8075#[derive(Debug)]
8076pub struct MessagePortReceiveMessageResponder {
8077    control_handle: std::mem::ManuallyDrop<MessagePortControlHandle>,
8078    tx_id: u32,
8079}
8080
8081/// Set the the channel to be shutdown (see [`MessagePortControlHandle::shutdown`])
8082/// if the responder is dropped without sending a response, so that the client
8083/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8084impl std::ops::Drop for MessagePortReceiveMessageResponder {
8085    fn drop(&mut self) {
8086        self.control_handle.shutdown();
8087        // Safety: drops once, never accessed again
8088        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8089    }
8090}
8091
8092impl fidl::endpoints::Responder for MessagePortReceiveMessageResponder {
8093    type ControlHandle = MessagePortControlHandle;
8094
8095    fn control_handle(&self) -> &MessagePortControlHandle {
8096        &self.control_handle
8097    }
8098
8099    fn drop_without_shutdown(mut self) {
8100        // Safety: drops once, never accessed again due to mem::forget
8101        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8102        // Prevent Drop from running (which would shut down the channel)
8103        std::mem::forget(self);
8104    }
8105}
8106
8107impl MessagePortReceiveMessageResponder {
8108    /// Sends a response to the FIDL transaction.
8109    ///
8110    /// Sets the channel to shutdown if an error occurs.
8111    pub fn send(self, mut message: WebMessage) -> Result<(), fidl::Error> {
8112        let _result = self.send_raw(message);
8113        if _result.is_err() {
8114            self.control_handle.shutdown();
8115        }
8116        self.drop_without_shutdown();
8117        _result
8118    }
8119
8120    /// Similar to "send" but does not shutdown the channel if an error occurs.
8121    pub fn send_no_shutdown_on_err(self, mut message: WebMessage) -> Result<(), fidl::Error> {
8122        let _result = self.send_raw(message);
8123        self.drop_without_shutdown();
8124        _result
8125    }
8126
8127    fn send_raw(&self, mut message: WebMessage) -> Result<(), fidl::Error> {
8128        self.control_handle.inner.send::<MessagePortReceiveMessageResponse>(
8129            (&mut message,),
8130            self.tx_id,
8131            0x6c8a6051690be58d,
8132            fidl::encoding::DynamicFlags::empty(),
8133        )
8134    }
8135}
8136
8137#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8138pub struct NavigationControllerMarker;
8139
8140impl fidl::endpoints::ProtocolMarker for NavigationControllerMarker {
8141    type Proxy = NavigationControllerProxy;
8142    type RequestStream = NavigationControllerRequestStream;
8143    #[cfg(target_os = "fuchsia")]
8144    type SynchronousProxy = NavigationControllerSynchronousProxy;
8145
8146    const DEBUG_NAME: &'static str = "(anonymous) NavigationController";
8147}
8148pub type NavigationControllerLoadUrlResult = Result<(), NavigationControllerError>;
8149
8150pub trait NavigationControllerProxyInterface: Send + Sync {
8151    type LoadUrlResponseFut: std::future::Future<Output = Result<NavigationControllerLoadUrlResult, fidl::Error>>
8152        + Send;
8153    fn r#load_url(&self, url: &str, params: LoadUrlParams) -> Self::LoadUrlResponseFut;
8154    fn r#go_back(&self) -> Result<(), fidl::Error>;
8155    fn r#go_forward(&self) -> Result<(), fidl::Error>;
8156    fn r#stop(&self) -> Result<(), fidl::Error>;
8157    fn r#reload(&self, type_: ReloadType) -> Result<(), fidl::Error>;
8158}
8159#[derive(Debug)]
8160#[cfg(target_os = "fuchsia")]
8161pub struct NavigationControllerSynchronousProxy {
8162    client: fidl::client::sync::Client,
8163}
8164
8165#[cfg(target_os = "fuchsia")]
8166impl fidl::endpoints::SynchronousProxy for NavigationControllerSynchronousProxy {
8167    type Proxy = NavigationControllerProxy;
8168    type Protocol = NavigationControllerMarker;
8169
8170    fn from_channel(inner: fidl::Channel) -> Self {
8171        Self::new(inner)
8172    }
8173
8174    fn into_channel(self) -> fidl::Channel {
8175        self.client.into_channel()
8176    }
8177
8178    fn as_channel(&self) -> &fidl::Channel {
8179        self.client.as_channel()
8180    }
8181}
8182
8183#[cfg(target_os = "fuchsia")]
8184impl NavigationControllerSynchronousProxy {
8185    pub fn new(channel: fidl::Channel) -> Self {
8186        let protocol_name =
8187            <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8188        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8189    }
8190
8191    pub fn into_channel(self) -> fidl::Channel {
8192        self.client.into_channel()
8193    }
8194
8195    /// Waits until an event arrives and returns it. It is safe for other
8196    /// threads to make concurrent requests while waiting for an event.
8197    pub fn wait_for_event(
8198        &self,
8199        deadline: zx::MonotonicInstant,
8200    ) -> Result<NavigationControllerEvent, fidl::Error> {
8201        NavigationControllerEvent::decode(self.client.wait_for_event(deadline)?)
8202    }
8203
8204    /// Tells the [`Frame`] to navigate to a `url`.
8205    ///
8206    /// - `url`: The address to navigate to.
8207    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8208    ///   cookies, HTTP headers, etc.)
8209    ///
8210    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8211    /// - `INVALID_URL`: The `url` parameter is invalid.
8212    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8213    pub fn r#load_url(
8214        &self,
8215        mut url: &str,
8216        mut params: LoadUrlParams,
8217        ___deadline: zx::MonotonicInstant,
8218    ) -> Result<NavigationControllerLoadUrlResult, fidl::Error> {
8219        let _response =
8220            self.client
8221                .send_query::<NavigationControllerLoadUrlRequest, fidl::encoding::ResultType<
8222                    fidl::encoding::EmptyStruct,
8223                    NavigationControllerError,
8224                >>(
8225                    (url, &mut params),
8226                    0x78f2ab0a480d0182,
8227                    fidl::encoding::DynamicFlags::empty(),
8228                    ___deadline,
8229                )?;
8230        Ok(_response.map(|x| x))
8231    }
8232
8233    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8234    pub fn r#go_back(&self) -> Result<(), fidl::Error> {
8235        self.client.send::<fidl::encoding::EmptyPayload>(
8236            (),
8237            0x2accdd8d87d89c38,
8238            fidl::encoding::DynamicFlags::empty(),
8239        )
8240    }
8241
8242    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8243    pub fn r#go_forward(&self) -> Result<(), fidl::Error> {
8244        self.client.send::<fidl::encoding::EmptyPayload>(
8245            (),
8246            0x39e4ac955ade2781,
8247            fidl::encoding::DynamicFlags::empty(),
8248        )
8249    }
8250
8251    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8252    pub fn r#stop(&self) -> Result<(), fidl::Error> {
8253        self.client.send::<fidl::encoding::EmptyPayload>(
8254            (),
8255            0x2383078ffbe6fea,
8256            fidl::encoding::DynamicFlags::empty(),
8257        )
8258    }
8259
8260    /// Tells the [`Frame`] to reload the current page.
8261    pub fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8262        self.client.send::<NavigationControllerReloadRequest>(
8263            (type_,),
8264            0x33faedfe67d6f00,
8265            fidl::encoding::DynamicFlags::empty(),
8266        )
8267    }
8268}
8269
8270#[cfg(target_os = "fuchsia")]
8271impl From<NavigationControllerSynchronousProxy> for zx::NullableHandle {
8272    fn from(value: NavigationControllerSynchronousProxy) -> Self {
8273        value.into_channel().into()
8274    }
8275}
8276
8277#[cfg(target_os = "fuchsia")]
8278impl From<fidl::Channel> for NavigationControllerSynchronousProxy {
8279    fn from(value: fidl::Channel) -> Self {
8280        Self::new(value)
8281    }
8282}
8283
8284#[cfg(target_os = "fuchsia")]
8285impl fidl::endpoints::FromClient for NavigationControllerSynchronousProxy {
8286    type Protocol = NavigationControllerMarker;
8287
8288    fn from_client(value: fidl::endpoints::ClientEnd<NavigationControllerMarker>) -> Self {
8289        Self::new(value.into_channel())
8290    }
8291}
8292
8293#[derive(Debug, Clone)]
8294pub struct NavigationControllerProxy {
8295    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8296}
8297
8298impl fidl::endpoints::Proxy for NavigationControllerProxy {
8299    type Protocol = NavigationControllerMarker;
8300
8301    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8302        Self::new(inner)
8303    }
8304
8305    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8306        self.client.into_channel().map_err(|client| Self { client })
8307    }
8308
8309    fn as_channel(&self) -> &::fidl::AsyncChannel {
8310        self.client.as_channel()
8311    }
8312}
8313
8314impl NavigationControllerProxy {
8315    /// Create a new Proxy for fuchsia.web/NavigationController.
8316    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8317        let protocol_name =
8318            <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8319        Self { client: fidl::client::Client::new(channel, protocol_name) }
8320    }
8321
8322    /// Get a Stream of events from the remote end of the protocol.
8323    ///
8324    /// # Panics
8325    ///
8326    /// Panics if the event stream was already taken.
8327    pub fn take_event_stream(&self) -> NavigationControllerEventStream {
8328        NavigationControllerEventStream { event_receiver: self.client.take_event_receiver() }
8329    }
8330
8331    /// Tells the [`Frame`] to navigate to a `url`.
8332    ///
8333    /// - `url`: The address to navigate to.
8334    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8335    ///   cookies, HTTP headers, etc.)
8336    ///
8337    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8338    /// - `INVALID_URL`: The `url` parameter is invalid.
8339    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8340    pub fn r#load_url(
8341        &self,
8342        mut url: &str,
8343        mut params: LoadUrlParams,
8344    ) -> fidl::client::QueryResponseFut<
8345        NavigationControllerLoadUrlResult,
8346        fidl::encoding::DefaultFuchsiaResourceDialect,
8347    > {
8348        NavigationControllerProxyInterface::r#load_url(self, url, params)
8349    }
8350
8351    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8352    pub fn r#go_back(&self) -> Result<(), fidl::Error> {
8353        NavigationControllerProxyInterface::r#go_back(self)
8354    }
8355
8356    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8357    pub fn r#go_forward(&self) -> Result<(), fidl::Error> {
8358        NavigationControllerProxyInterface::r#go_forward(self)
8359    }
8360
8361    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8362    pub fn r#stop(&self) -> Result<(), fidl::Error> {
8363        NavigationControllerProxyInterface::r#stop(self)
8364    }
8365
8366    /// Tells the [`Frame`] to reload the current page.
8367    pub fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8368        NavigationControllerProxyInterface::r#reload(self, type_)
8369    }
8370}
8371
8372impl NavigationControllerProxyInterface for NavigationControllerProxy {
8373    type LoadUrlResponseFut = fidl::client::QueryResponseFut<
8374        NavigationControllerLoadUrlResult,
8375        fidl::encoding::DefaultFuchsiaResourceDialect,
8376    >;
8377    fn r#load_url(&self, mut url: &str, mut params: LoadUrlParams) -> Self::LoadUrlResponseFut {
8378        fn _decode(
8379            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8380        ) -> Result<NavigationControllerLoadUrlResult, fidl::Error> {
8381            let _response = fidl::client::decode_transaction_body::<
8382                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NavigationControllerError>,
8383                fidl::encoding::DefaultFuchsiaResourceDialect,
8384                0x78f2ab0a480d0182,
8385            >(_buf?)?;
8386            Ok(_response.map(|x| x))
8387        }
8388        self.client.send_query_and_decode::<
8389            NavigationControllerLoadUrlRequest,
8390            NavigationControllerLoadUrlResult,
8391        >(
8392            (url, &mut params,),
8393            0x78f2ab0a480d0182,
8394            fidl::encoding::DynamicFlags::empty(),
8395            _decode,
8396        )
8397    }
8398
8399    fn r#go_back(&self) -> Result<(), fidl::Error> {
8400        self.client.send::<fidl::encoding::EmptyPayload>(
8401            (),
8402            0x2accdd8d87d89c38,
8403            fidl::encoding::DynamicFlags::empty(),
8404        )
8405    }
8406
8407    fn r#go_forward(&self) -> Result<(), fidl::Error> {
8408        self.client.send::<fidl::encoding::EmptyPayload>(
8409            (),
8410            0x39e4ac955ade2781,
8411            fidl::encoding::DynamicFlags::empty(),
8412        )
8413    }
8414
8415    fn r#stop(&self) -> Result<(), fidl::Error> {
8416        self.client.send::<fidl::encoding::EmptyPayload>(
8417            (),
8418            0x2383078ffbe6fea,
8419            fidl::encoding::DynamicFlags::empty(),
8420        )
8421    }
8422
8423    fn r#reload(&self, mut type_: ReloadType) -> Result<(), fidl::Error> {
8424        self.client.send::<NavigationControllerReloadRequest>(
8425            (type_,),
8426            0x33faedfe67d6f00,
8427            fidl::encoding::DynamicFlags::empty(),
8428        )
8429    }
8430}
8431
8432pub struct NavigationControllerEventStream {
8433    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8434}
8435
8436impl std::marker::Unpin for NavigationControllerEventStream {}
8437
8438impl futures::stream::FusedStream for NavigationControllerEventStream {
8439    fn is_terminated(&self) -> bool {
8440        self.event_receiver.is_terminated()
8441    }
8442}
8443
8444impl futures::Stream for NavigationControllerEventStream {
8445    type Item = Result<NavigationControllerEvent, fidl::Error>;
8446
8447    fn poll_next(
8448        mut self: std::pin::Pin<&mut Self>,
8449        cx: &mut std::task::Context<'_>,
8450    ) -> std::task::Poll<Option<Self::Item>> {
8451        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8452            &mut self.event_receiver,
8453            cx
8454        )?) {
8455            Some(buf) => std::task::Poll::Ready(Some(NavigationControllerEvent::decode(buf))),
8456            None => std::task::Poll::Ready(None),
8457        }
8458    }
8459}
8460
8461#[derive(Debug)]
8462pub enum NavigationControllerEvent {}
8463
8464impl NavigationControllerEvent {
8465    /// Decodes a message buffer as a [`NavigationControllerEvent`].
8466    fn decode(
8467        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8468    ) -> Result<NavigationControllerEvent, fidl::Error> {
8469        let (bytes, _handles) = buf.split_mut();
8470        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8471        debug_assert_eq!(tx_header.tx_id, 0);
8472        match tx_header.ordinal {
8473            _ => Err(fidl::Error::UnknownOrdinal {
8474                ordinal: tx_header.ordinal,
8475                protocol_name:
8476                    <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8477            }),
8478        }
8479    }
8480}
8481
8482/// A Stream of incoming requests for fuchsia.web/NavigationController.
8483pub struct NavigationControllerRequestStream {
8484    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8485    is_terminated: bool,
8486}
8487
8488impl std::marker::Unpin for NavigationControllerRequestStream {}
8489
8490impl futures::stream::FusedStream for NavigationControllerRequestStream {
8491    fn is_terminated(&self) -> bool {
8492        self.is_terminated
8493    }
8494}
8495
8496impl fidl::endpoints::RequestStream for NavigationControllerRequestStream {
8497    type Protocol = NavigationControllerMarker;
8498    type ControlHandle = NavigationControllerControlHandle;
8499
8500    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8501        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8502    }
8503
8504    fn control_handle(&self) -> Self::ControlHandle {
8505        NavigationControllerControlHandle { inner: self.inner.clone() }
8506    }
8507
8508    fn into_inner(
8509        self,
8510    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8511    {
8512        (self.inner, self.is_terminated)
8513    }
8514
8515    fn from_inner(
8516        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8517        is_terminated: bool,
8518    ) -> Self {
8519        Self { inner, is_terminated }
8520    }
8521}
8522
8523impl futures::Stream for NavigationControllerRequestStream {
8524    type Item = Result<NavigationControllerRequest, fidl::Error>;
8525
8526    fn poll_next(
8527        mut self: std::pin::Pin<&mut Self>,
8528        cx: &mut std::task::Context<'_>,
8529    ) -> std::task::Poll<Option<Self::Item>> {
8530        let this = &mut *self;
8531        if this.inner.check_shutdown(cx) {
8532            this.is_terminated = true;
8533            return std::task::Poll::Ready(None);
8534        }
8535        if this.is_terminated {
8536            panic!("polled NavigationControllerRequestStream after completion");
8537        }
8538        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8539            |bytes, handles| {
8540                match this.inner.channel().read_etc(cx, bytes, handles) {
8541                    std::task::Poll::Ready(Ok(())) => {}
8542                    std::task::Poll::Pending => return std::task::Poll::Pending,
8543                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8544                        this.is_terminated = true;
8545                        return std::task::Poll::Ready(None);
8546                    }
8547                    std::task::Poll::Ready(Err(e)) => {
8548                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8549                            e.into(),
8550                        ))));
8551                    }
8552                }
8553
8554                // A message has been received from the channel
8555                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8556
8557                std::task::Poll::Ready(Some(match header.ordinal {
8558                0x78f2ab0a480d0182 => {
8559                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8560                    let mut req = fidl::new_empty!(NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8561                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationControllerLoadUrlRequest>(&header, _body_bytes, handles, &mut req)?;
8562                    let control_handle = NavigationControllerControlHandle {
8563                        inner: this.inner.clone(),
8564                    };
8565                    Ok(NavigationControllerRequest::LoadUrl {url: req.url,
8566params: req.params,
8567
8568                        responder: NavigationControllerLoadUrlResponder {
8569                            control_handle: std::mem::ManuallyDrop::new(control_handle),
8570                            tx_id: header.tx_id,
8571                        },
8572                    })
8573                }
8574                0x2accdd8d87d89c38 => {
8575                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8576                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8577                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8578                    let control_handle = NavigationControllerControlHandle {
8579                        inner: this.inner.clone(),
8580                    };
8581                    Ok(NavigationControllerRequest::GoBack {
8582                        control_handle,
8583                    })
8584                }
8585                0x39e4ac955ade2781 => {
8586                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8587                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8588                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8589                    let control_handle = NavigationControllerControlHandle {
8590                        inner: this.inner.clone(),
8591                    };
8592                    Ok(NavigationControllerRequest::GoForward {
8593                        control_handle,
8594                    })
8595                }
8596                0x2383078ffbe6fea => {
8597                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8598                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
8599                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8600                    let control_handle = NavigationControllerControlHandle {
8601                        inner: this.inner.clone(),
8602                    };
8603                    Ok(NavigationControllerRequest::Stop {
8604                        control_handle,
8605                    })
8606                }
8607                0x33faedfe67d6f00 => {
8608                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8609                    let mut req = fidl::new_empty!(NavigationControllerReloadRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
8610                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationControllerReloadRequest>(&header, _body_bytes, handles, &mut req)?;
8611                    let control_handle = NavigationControllerControlHandle {
8612                        inner: this.inner.clone(),
8613                    };
8614                    Ok(NavigationControllerRequest::Reload {type_: req.type_,
8615
8616                        control_handle,
8617                    })
8618                }
8619                _ => Err(fidl::Error::UnknownOrdinal {
8620                    ordinal: header.ordinal,
8621                    protocol_name: <NavigationControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8622                }),
8623            }))
8624            },
8625        )
8626    }
8627}
8628
8629/// Provides methods for controlling and querying the navigation state of a [`Frame`].
8630#[derive(Debug)]
8631pub enum NavigationControllerRequest {
8632    /// Tells the [`Frame`] to navigate to a `url`.
8633    ///
8634    /// - `url`: The address to navigate to.
8635    /// - `params`: Additional parameters that affect how the resource will be  loaded (e.g.
8636    ///   cookies, HTTP headers, etc.)
8637    ///
8638    /// If an error occurred, the [`NavigationControllerError`] will be set to one of these values:
8639    /// - `INVALID_URL`: The `url` parameter is invalid.
8640    /// - `INVALID_HEADER`: At least one of the headers in [`LoadUrlParams.headers`] is invalid.
8641    LoadUrl { url: String, params: LoadUrlParams, responder: NavigationControllerLoadUrlResponder },
8642    /// Tells the [`Frame`] to navigate to the previous page in its history, if any.
8643    GoBack { control_handle: NavigationControllerControlHandle },
8644    /// Tells the [`Frame`] to navigate to the next page in its history, if any.
8645    GoForward { control_handle: NavigationControllerControlHandle },
8646    /// Tells the [`Frame`] to stop the current navigation if a navigation is ongoing.
8647    Stop { control_handle: NavigationControllerControlHandle },
8648    /// Tells the [`Frame`] to reload the current page.
8649    Reload { type_: ReloadType, control_handle: NavigationControllerControlHandle },
8650}
8651
8652impl NavigationControllerRequest {
8653    #[allow(irrefutable_let_patterns)]
8654    pub fn into_load_url(
8655        self,
8656    ) -> Option<(String, LoadUrlParams, NavigationControllerLoadUrlResponder)> {
8657        if let NavigationControllerRequest::LoadUrl { url, params, responder } = self {
8658            Some((url, params, responder))
8659        } else {
8660            None
8661        }
8662    }
8663
8664    #[allow(irrefutable_let_patterns)]
8665    pub fn into_go_back(self) -> Option<(NavigationControllerControlHandle)> {
8666        if let NavigationControllerRequest::GoBack { control_handle } = self {
8667            Some((control_handle))
8668        } else {
8669            None
8670        }
8671    }
8672
8673    #[allow(irrefutable_let_patterns)]
8674    pub fn into_go_forward(self) -> Option<(NavigationControllerControlHandle)> {
8675        if let NavigationControllerRequest::GoForward { control_handle } = self {
8676            Some((control_handle))
8677        } else {
8678            None
8679        }
8680    }
8681
8682    #[allow(irrefutable_let_patterns)]
8683    pub fn into_stop(self) -> Option<(NavigationControllerControlHandle)> {
8684        if let NavigationControllerRequest::Stop { control_handle } = self {
8685            Some((control_handle))
8686        } else {
8687            None
8688        }
8689    }
8690
8691    #[allow(irrefutable_let_patterns)]
8692    pub fn into_reload(self) -> Option<(ReloadType, NavigationControllerControlHandle)> {
8693        if let NavigationControllerRequest::Reload { type_, control_handle } = self {
8694            Some((type_, control_handle))
8695        } else {
8696            None
8697        }
8698    }
8699
8700    /// Name of the method defined in FIDL
8701    pub fn method_name(&self) -> &'static str {
8702        match *self {
8703            NavigationControllerRequest::LoadUrl { .. } => "load_url",
8704            NavigationControllerRequest::GoBack { .. } => "go_back",
8705            NavigationControllerRequest::GoForward { .. } => "go_forward",
8706            NavigationControllerRequest::Stop { .. } => "stop",
8707            NavigationControllerRequest::Reload { .. } => "reload",
8708        }
8709    }
8710}
8711
8712#[derive(Debug, Clone)]
8713pub struct NavigationControllerControlHandle {
8714    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8715}
8716
8717impl fidl::endpoints::ControlHandle for NavigationControllerControlHandle {
8718    fn shutdown(&self) {
8719        self.inner.shutdown()
8720    }
8721
8722    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8723        self.inner.shutdown_with_epitaph(status)
8724    }
8725
8726    fn is_closed(&self) -> bool {
8727        self.inner.channel().is_closed()
8728    }
8729    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8730        self.inner.channel().on_closed()
8731    }
8732
8733    #[cfg(target_os = "fuchsia")]
8734    fn signal_peer(
8735        &self,
8736        clear_mask: zx::Signals,
8737        set_mask: zx::Signals,
8738    ) -> Result<(), zx_status::Status> {
8739        use fidl::Peered;
8740        self.inner.channel().signal_peer(clear_mask, set_mask)
8741    }
8742}
8743
8744impl NavigationControllerControlHandle {}
8745
8746#[must_use = "FIDL methods require a response to be sent"]
8747#[derive(Debug)]
8748pub struct NavigationControllerLoadUrlResponder {
8749    control_handle: std::mem::ManuallyDrop<NavigationControllerControlHandle>,
8750    tx_id: u32,
8751}
8752
8753/// Set the the channel to be shutdown (see [`NavigationControllerControlHandle::shutdown`])
8754/// if the responder is dropped without sending a response, so that the client
8755/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8756impl std::ops::Drop for NavigationControllerLoadUrlResponder {
8757    fn drop(&mut self) {
8758        self.control_handle.shutdown();
8759        // Safety: drops once, never accessed again
8760        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8761    }
8762}
8763
8764impl fidl::endpoints::Responder for NavigationControllerLoadUrlResponder {
8765    type ControlHandle = NavigationControllerControlHandle;
8766
8767    fn control_handle(&self) -> &NavigationControllerControlHandle {
8768        &self.control_handle
8769    }
8770
8771    fn drop_without_shutdown(mut self) {
8772        // Safety: drops once, never accessed again due to mem::forget
8773        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8774        // Prevent Drop from running (which would shut down the channel)
8775        std::mem::forget(self);
8776    }
8777}
8778
8779impl NavigationControllerLoadUrlResponder {
8780    /// Sends a response to the FIDL transaction.
8781    ///
8782    /// Sets the channel to shutdown if an error occurs.
8783    pub fn send(
8784        self,
8785        mut result: Result<(), NavigationControllerError>,
8786    ) -> Result<(), fidl::Error> {
8787        let _result = self.send_raw(result);
8788        if _result.is_err() {
8789            self.control_handle.shutdown();
8790        }
8791        self.drop_without_shutdown();
8792        _result
8793    }
8794
8795    /// Similar to "send" but does not shutdown the channel if an error occurs.
8796    pub fn send_no_shutdown_on_err(
8797        self,
8798        mut result: Result<(), NavigationControllerError>,
8799    ) -> Result<(), fidl::Error> {
8800        let _result = self.send_raw(result);
8801        self.drop_without_shutdown();
8802        _result
8803    }
8804
8805    fn send_raw(
8806        &self,
8807        mut result: Result<(), NavigationControllerError>,
8808    ) -> Result<(), fidl::Error> {
8809        self.control_handle.inner.send::<fidl::encoding::ResultType<
8810            fidl::encoding::EmptyStruct,
8811            NavigationControllerError,
8812        >>(
8813            result,
8814            self.tx_id,
8815            0x78f2ab0a480d0182,
8816            fidl::encoding::DynamicFlags::empty(),
8817        )
8818    }
8819}
8820
8821#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8822pub struct NavigationEventListenerMarker;
8823
8824impl fidl::endpoints::ProtocolMarker for NavigationEventListenerMarker {
8825    type Proxy = NavigationEventListenerProxy;
8826    type RequestStream = NavigationEventListenerRequestStream;
8827    #[cfg(target_os = "fuchsia")]
8828    type SynchronousProxy = NavigationEventListenerSynchronousProxy;
8829
8830    const DEBUG_NAME: &'static str = "(anonymous) NavigationEventListener";
8831}
8832
8833pub trait NavigationEventListenerProxyInterface: Send + Sync {
8834    type OnNavigationStateChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
8835        + Send;
8836    fn r#on_navigation_state_changed(
8837        &self,
8838        change: NavigationState,
8839    ) -> Self::OnNavigationStateChangedResponseFut;
8840}
8841#[derive(Debug)]
8842#[cfg(target_os = "fuchsia")]
8843pub struct NavigationEventListenerSynchronousProxy {
8844    client: fidl::client::sync::Client,
8845}
8846
8847#[cfg(target_os = "fuchsia")]
8848impl fidl::endpoints::SynchronousProxy for NavigationEventListenerSynchronousProxy {
8849    type Proxy = NavigationEventListenerProxy;
8850    type Protocol = NavigationEventListenerMarker;
8851
8852    fn from_channel(inner: fidl::Channel) -> Self {
8853        Self::new(inner)
8854    }
8855
8856    fn into_channel(self) -> fidl::Channel {
8857        self.client.into_channel()
8858    }
8859
8860    fn as_channel(&self) -> &fidl::Channel {
8861        self.client.as_channel()
8862    }
8863}
8864
8865#[cfg(target_os = "fuchsia")]
8866impl NavigationEventListenerSynchronousProxy {
8867    pub fn new(channel: fidl::Channel) -> Self {
8868        let protocol_name =
8869            <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8870        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8871    }
8872
8873    pub fn into_channel(self) -> fidl::Channel {
8874        self.client.into_channel()
8875    }
8876
8877    /// Waits until an event arrives and returns it. It is safe for other
8878    /// threads to make concurrent requests while waiting for an event.
8879    pub fn wait_for_event(
8880        &self,
8881        deadline: zx::MonotonicInstant,
8882    ) -> Result<NavigationEventListenerEvent, fidl::Error> {
8883        NavigationEventListenerEvent::decode(self.client.wait_for_event(deadline)?)
8884    }
8885
8886    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
8887    /// navigation state has changed. In the first call, `change` contains the current navigation
8888    /// state (empty before the first navigation request). In every following call, `change` will
8889    /// have values set for all fields that have changed at any time since the previous
8890    /// notification. This means that some fields may have the same value as was previously
8891    /// reported, for example, if they changed to some other value and back again. If a field is
8892    /// unset, then its value has not changed at any time since the previous notification.
8893    ///
8894    /// Implementer must call the acknowledgement callback to receive new navigation events.
8895    pub fn r#on_navigation_state_changed(
8896        &self,
8897        mut change: NavigationState,
8898        ___deadline: zx::MonotonicInstant,
8899    ) -> Result<(), fidl::Error> {
8900        let _response = self.client.send_query::<
8901            NavigationEventListenerOnNavigationStateChangedRequest,
8902            fidl::encoding::EmptyPayload,
8903        >(
8904            (&mut change,),
8905            0x453ac6bcbc82fbb6,
8906            fidl::encoding::DynamicFlags::empty(),
8907            ___deadline,
8908        )?;
8909        Ok(_response)
8910    }
8911}
8912
8913#[cfg(target_os = "fuchsia")]
8914impl From<NavigationEventListenerSynchronousProxy> for zx::NullableHandle {
8915    fn from(value: NavigationEventListenerSynchronousProxy) -> Self {
8916        value.into_channel().into()
8917    }
8918}
8919
8920#[cfg(target_os = "fuchsia")]
8921impl From<fidl::Channel> for NavigationEventListenerSynchronousProxy {
8922    fn from(value: fidl::Channel) -> Self {
8923        Self::new(value)
8924    }
8925}
8926
8927#[cfg(target_os = "fuchsia")]
8928impl fidl::endpoints::FromClient for NavigationEventListenerSynchronousProxy {
8929    type Protocol = NavigationEventListenerMarker;
8930
8931    fn from_client(value: fidl::endpoints::ClientEnd<NavigationEventListenerMarker>) -> Self {
8932        Self::new(value.into_channel())
8933    }
8934}
8935
8936#[derive(Debug, Clone)]
8937pub struct NavigationEventListenerProxy {
8938    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8939}
8940
8941impl fidl::endpoints::Proxy for NavigationEventListenerProxy {
8942    type Protocol = NavigationEventListenerMarker;
8943
8944    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8945        Self::new(inner)
8946    }
8947
8948    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8949        self.client.into_channel().map_err(|client| Self { client })
8950    }
8951
8952    fn as_channel(&self) -> &::fidl::AsyncChannel {
8953        self.client.as_channel()
8954    }
8955}
8956
8957impl NavigationEventListenerProxy {
8958    /// Create a new Proxy for fuchsia.web/NavigationEventListener.
8959    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8960        let protocol_name =
8961            <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8962        Self { client: fidl::client::Client::new(channel, protocol_name) }
8963    }
8964
8965    /// Get a Stream of events from the remote end of the protocol.
8966    ///
8967    /// # Panics
8968    ///
8969    /// Panics if the event stream was already taken.
8970    pub fn take_event_stream(&self) -> NavigationEventListenerEventStream {
8971        NavigationEventListenerEventStream { event_receiver: self.client.take_event_receiver() }
8972    }
8973
8974    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
8975    /// navigation state has changed. In the first call, `change` contains the current navigation
8976    /// state (empty before the first navigation request). In every following call, `change` will
8977    /// have values set for all fields that have changed at any time since the previous
8978    /// notification. This means that some fields may have the same value as was previously
8979    /// reported, for example, if they changed to some other value and back again. If a field is
8980    /// unset, then its value has not changed at any time since the previous notification.
8981    ///
8982    /// Implementer must call the acknowledgement callback to receive new navigation events.
8983    pub fn r#on_navigation_state_changed(
8984        &self,
8985        mut change: NavigationState,
8986    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8987        NavigationEventListenerProxyInterface::r#on_navigation_state_changed(self, change)
8988    }
8989}
8990
8991impl NavigationEventListenerProxyInterface for NavigationEventListenerProxy {
8992    type OnNavigationStateChangedResponseFut =
8993        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8994    fn r#on_navigation_state_changed(
8995        &self,
8996        mut change: NavigationState,
8997    ) -> Self::OnNavigationStateChangedResponseFut {
8998        fn _decode(
8999            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9000        ) -> Result<(), fidl::Error> {
9001            let _response = fidl::client::decode_transaction_body::<
9002                fidl::encoding::EmptyPayload,
9003                fidl::encoding::DefaultFuchsiaResourceDialect,
9004                0x453ac6bcbc82fbb6,
9005            >(_buf?)?;
9006            Ok(_response)
9007        }
9008        self.client
9009            .send_query_and_decode::<NavigationEventListenerOnNavigationStateChangedRequest, ()>(
9010                (&mut change,),
9011                0x453ac6bcbc82fbb6,
9012                fidl::encoding::DynamicFlags::empty(),
9013                _decode,
9014            )
9015    }
9016}
9017
9018pub struct NavigationEventListenerEventStream {
9019    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9020}
9021
9022impl std::marker::Unpin for NavigationEventListenerEventStream {}
9023
9024impl futures::stream::FusedStream for NavigationEventListenerEventStream {
9025    fn is_terminated(&self) -> bool {
9026        self.event_receiver.is_terminated()
9027    }
9028}
9029
9030impl futures::Stream for NavigationEventListenerEventStream {
9031    type Item = Result<NavigationEventListenerEvent, fidl::Error>;
9032
9033    fn poll_next(
9034        mut self: std::pin::Pin<&mut Self>,
9035        cx: &mut std::task::Context<'_>,
9036    ) -> std::task::Poll<Option<Self::Item>> {
9037        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9038            &mut self.event_receiver,
9039            cx
9040        )?) {
9041            Some(buf) => std::task::Poll::Ready(Some(NavigationEventListenerEvent::decode(buf))),
9042            None => std::task::Poll::Ready(None),
9043        }
9044    }
9045}
9046
9047#[derive(Debug)]
9048pub enum NavigationEventListenerEvent {}
9049
9050impl NavigationEventListenerEvent {
9051    /// Decodes a message buffer as a [`NavigationEventListenerEvent`].
9052    fn decode(
9053        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9054    ) -> Result<NavigationEventListenerEvent, fidl::Error> {
9055        let (bytes, _handles) = buf.split_mut();
9056        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9057        debug_assert_eq!(tx_header.tx_id, 0);
9058        match tx_header.ordinal {
9059            _ => Err(fidl::Error::UnknownOrdinal {
9060                ordinal: tx_header.ordinal,
9061                protocol_name:
9062                    <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9063            }),
9064        }
9065    }
9066}
9067
9068/// A Stream of incoming requests for fuchsia.web/NavigationEventListener.
9069pub struct NavigationEventListenerRequestStream {
9070    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9071    is_terminated: bool,
9072}
9073
9074impl std::marker::Unpin for NavigationEventListenerRequestStream {}
9075
9076impl futures::stream::FusedStream for NavigationEventListenerRequestStream {
9077    fn is_terminated(&self) -> bool {
9078        self.is_terminated
9079    }
9080}
9081
9082impl fidl::endpoints::RequestStream for NavigationEventListenerRequestStream {
9083    type Protocol = NavigationEventListenerMarker;
9084    type ControlHandle = NavigationEventListenerControlHandle;
9085
9086    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9087        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9088    }
9089
9090    fn control_handle(&self) -> Self::ControlHandle {
9091        NavigationEventListenerControlHandle { inner: self.inner.clone() }
9092    }
9093
9094    fn into_inner(
9095        self,
9096    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9097    {
9098        (self.inner, self.is_terminated)
9099    }
9100
9101    fn from_inner(
9102        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9103        is_terminated: bool,
9104    ) -> Self {
9105        Self { inner, is_terminated }
9106    }
9107}
9108
9109impl futures::Stream for NavigationEventListenerRequestStream {
9110    type Item = Result<NavigationEventListenerRequest, fidl::Error>;
9111
9112    fn poll_next(
9113        mut self: std::pin::Pin<&mut Self>,
9114        cx: &mut std::task::Context<'_>,
9115    ) -> std::task::Poll<Option<Self::Item>> {
9116        let this = &mut *self;
9117        if this.inner.check_shutdown(cx) {
9118            this.is_terminated = true;
9119            return std::task::Poll::Ready(None);
9120        }
9121        if this.is_terminated {
9122            panic!("polled NavigationEventListenerRequestStream after completion");
9123        }
9124        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9125            |bytes, handles| {
9126                match this.inner.channel().read_etc(cx, bytes, handles) {
9127                    std::task::Poll::Ready(Ok(())) => {}
9128                    std::task::Poll::Pending => return std::task::Poll::Pending,
9129                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9130                        this.is_terminated = true;
9131                        return std::task::Poll::Ready(None);
9132                    }
9133                    std::task::Poll::Ready(Err(e)) => {
9134                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9135                            e.into(),
9136                        ))));
9137                    }
9138                }
9139
9140                // A message has been received from the channel
9141                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9142
9143                std::task::Poll::Ready(Some(match header.ordinal {
9144                0x453ac6bcbc82fbb6 => {
9145                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9146                    let mut req = fidl::new_empty!(NavigationEventListenerOnNavigationStateChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9147                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationEventListenerOnNavigationStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
9148                    let control_handle = NavigationEventListenerControlHandle {
9149                        inner: this.inner.clone(),
9150                    };
9151                    Ok(NavigationEventListenerRequest::OnNavigationStateChanged {change: req.change,
9152
9153                        responder: NavigationEventListenerOnNavigationStateChangedResponder {
9154                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9155                            tx_id: header.tx_id,
9156                        },
9157                    })
9158                }
9159                _ => Err(fidl::Error::UnknownOrdinal {
9160                    ordinal: header.ordinal,
9161                    protocol_name: <NavigationEventListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9162                }),
9163            }))
9164            },
9165        )
9166    }
9167}
9168
9169/// Interface supplied by the embedder for receiving notifications about navigation events in a
9170/// [`Frame`].
9171#[derive(Debug)]
9172pub enum NavigationEventListenerRequest {
9173    /// Called immediately after [`Frame.SetNavigationEventListener`] and every time user-visible
9174    /// navigation state has changed. In the first call, `change` contains the current navigation
9175    /// state (empty before the first navigation request). In every following call, `change` will
9176    /// have values set for all fields that have changed at any time since the previous
9177    /// notification. This means that some fields may have the same value as was previously
9178    /// reported, for example, if they changed to some other value and back again. If a field is
9179    /// unset, then its value has not changed at any time since the previous notification.
9180    ///
9181    /// Implementer must call the acknowledgement callback to receive new navigation events.
9182    OnNavigationStateChanged {
9183        change: NavigationState,
9184        responder: NavigationEventListenerOnNavigationStateChangedResponder,
9185    },
9186}
9187
9188impl NavigationEventListenerRequest {
9189    #[allow(irrefutable_let_patterns)]
9190    pub fn into_on_navigation_state_changed(
9191        self,
9192    ) -> Option<(NavigationState, NavigationEventListenerOnNavigationStateChangedResponder)> {
9193        if let NavigationEventListenerRequest::OnNavigationStateChanged { change, responder } = self
9194        {
9195            Some((change, responder))
9196        } else {
9197            None
9198        }
9199    }
9200
9201    /// Name of the method defined in FIDL
9202    pub fn method_name(&self) -> &'static str {
9203        match *self {
9204            NavigationEventListenerRequest::OnNavigationStateChanged { .. } => {
9205                "on_navigation_state_changed"
9206            }
9207        }
9208    }
9209}
9210
9211#[derive(Debug, Clone)]
9212pub struct NavigationEventListenerControlHandle {
9213    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9214}
9215
9216impl fidl::endpoints::ControlHandle for NavigationEventListenerControlHandle {
9217    fn shutdown(&self) {
9218        self.inner.shutdown()
9219    }
9220
9221    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9222        self.inner.shutdown_with_epitaph(status)
9223    }
9224
9225    fn is_closed(&self) -> bool {
9226        self.inner.channel().is_closed()
9227    }
9228    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9229        self.inner.channel().on_closed()
9230    }
9231
9232    #[cfg(target_os = "fuchsia")]
9233    fn signal_peer(
9234        &self,
9235        clear_mask: zx::Signals,
9236        set_mask: zx::Signals,
9237    ) -> Result<(), zx_status::Status> {
9238        use fidl::Peered;
9239        self.inner.channel().signal_peer(clear_mask, set_mask)
9240    }
9241}
9242
9243impl NavigationEventListenerControlHandle {}
9244
9245#[must_use = "FIDL methods require a response to be sent"]
9246#[derive(Debug)]
9247pub struct NavigationEventListenerOnNavigationStateChangedResponder {
9248    control_handle: std::mem::ManuallyDrop<NavigationEventListenerControlHandle>,
9249    tx_id: u32,
9250}
9251
9252/// Set the the channel to be shutdown (see [`NavigationEventListenerControlHandle::shutdown`])
9253/// if the responder is dropped without sending a response, so that the client
9254/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9255impl std::ops::Drop for NavigationEventListenerOnNavigationStateChangedResponder {
9256    fn drop(&mut self) {
9257        self.control_handle.shutdown();
9258        // Safety: drops once, never accessed again
9259        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9260    }
9261}
9262
9263impl fidl::endpoints::Responder for NavigationEventListenerOnNavigationStateChangedResponder {
9264    type ControlHandle = NavigationEventListenerControlHandle;
9265
9266    fn control_handle(&self) -> &NavigationEventListenerControlHandle {
9267        &self.control_handle
9268    }
9269
9270    fn drop_without_shutdown(mut self) {
9271        // Safety: drops once, never accessed again due to mem::forget
9272        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9273        // Prevent Drop from running (which would shut down the channel)
9274        std::mem::forget(self);
9275    }
9276}
9277
9278impl NavigationEventListenerOnNavigationStateChangedResponder {
9279    /// Sends a response to the FIDL transaction.
9280    ///
9281    /// Sets the channel to shutdown if an error occurs.
9282    pub fn send(self) -> Result<(), fidl::Error> {
9283        let _result = self.send_raw();
9284        if _result.is_err() {
9285            self.control_handle.shutdown();
9286        }
9287        self.drop_without_shutdown();
9288        _result
9289    }
9290
9291    /// Similar to "send" but does not shutdown the channel if an error occurs.
9292    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
9293        let _result = self.send_raw();
9294        self.drop_without_shutdown();
9295        _result
9296    }
9297
9298    fn send_raw(&self) -> Result<(), fidl::Error> {
9299        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
9300            (),
9301            self.tx_id,
9302            0x453ac6bcbc82fbb6,
9303            fidl::encoding::DynamicFlags::empty(),
9304        )
9305    }
9306}
9307
9308#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9309pub struct NavigationPolicyProviderMarker;
9310
9311impl fidl::endpoints::ProtocolMarker for NavigationPolicyProviderMarker {
9312    type Proxy = NavigationPolicyProviderProxy;
9313    type RequestStream = NavigationPolicyProviderRequestStream;
9314    #[cfg(target_os = "fuchsia")]
9315    type SynchronousProxy = NavigationPolicyProviderSynchronousProxy;
9316
9317    const DEBUG_NAME: &'static str = "(anonymous) NavigationPolicyProvider";
9318}
9319
9320pub trait NavigationPolicyProviderProxyInterface: Send + Sync {
9321    type EvaluateRequestedNavigationResponseFut: std::future::Future<Output = Result<NavigationDecision, fidl::Error>>
9322        + Send;
9323    fn r#evaluate_requested_navigation(
9324        &self,
9325        requested_navigation: &RequestedNavigation,
9326    ) -> Self::EvaluateRequestedNavigationResponseFut;
9327}
9328#[derive(Debug)]
9329#[cfg(target_os = "fuchsia")]
9330pub struct NavigationPolicyProviderSynchronousProxy {
9331    client: fidl::client::sync::Client,
9332}
9333
9334#[cfg(target_os = "fuchsia")]
9335impl fidl::endpoints::SynchronousProxy for NavigationPolicyProviderSynchronousProxy {
9336    type Proxy = NavigationPolicyProviderProxy;
9337    type Protocol = NavigationPolicyProviderMarker;
9338
9339    fn from_channel(inner: fidl::Channel) -> Self {
9340        Self::new(inner)
9341    }
9342
9343    fn into_channel(self) -> fidl::Channel {
9344        self.client.into_channel()
9345    }
9346
9347    fn as_channel(&self) -> &fidl::Channel {
9348        self.client.as_channel()
9349    }
9350}
9351
9352#[cfg(target_os = "fuchsia")]
9353impl NavigationPolicyProviderSynchronousProxy {
9354    pub fn new(channel: fidl::Channel) -> Self {
9355        let protocol_name =
9356            <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9357        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9358    }
9359
9360    pub fn into_channel(self) -> fidl::Channel {
9361        self.client.into_channel()
9362    }
9363
9364    /// Waits until an event arrives and returns it. It is safe for other
9365    /// threads to make concurrent requests while waiting for an event.
9366    pub fn wait_for_event(
9367        &self,
9368        deadline: zx::MonotonicInstant,
9369    ) -> Result<NavigationPolicyProviderEvent, fidl::Error> {
9370        NavigationPolicyProviderEvent::decode(self.client.wait_for_event(deadline)?)
9371    }
9372
9373    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9374    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9375    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9376    pub fn r#evaluate_requested_navigation(
9377        &self,
9378        mut requested_navigation: &RequestedNavigation,
9379        ___deadline: zx::MonotonicInstant,
9380    ) -> Result<NavigationDecision, fidl::Error> {
9381        let _response = self.client.send_query::<
9382            NavigationPolicyProviderEvaluateRequestedNavigationRequest,
9383            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
9384        >(
9385            (requested_navigation,),
9386            0x54446b50cf3512b6,
9387            fidl::encoding::DynamicFlags::empty(),
9388            ___deadline,
9389        )?;
9390        Ok(_response.decision)
9391    }
9392}
9393
9394#[cfg(target_os = "fuchsia")]
9395impl From<NavigationPolicyProviderSynchronousProxy> for zx::NullableHandle {
9396    fn from(value: NavigationPolicyProviderSynchronousProxy) -> Self {
9397        value.into_channel().into()
9398    }
9399}
9400
9401#[cfg(target_os = "fuchsia")]
9402impl From<fidl::Channel> for NavigationPolicyProviderSynchronousProxy {
9403    fn from(value: fidl::Channel) -> Self {
9404        Self::new(value)
9405    }
9406}
9407
9408#[cfg(target_os = "fuchsia")]
9409impl fidl::endpoints::FromClient for NavigationPolicyProviderSynchronousProxy {
9410    type Protocol = NavigationPolicyProviderMarker;
9411
9412    fn from_client(value: fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>) -> Self {
9413        Self::new(value.into_channel())
9414    }
9415}
9416
9417#[derive(Debug, Clone)]
9418pub struct NavigationPolicyProviderProxy {
9419    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9420}
9421
9422impl fidl::endpoints::Proxy for NavigationPolicyProviderProxy {
9423    type Protocol = NavigationPolicyProviderMarker;
9424
9425    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9426        Self::new(inner)
9427    }
9428
9429    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9430        self.client.into_channel().map_err(|client| Self { client })
9431    }
9432
9433    fn as_channel(&self) -> &::fidl::AsyncChannel {
9434        self.client.as_channel()
9435    }
9436}
9437
9438impl NavigationPolicyProviderProxy {
9439    /// Create a new Proxy for fuchsia.web/NavigationPolicyProvider.
9440    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9441        let protocol_name =
9442            <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9443        Self { client: fidl::client::Client::new(channel, protocol_name) }
9444    }
9445
9446    /// Get a Stream of events from the remote end of the protocol.
9447    ///
9448    /// # Panics
9449    ///
9450    /// Panics if the event stream was already taken.
9451    pub fn take_event_stream(&self) -> NavigationPolicyProviderEventStream {
9452        NavigationPolicyProviderEventStream { event_receiver: self.client.take_event_receiver() }
9453    }
9454
9455    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9456    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9457    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9458    pub fn r#evaluate_requested_navigation(
9459        &self,
9460        mut requested_navigation: &RequestedNavigation,
9461    ) -> fidl::client::QueryResponseFut<
9462        NavigationDecision,
9463        fidl::encoding::DefaultFuchsiaResourceDialect,
9464    > {
9465        NavigationPolicyProviderProxyInterface::r#evaluate_requested_navigation(
9466            self,
9467            requested_navigation,
9468        )
9469    }
9470}
9471
9472impl NavigationPolicyProviderProxyInterface for NavigationPolicyProviderProxy {
9473    type EvaluateRequestedNavigationResponseFut = fidl::client::QueryResponseFut<
9474        NavigationDecision,
9475        fidl::encoding::DefaultFuchsiaResourceDialect,
9476    >;
9477    fn r#evaluate_requested_navigation(
9478        &self,
9479        mut requested_navigation: &RequestedNavigation,
9480    ) -> Self::EvaluateRequestedNavigationResponseFut {
9481        fn _decode(
9482            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9483        ) -> Result<NavigationDecision, fidl::Error> {
9484            let _response = fidl::client::decode_transaction_body::<
9485                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
9486                fidl::encoding::DefaultFuchsiaResourceDialect,
9487                0x54446b50cf3512b6,
9488            >(_buf?)?;
9489            Ok(_response.decision)
9490        }
9491        self.client.send_query_and_decode::<
9492            NavigationPolicyProviderEvaluateRequestedNavigationRequest,
9493            NavigationDecision,
9494        >(
9495            (requested_navigation,),
9496            0x54446b50cf3512b6,
9497            fidl::encoding::DynamicFlags::empty(),
9498            _decode,
9499        )
9500    }
9501}
9502
9503pub struct NavigationPolicyProviderEventStream {
9504    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9505}
9506
9507impl std::marker::Unpin for NavigationPolicyProviderEventStream {}
9508
9509impl futures::stream::FusedStream for NavigationPolicyProviderEventStream {
9510    fn is_terminated(&self) -> bool {
9511        self.event_receiver.is_terminated()
9512    }
9513}
9514
9515impl futures::Stream for NavigationPolicyProviderEventStream {
9516    type Item = Result<NavigationPolicyProviderEvent, fidl::Error>;
9517
9518    fn poll_next(
9519        mut self: std::pin::Pin<&mut Self>,
9520        cx: &mut std::task::Context<'_>,
9521    ) -> std::task::Poll<Option<Self::Item>> {
9522        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9523            &mut self.event_receiver,
9524            cx
9525        )?) {
9526            Some(buf) => std::task::Poll::Ready(Some(NavigationPolicyProviderEvent::decode(buf))),
9527            None => std::task::Poll::Ready(None),
9528        }
9529    }
9530}
9531
9532#[derive(Debug)]
9533pub enum NavigationPolicyProviderEvent {}
9534
9535impl NavigationPolicyProviderEvent {
9536    /// Decodes a message buffer as a [`NavigationPolicyProviderEvent`].
9537    fn decode(
9538        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9539    ) -> Result<NavigationPolicyProviderEvent, fidl::Error> {
9540        let (bytes, _handles) = buf.split_mut();
9541        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9542        debug_assert_eq!(tx_header.tx_id, 0);
9543        match tx_header.ordinal {
9544            _ => Err(fidl::Error::UnknownOrdinal {
9545                ordinal: tx_header.ordinal,
9546                protocol_name:
9547                    <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9548            }),
9549        }
9550    }
9551}
9552
9553/// A Stream of incoming requests for fuchsia.web/NavigationPolicyProvider.
9554pub struct NavigationPolicyProviderRequestStream {
9555    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9556    is_terminated: bool,
9557}
9558
9559impl std::marker::Unpin for NavigationPolicyProviderRequestStream {}
9560
9561impl futures::stream::FusedStream for NavigationPolicyProviderRequestStream {
9562    fn is_terminated(&self) -> bool {
9563        self.is_terminated
9564    }
9565}
9566
9567impl fidl::endpoints::RequestStream for NavigationPolicyProviderRequestStream {
9568    type Protocol = NavigationPolicyProviderMarker;
9569    type ControlHandle = NavigationPolicyProviderControlHandle;
9570
9571    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9572        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9573    }
9574
9575    fn control_handle(&self) -> Self::ControlHandle {
9576        NavigationPolicyProviderControlHandle { inner: self.inner.clone() }
9577    }
9578
9579    fn into_inner(
9580        self,
9581    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9582    {
9583        (self.inner, self.is_terminated)
9584    }
9585
9586    fn from_inner(
9587        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9588        is_terminated: bool,
9589    ) -> Self {
9590        Self { inner, is_terminated }
9591    }
9592}
9593
9594impl futures::Stream for NavigationPolicyProviderRequestStream {
9595    type Item = Result<NavigationPolicyProviderRequest, fidl::Error>;
9596
9597    fn poll_next(
9598        mut self: std::pin::Pin<&mut Self>,
9599        cx: &mut std::task::Context<'_>,
9600    ) -> std::task::Poll<Option<Self::Item>> {
9601        let this = &mut *self;
9602        if this.inner.check_shutdown(cx) {
9603            this.is_terminated = true;
9604            return std::task::Poll::Ready(None);
9605        }
9606        if this.is_terminated {
9607            panic!("polled NavigationPolicyProviderRequestStream after completion");
9608        }
9609        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9610            |bytes, handles| {
9611                match this.inner.channel().read_etc(cx, bytes, handles) {
9612                    std::task::Poll::Ready(Ok(())) => {}
9613                    std::task::Poll::Pending => return std::task::Poll::Pending,
9614                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9615                        this.is_terminated = true;
9616                        return std::task::Poll::Ready(None);
9617                    }
9618                    std::task::Poll::Ready(Err(e)) => {
9619                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9620                            e.into(),
9621                        ))));
9622                    }
9623                }
9624
9625                // A message has been received from the channel
9626                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9627
9628                std::task::Poll::Ready(Some(match header.ordinal {
9629                0x54446b50cf3512b6 => {
9630                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9631                    let mut req = fidl::new_empty!(NavigationPolicyProviderEvaluateRequestedNavigationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
9632                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NavigationPolicyProviderEvaluateRequestedNavigationRequest>(&header, _body_bytes, handles, &mut req)?;
9633                    let control_handle = NavigationPolicyProviderControlHandle {
9634                        inner: this.inner.clone(),
9635                    };
9636                    Ok(NavigationPolicyProviderRequest::EvaluateRequestedNavigation {requested_navigation: req.requested_navigation,
9637
9638                        responder: NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9639                            control_handle: std::mem::ManuallyDrop::new(control_handle),
9640                            tx_id: header.tx_id,
9641                        },
9642                    })
9643                }
9644                _ => Err(fidl::Error::UnknownOrdinal {
9645                    ordinal: header.ordinal,
9646                    protocol_name: <NavigationPolicyProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9647                }),
9648            }))
9649            },
9650        )
9651    }
9652}
9653
9654#[derive(Debug)]
9655pub enum NavigationPolicyProviderRequest {
9656    /// Called when the [`Frame`] is processing a navigation request in one of the phase(s)
9657    /// specified in [`NavigationPolicyProviderParams`]. Navigation is paused until the result is
9658    /// received. The returned [`NavigationDecision`] defines how the navigation should proceed.
9659    EvaluateRequestedNavigation {
9660        requested_navigation: RequestedNavigation,
9661        responder: NavigationPolicyProviderEvaluateRequestedNavigationResponder,
9662    },
9663}
9664
9665impl NavigationPolicyProviderRequest {
9666    #[allow(irrefutable_let_patterns)]
9667    pub fn into_evaluate_requested_navigation(
9668        self,
9669    ) -> Option<(RequestedNavigation, NavigationPolicyProviderEvaluateRequestedNavigationResponder)>
9670    {
9671        if let NavigationPolicyProviderRequest::EvaluateRequestedNavigation {
9672            requested_navigation,
9673            responder,
9674        } = self
9675        {
9676            Some((requested_navigation, responder))
9677        } else {
9678            None
9679        }
9680    }
9681
9682    /// Name of the method defined in FIDL
9683    pub fn method_name(&self) -> &'static str {
9684        match *self {
9685            NavigationPolicyProviderRequest::EvaluateRequestedNavigation { .. } => {
9686                "evaluate_requested_navigation"
9687            }
9688        }
9689    }
9690}
9691
9692#[derive(Debug, Clone)]
9693pub struct NavigationPolicyProviderControlHandle {
9694    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9695}
9696
9697impl fidl::endpoints::ControlHandle for NavigationPolicyProviderControlHandle {
9698    fn shutdown(&self) {
9699        self.inner.shutdown()
9700    }
9701
9702    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9703        self.inner.shutdown_with_epitaph(status)
9704    }
9705
9706    fn is_closed(&self) -> bool {
9707        self.inner.channel().is_closed()
9708    }
9709    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9710        self.inner.channel().on_closed()
9711    }
9712
9713    #[cfg(target_os = "fuchsia")]
9714    fn signal_peer(
9715        &self,
9716        clear_mask: zx::Signals,
9717        set_mask: zx::Signals,
9718    ) -> Result<(), zx_status::Status> {
9719        use fidl::Peered;
9720        self.inner.channel().signal_peer(clear_mask, set_mask)
9721    }
9722}
9723
9724impl NavigationPolicyProviderControlHandle {}
9725
9726#[must_use = "FIDL methods require a response to be sent"]
9727#[derive(Debug)]
9728pub struct NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9729    control_handle: std::mem::ManuallyDrop<NavigationPolicyProviderControlHandle>,
9730    tx_id: u32,
9731}
9732
9733/// Set the the channel to be shutdown (see [`NavigationPolicyProviderControlHandle::shutdown`])
9734/// if the responder is dropped without sending a response, so that the client
9735/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9736impl std::ops::Drop for NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9737    fn drop(&mut self) {
9738        self.control_handle.shutdown();
9739        // Safety: drops once, never accessed again
9740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9741    }
9742}
9743
9744impl fidl::endpoints::Responder for NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9745    type ControlHandle = NavigationPolicyProviderControlHandle;
9746
9747    fn control_handle(&self) -> &NavigationPolicyProviderControlHandle {
9748        &self.control_handle
9749    }
9750
9751    fn drop_without_shutdown(mut self) {
9752        // Safety: drops once, never accessed again due to mem::forget
9753        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9754        // Prevent Drop from running (which would shut down the channel)
9755        std::mem::forget(self);
9756    }
9757}
9758
9759impl NavigationPolicyProviderEvaluateRequestedNavigationResponder {
9760    /// Sends a response to the FIDL transaction.
9761    ///
9762    /// Sets the channel to shutdown if an error occurs.
9763    pub fn send(self, mut decision: NavigationDecision) -> Result<(), fidl::Error> {
9764        let _result = self.send_raw(decision);
9765        if _result.is_err() {
9766            self.control_handle.shutdown();
9767        }
9768        self.drop_without_shutdown();
9769        _result
9770    }
9771
9772    /// Similar to "send" but does not shutdown the channel if an error occurs.
9773    pub fn send_no_shutdown_on_err(
9774        self,
9775        mut decision: NavigationDecision,
9776    ) -> Result<(), fidl::Error> {
9777        let _result = self.send_raw(decision);
9778        self.drop_without_shutdown();
9779        _result
9780    }
9781
9782    fn send_raw(&self, mut decision: NavigationDecision) -> Result<(), fidl::Error> {
9783        self.control_handle
9784            .inner
9785            .send::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
9786                (&mut decision,),
9787                self.tx_id,
9788                0x54446b50cf3512b6,
9789                fidl::encoding::DynamicFlags::empty(),
9790            )
9791    }
9792}
9793
9794#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9795pub struct PopupFrameCreationListenerMarker;
9796
9797impl fidl::endpoints::ProtocolMarker for PopupFrameCreationListenerMarker {
9798    type Proxy = PopupFrameCreationListenerProxy;
9799    type RequestStream = PopupFrameCreationListenerRequestStream;
9800    #[cfg(target_os = "fuchsia")]
9801    type SynchronousProxy = PopupFrameCreationListenerSynchronousProxy;
9802
9803    const DEBUG_NAME: &'static str = "(anonymous) PopupFrameCreationListener";
9804}
9805
9806pub trait PopupFrameCreationListenerProxyInterface: Send + Sync {
9807    type OnPopupFrameCreatedResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
9808        + Send;
9809    fn r#on_popup_frame_created(
9810        &self,
9811        frame: fidl::endpoints::ClientEnd<FrameMarker>,
9812        info: PopupFrameCreationInfo,
9813    ) -> Self::OnPopupFrameCreatedResponseFut;
9814}
9815#[derive(Debug)]
9816#[cfg(target_os = "fuchsia")]
9817pub struct PopupFrameCreationListenerSynchronousProxy {
9818    client: fidl::client::sync::Client,
9819}
9820
9821#[cfg(target_os = "fuchsia")]
9822impl fidl::endpoints::SynchronousProxy for PopupFrameCreationListenerSynchronousProxy {
9823    type Proxy = PopupFrameCreationListenerProxy;
9824    type Protocol = PopupFrameCreationListenerMarker;
9825
9826    fn from_channel(inner: fidl::Channel) -> Self {
9827        Self::new(inner)
9828    }
9829
9830    fn into_channel(self) -> fidl::Channel {
9831        self.client.into_channel()
9832    }
9833
9834    fn as_channel(&self) -> &fidl::Channel {
9835        self.client.as_channel()
9836    }
9837}
9838
9839#[cfg(target_os = "fuchsia")]
9840impl PopupFrameCreationListenerSynchronousProxy {
9841    pub fn new(channel: fidl::Channel) -> Self {
9842        let protocol_name =
9843            <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9844        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9845    }
9846
9847    pub fn into_channel(self) -> fidl::Channel {
9848        self.client.into_channel()
9849    }
9850
9851    /// Waits until an event arrives and returns it. It is safe for other
9852    /// threads to make concurrent requests while waiting for an event.
9853    pub fn wait_for_event(
9854        &self,
9855        deadline: zx::MonotonicInstant,
9856    ) -> Result<PopupFrameCreationListenerEvent, fidl::Error> {
9857        PopupFrameCreationListenerEvent::decode(self.client.wait_for_event(deadline)?)
9858    }
9859
9860    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9861    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9862    /// the acknowledgement callback is invoked.
9863    pub fn r#on_popup_frame_created(
9864        &self,
9865        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9866        mut info: PopupFrameCreationInfo,
9867        ___deadline: zx::MonotonicInstant,
9868    ) -> Result<(), fidl::Error> {
9869        let _response = self.client.send_query::<
9870            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
9871            fidl::encoding::EmptyPayload,
9872        >(
9873            (frame, &mut info,),
9874            0x19b212672dc41d51,
9875            fidl::encoding::DynamicFlags::empty(),
9876            ___deadline,
9877        )?;
9878        Ok(_response)
9879    }
9880}
9881
9882#[cfg(target_os = "fuchsia")]
9883impl From<PopupFrameCreationListenerSynchronousProxy> for zx::NullableHandle {
9884    fn from(value: PopupFrameCreationListenerSynchronousProxy) -> Self {
9885        value.into_channel().into()
9886    }
9887}
9888
9889#[cfg(target_os = "fuchsia")]
9890impl From<fidl::Channel> for PopupFrameCreationListenerSynchronousProxy {
9891    fn from(value: fidl::Channel) -> Self {
9892        Self::new(value)
9893    }
9894}
9895
9896#[cfg(target_os = "fuchsia")]
9897impl fidl::endpoints::FromClient for PopupFrameCreationListenerSynchronousProxy {
9898    type Protocol = PopupFrameCreationListenerMarker;
9899
9900    fn from_client(value: fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>) -> Self {
9901        Self::new(value.into_channel())
9902    }
9903}
9904
9905#[derive(Debug, Clone)]
9906pub struct PopupFrameCreationListenerProxy {
9907    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9908}
9909
9910impl fidl::endpoints::Proxy for PopupFrameCreationListenerProxy {
9911    type Protocol = PopupFrameCreationListenerMarker;
9912
9913    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9914        Self::new(inner)
9915    }
9916
9917    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9918        self.client.into_channel().map_err(|client| Self { client })
9919    }
9920
9921    fn as_channel(&self) -> &::fidl::AsyncChannel {
9922        self.client.as_channel()
9923    }
9924}
9925
9926impl PopupFrameCreationListenerProxy {
9927    /// Create a new Proxy for fuchsia.web/PopupFrameCreationListener.
9928    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9929        let protocol_name =
9930            <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9931        Self { client: fidl::client::Client::new(channel, protocol_name) }
9932    }
9933
9934    /// Get a Stream of events from the remote end of the protocol.
9935    ///
9936    /// # Panics
9937    ///
9938    /// Panics if the event stream was already taken.
9939    pub fn take_event_stream(&self) -> PopupFrameCreationListenerEventStream {
9940        PopupFrameCreationListenerEventStream { event_receiver: self.client.take_event_receiver() }
9941    }
9942
9943    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
9944    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
9945    /// the acknowledgement callback is invoked.
9946    pub fn r#on_popup_frame_created(
9947        &self,
9948        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9949        mut info: PopupFrameCreationInfo,
9950    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
9951        PopupFrameCreationListenerProxyInterface::r#on_popup_frame_created(self, frame, info)
9952    }
9953}
9954
9955impl PopupFrameCreationListenerProxyInterface for PopupFrameCreationListenerProxy {
9956    type OnPopupFrameCreatedResponseFut =
9957        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
9958    fn r#on_popup_frame_created(
9959        &self,
9960        mut frame: fidl::endpoints::ClientEnd<FrameMarker>,
9961        mut info: PopupFrameCreationInfo,
9962    ) -> Self::OnPopupFrameCreatedResponseFut {
9963        fn _decode(
9964            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9965        ) -> Result<(), fidl::Error> {
9966            let _response = fidl::client::decode_transaction_body::<
9967                fidl::encoding::EmptyPayload,
9968                fidl::encoding::DefaultFuchsiaResourceDialect,
9969                0x19b212672dc41d51,
9970            >(_buf?)?;
9971            Ok(_response)
9972        }
9973        self.client
9974            .send_query_and_decode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, ()>(
9975                (frame, &mut info),
9976                0x19b212672dc41d51,
9977                fidl::encoding::DynamicFlags::empty(),
9978                _decode,
9979            )
9980    }
9981}
9982
9983pub struct PopupFrameCreationListenerEventStream {
9984    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9985}
9986
9987impl std::marker::Unpin for PopupFrameCreationListenerEventStream {}
9988
9989impl futures::stream::FusedStream for PopupFrameCreationListenerEventStream {
9990    fn is_terminated(&self) -> bool {
9991        self.event_receiver.is_terminated()
9992    }
9993}
9994
9995impl futures::Stream for PopupFrameCreationListenerEventStream {
9996    type Item = Result<PopupFrameCreationListenerEvent, fidl::Error>;
9997
9998    fn poll_next(
9999        mut self: std::pin::Pin<&mut Self>,
10000        cx: &mut std::task::Context<'_>,
10001    ) -> std::task::Poll<Option<Self::Item>> {
10002        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10003            &mut self.event_receiver,
10004            cx
10005        )?) {
10006            Some(buf) => std::task::Poll::Ready(Some(PopupFrameCreationListenerEvent::decode(buf))),
10007            None => std::task::Poll::Ready(None),
10008        }
10009    }
10010}
10011
10012#[derive(Debug)]
10013pub enum PopupFrameCreationListenerEvent {}
10014
10015impl PopupFrameCreationListenerEvent {
10016    /// Decodes a message buffer as a [`PopupFrameCreationListenerEvent`].
10017    fn decode(
10018        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10019    ) -> Result<PopupFrameCreationListenerEvent, fidl::Error> {
10020        let (bytes, _handles) = buf.split_mut();
10021        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10022        debug_assert_eq!(tx_header.tx_id, 0);
10023        match tx_header.ordinal {
10024            _ => Err(fidl::Error::UnknownOrdinal {
10025                ordinal: tx_header.ordinal,
10026                protocol_name: <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10027            })
10028        }
10029    }
10030}
10031
10032/// A Stream of incoming requests for fuchsia.web/PopupFrameCreationListener.
10033pub struct PopupFrameCreationListenerRequestStream {
10034    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10035    is_terminated: bool,
10036}
10037
10038impl std::marker::Unpin for PopupFrameCreationListenerRequestStream {}
10039
10040impl futures::stream::FusedStream for PopupFrameCreationListenerRequestStream {
10041    fn is_terminated(&self) -> bool {
10042        self.is_terminated
10043    }
10044}
10045
10046impl fidl::endpoints::RequestStream for PopupFrameCreationListenerRequestStream {
10047    type Protocol = PopupFrameCreationListenerMarker;
10048    type ControlHandle = PopupFrameCreationListenerControlHandle;
10049
10050    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10051        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10052    }
10053
10054    fn control_handle(&self) -> Self::ControlHandle {
10055        PopupFrameCreationListenerControlHandle { inner: self.inner.clone() }
10056    }
10057
10058    fn into_inner(
10059        self,
10060    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10061    {
10062        (self.inner, self.is_terminated)
10063    }
10064
10065    fn from_inner(
10066        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10067        is_terminated: bool,
10068    ) -> Self {
10069        Self { inner, is_terminated }
10070    }
10071}
10072
10073impl futures::Stream for PopupFrameCreationListenerRequestStream {
10074    type Item = Result<PopupFrameCreationListenerRequest, fidl::Error>;
10075
10076    fn poll_next(
10077        mut self: std::pin::Pin<&mut Self>,
10078        cx: &mut std::task::Context<'_>,
10079    ) -> std::task::Poll<Option<Self::Item>> {
10080        let this = &mut *self;
10081        if this.inner.check_shutdown(cx) {
10082            this.is_terminated = true;
10083            return std::task::Poll::Ready(None);
10084        }
10085        if this.is_terminated {
10086            panic!("polled PopupFrameCreationListenerRequestStream after completion");
10087        }
10088        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10089            |bytes, handles| {
10090                match this.inner.channel().read_etc(cx, bytes, handles) {
10091                    std::task::Poll::Ready(Ok(())) => {}
10092                    std::task::Poll::Pending => return std::task::Poll::Pending,
10093                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10094                        this.is_terminated = true;
10095                        return std::task::Poll::Ready(None);
10096                    }
10097                    std::task::Poll::Ready(Err(e)) => {
10098                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10099                            e.into(),
10100                        ))));
10101                    }
10102                }
10103
10104                // A message has been received from the channel
10105                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10106
10107                std::task::Poll::Ready(Some(match header.ordinal {
10108                0x19b212672dc41d51 => {
10109                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10110                    let mut req = fidl::new_empty!(PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
10111                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(&header, _body_bytes, handles, &mut req)?;
10112                    let control_handle = PopupFrameCreationListenerControlHandle {
10113                        inner: this.inner.clone(),
10114                    };
10115                    Ok(PopupFrameCreationListenerRequest::OnPopupFrameCreated {frame: req.frame,
10116info: req.info,
10117
10118                        responder: PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10119                            control_handle: std::mem::ManuallyDrop::new(control_handle),
10120                            tx_id: header.tx_id,
10121                        },
10122                    })
10123                }
10124                _ => Err(fidl::Error::UnknownOrdinal {
10125                    ordinal: header.ordinal,
10126                    protocol_name: <PopupFrameCreationListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10127                }),
10128            }))
10129            },
10130        )
10131    }
10132}
10133
10134#[derive(Debug)]
10135pub enum PopupFrameCreationListenerRequest {
10136    /// Called when a [`Frame`] has created a new popup `frame`. Information about the popup frame,
10137    /// and how it was created, is provided via `info`. Additional popup frames are delivered after
10138    /// the acknowledgement callback is invoked.
10139    OnPopupFrameCreated {
10140        frame: fidl::endpoints::ClientEnd<FrameMarker>,
10141        info: PopupFrameCreationInfo,
10142        responder: PopupFrameCreationListenerOnPopupFrameCreatedResponder,
10143    },
10144}
10145
10146impl PopupFrameCreationListenerRequest {
10147    #[allow(irrefutable_let_patterns)]
10148    pub fn into_on_popup_frame_created(
10149        self,
10150    ) -> Option<(
10151        fidl::endpoints::ClientEnd<FrameMarker>,
10152        PopupFrameCreationInfo,
10153        PopupFrameCreationListenerOnPopupFrameCreatedResponder,
10154    )> {
10155        if let PopupFrameCreationListenerRequest::OnPopupFrameCreated { frame, info, responder } =
10156            self
10157        {
10158            Some((frame, info, responder))
10159        } else {
10160            None
10161        }
10162    }
10163
10164    /// Name of the method defined in FIDL
10165    pub fn method_name(&self) -> &'static str {
10166        match *self {
10167            PopupFrameCreationListenerRequest::OnPopupFrameCreated { .. } => {
10168                "on_popup_frame_created"
10169            }
10170        }
10171    }
10172}
10173
10174#[derive(Debug, Clone)]
10175pub struct PopupFrameCreationListenerControlHandle {
10176    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10177}
10178
10179impl fidl::endpoints::ControlHandle for PopupFrameCreationListenerControlHandle {
10180    fn shutdown(&self) {
10181        self.inner.shutdown()
10182    }
10183
10184    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10185        self.inner.shutdown_with_epitaph(status)
10186    }
10187
10188    fn is_closed(&self) -> bool {
10189        self.inner.channel().is_closed()
10190    }
10191    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10192        self.inner.channel().on_closed()
10193    }
10194
10195    #[cfg(target_os = "fuchsia")]
10196    fn signal_peer(
10197        &self,
10198        clear_mask: zx::Signals,
10199        set_mask: zx::Signals,
10200    ) -> Result<(), zx_status::Status> {
10201        use fidl::Peered;
10202        self.inner.channel().signal_peer(clear_mask, set_mask)
10203    }
10204}
10205
10206impl PopupFrameCreationListenerControlHandle {}
10207
10208#[must_use = "FIDL methods require a response to be sent"]
10209#[derive(Debug)]
10210pub struct PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10211    control_handle: std::mem::ManuallyDrop<PopupFrameCreationListenerControlHandle>,
10212    tx_id: u32,
10213}
10214
10215/// Set the the channel to be shutdown (see [`PopupFrameCreationListenerControlHandle::shutdown`])
10216/// if the responder is dropped without sending a response, so that the client
10217/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10218impl std::ops::Drop for PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10219    fn drop(&mut self) {
10220        self.control_handle.shutdown();
10221        // Safety: drops once, never accessed again
10222        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10223    }
10224}
10225
10226impl fidl::endpoints::Responder for PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10227    type ControlHandle = PopupFrameCreationListenerControlHandle;
10228
10229    fn control_handle(&self) -> &PopupFrameCreationListenerControlHandle {
10230        &self.control_handle
10231    }
10232
10233    fn drop_without_shutdown(mut self) {
10234        // Safety: drops once, never accessed again due to mem::forget
10235        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10236        // Prevent Drop from running (which would shut down the channel)
10237        std::mem::forget(self);
10238    }
10239}
10240
10241impl PopupFrameCreationListenerOnPopupFrameCreatedResponder {
10242    /// Sends a response to the FIDL transaction.
10243    ///
10244    /// Sets the channel to shutdown if an error occurs.
10245    pub fn send(self) -> Result<(), fidl::Error> {
10246        let _result = self.send_raw();
10247        if _result.is_err() {
10248            self.control_handle.shutdown();
10249        }
10250        self.drop_without_shutdown();
10251        _result
10252    }
10253
10254    /// Similar to "send" but does not shutdown the channel if an error occurs.
10255    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
10256        let _result = self.send_raw();
10257        self.drop_without_shutdown();
10258        _result
10259    }
10260
10261    fn send_raw(&self) -> Result<(), fidl::Error> {
10262        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
10263            (),
10264            self.tx_id,
10265            0x19b212672dc41d51,
10266            fidl::encoding::DynamicFlags::empty(),
10267        )
10268    }
10269}
10270
10271mod internal {
10272    use super::*;
10273
10274    impl fidl::encoding::ResourceTypeMarker for ContextCreateFrameRequest {
10275        type Borrowed<'a> = &'a mut Self;
10276        fn take_or_borrow<'a>(
10277            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10278        ) -> Self::Borrowed<'a> {
10279            value
10280        }
10281    }
10282
10283    unsafe impl fidl::encoding::TypeMarker for ContextCreateFrameRequest {
10284        type Owned = Self;
10285
10286        #[inline(always)]
10287        fn inline_align(_context: fidl::encoding::Context) -> usize {
10288            4
10289        }
10290
10291        #[inline(always)]
10292        fn inline_size(_context: fidl::encoding::Context) -> usize {
10293            4
10294        }
10295    }
10296
10297    unsafe impl
10298        fidl::encoding::Encode<
10299            ContextCreateFrameRequest,
10300            fidl::encoding::DefaultFuchsiaResourceDialect,
10301        > for &mut ContextCreateFrameRequest
10302    {
10303        #[inline]
10304        unsafe fn encode(
10305            self,
10306            encoder: &mut fidl::encoding::Encoder<
10307                '_,
10308                fidl::encoding::DefaultFuchsiaResourceDialect,
10309            >,
10310            offset: usize,
10311            _depth: fidl::encoding::Depth,
10312        ) -> fidl::Result<()> {
10313            encoder.debug_check_bounds::<ContextCreateFrameRequest>(offset);
10314            // Delegate to tuple encoding.
10315            fidl::encoding::Encode::<ContextCreateFrameRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10316                (
10317                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
10318                ),
10319                encoder, offset, _depth
10320            )
10321        }
10322    }
10323    unsafe impl<
10324        T0: fidl::encoding::Encode<
10325                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10326                fidl::encoding::DefaultFuchsiaResourceDialect,
10327            >,
10328    >
10329        fidl::encoding::Encode<
10330            ContextCreateFrameRequest,
10331            fidl::encoding::DefaultFuchsiaResourceDialect,
10332        > for (T0,)
10333    {
10334        #[inline]
10335        unsafe fn encode(
10336            self,
10337            encoder: &mut fidl::encoding::Encoder<
10338                '_,
10339                fidl::encoding::DefaultFuchsiaResourceDialect,
10340            >,
10341            offset: usize,
10342            depth: fidl::encoding::Depth,
10343        ) -> fidl::Result<()> {
10344            encoder.debug_check_bounds::<ContextCreateFrameRequest>(offset);
10345            // Zero out padding regions. There's no need to apply masks
10346            // because the unmasked parts will be overwritten by fields.
10347            // Write the fields.
10348            self.0.encode(encoder, offset + 0, depth)?;
10349            Ok(())
10350        }
10351    }
10352
10353    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10354        for ContextCreateFrameRequest
10355    {
10356        #[inline(always)]
10357        fn new_empty() -> Self {
10358            Self {
10359                frame: fidl::new_empty!(
10360                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10361                    fidl::encoding::DefaultFuchsiaResourceDialect
10362                ),
10363            }
10364        }
10365
10366        #[inline]
10367        unsafe fn decode(
10368            &mut self,
10369            decoder: &mut fidl::encoding::Decoder<
10370                '_,
10371                fidl::encoding::DefaultFuchsiaResourceDialect,
10372            >,
10373            offset: usize,
10374            _depth: fidl::encoding::Depth,
10375        ) -> fidl::Result<()> {
10376            decoder.debug_check_bounds::<Self>(offset);
10377            // Verify that padding bytes are zero.
10378            fidl::decode!(
10379                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10380                fidl::encoding::DefaultFuchsiaResourceDialect,
10381                &mut self.frame,
10382                decoder,
10383                offset + 0,
10384                _depth
10385            )?;
10386            Ok(())
10387        }
10388    }
10389
10390    impl fidl::encoding::ResourceTypeMarker for ContextCreateFrameWithParamsRequest {
10391        type Borrowed<'a> = &'a mut Self;
10392        fn take_or_borrow<'a>(
10393            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10394        ) -> Self::Borrowed<'a> {
10395            value
10396        }
10397    }
10398
10399    unsafe impl fidl::encoding::TypeMarker for ContextCreateFrameWithParamsRequest {
10400        type Owned = Self;
10401
10402        #[inline(always)]
10403        fn inline_align(_context: fidl::encoding::Context) -> usize {
10404            8
10405        }
10406
10407        #[inline(always)]
10408        fn inline_size(_context: fidl::encoding::Context) -> usize {
10409            24
10410        }
10411    }
10412
10413    unsafe impl
10414        fidl::encoding::Encode<
10415            ContextCreateFrameWithParamsRequest,
10416            fidl::encoding::DefaultFuchsiaResourceDialect,
10417        > for &mut ContextCreateFrameWithParamsRequest
10418    {
10419        #[inline]
10420        unsafe fn encode(
10421            self,
10422            encoder: &mut fidl::encoding::Encoder<
10423                '_,
10424                fidl::encoding::DefaultFuchsiaResourceDialect,
10425            >,
10426            offset: usize,
10427            _depth: fidl::encoding::Depth,
10428        ) -> fidl::Result<()> {
10429            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10430            // Delegate to tuple encoding.
10431            fidl::encoding::Encode::<ContextCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10432                (
10433                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10434                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
10435                ),
10436                encoder, offset, _depth
10437            )
10438        }
10439    }
10440    unsafe impl<
10441        T0: fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
10442        T1: fidl::encoding::Encode<
10443                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10444                fidl::encoding::DefaultFuchsiaResourceDialect,
10445            >,
10446    >
10447        fidl::encoding::Encode<
10448            ContextCreateFrameWithParamsRequest,
10449            fidl::encoding::DefaultFuchsiaResourceDialect,
10450        > for (T0, T1)
10451    {
10452        #[inline]
10453        unsafe fn encode(
10454            self,
10455            encoder: &mut fidl::encoding::Encoder<
10456                '_,
10457                fidl::encoding::DefaultFuchsiaResourceDialect,
10458            >,
10459            offset: usize,
10460            depth: fidl::encoding::Depth,
10461        ) -> fidl::Result<()> {
10462            encoder.debug_check_bounds::<ContextCreateFrameWithParamsRequest>(offset);
10463            // Zero out padding regions. There's no need to apply masks
10464            // because the unmasked parts will be overwritten by fields.
10465            unsafe {
10466                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10467                (ptr as *mut u64).write_unaligned(0);
10468            }
10469            // Write the fields.
10470            self.0.encode(encoder, offset + 0, depth)?;
10471            self.1.encode(encoder, offset + 16, depth)?;
10472            Ok(())
10473        }
10474    }
10475
10476    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10477        for ContextCreateFrameWithParamsRequest
10478    {
10479        #[inline(always)]
10480        fn new_empty() -> Self {
10481            Self {
10482                params: fidl::new_empty!(
10483                    CreateFrameParams,
10484                    fidl::encoding::DefaultFuchsiaResourceDialect
10485                ),
10486                frame: fidl::new_empty!(
10487                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10488                    fidl::encoding::DefaultFuchsiaResourceDialect
10489                ),
10490            }
10491        }
10492
10493        #[inline]
10494        unsafe fn decode(
10495            &mut self,
10496            decoder: &mut fidl::encoding::Decoder<
10497                '_,
10498                fidl::encoding::DefaultFuchsiaResourceDialect,
10499            >,
10500            offset: usize,
10501            _depth: fidl::encoding::Depth,
10502        ) -> fidl::Result<()> {
10503            decoder.debug_check_bounds::<Self>(offset);
10504            // Verify that padding bytes are zero.
10505            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10506            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10507            let mask = 0xffffffff00000000u64;
10508            let maskedval = padval & mask;
10509            if maskedval != 0 {
10510                return Err(fidl::Error::NonZeroPadding {
10511                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10512                });
10513            }
10514            fidl::decode!(
10515                CreateFrameParams,
10516                fidl::encoding::DefaultFuchsiaResourceDialect,
10517                &mut self.params,
10518                decoder,
10519                offset + 0,
10520                _depth
10521            )?;
10522            fidl::decode!(
10523                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
10524                fidl::encoding::DefaultFuchsiaResourceDialect,
10525                &mut self.frame,
10526                decoder,
10527                offset + 16,
10528                _depth
10529            )?;
10530            Ok(())
10531        }
10532    }
10533
10534    impl fidl::encoding::ResourceTypeMarker for ContextGetCookieManagerRequest {
10535        type Borrowed<'a> = &'a mut Self;
10536        fn take_or_borrow<'a>(
10537            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10538        ) -> Self::Borrowed<'a> {
10539            value
10540        }
10541    }
10542
10543    unsafe impl fidl::encoding::TypeMarker for ContextGetCookieManagerRequest {
10544        type Owned = Self;
10545
10546        #[inline(always)]
10547        fn inline_align(_context: fidl::encoding::Context) -> usize {
10548            4
10549        }
10550
10551        #[inline(always)]
10552        fn inline_size(_context: fidl::encoding::Context) -> usize {
10553            4
10554        }
10555    }
10556
10557    unsafe impl
10558        fidl::encoding::Encode<
10559            ContextGetCookieManagerRequest,
10560            fidl::encoding::DefaultFuchsiaResourceDialect,
10561        > for &mut ContextGetCookieManagerRequest
10562    {
10563        #[inline]
10564        unsafe fn encode(
10565            self,
10566            encoder: &mut fidl::encoding::Encoder<
10567                '_,
10568                fidl::encoding::DefaultFuchsiaResourceDialect,
10569            >,
10570            offset: usize,
10571            _depth: fidl::encoding::Depth,
10572        ) -> fidl::Result<()> {
10573            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10574            // Delegate to tuple encoding.
10575            fidl::encoding::Encode::<ContextGetCookieManagerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10576                (
10577                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.manager),
10578                ),
10579                encoder, offset, _depth
10580            )
10581        }
10582    }
10583    unsafe impl<
10584        T0: fidl::encoding::Encode<
10585                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10586                fidl::encoding::DefaultFuchsiaResourceDialect,
10587            >,
10588    >
10589        fidl::encoding::Encode<
10590            ContextGetCookieManagerRequest,
10591            fidl::encoding::DefaultFuchsiaResourceDialect,
10592        > for (T0,)
10593    {
10594        #[inline]
10595        unsafe fn encode(
10596            self,
10597            encoder: &mut fidl::encoding::Encoder<
10598                '_,
10599                fidl::encoding::DefaultFuchsiaResourceDialect,
10600            >,
10601            offset: usize,
10602            depth: fidl::encoding::Depth,
10603        ) -> fidl::Result<()> {
10604            encoder.debug_check_bounds::<ContextGetCookieManagerRequest>(offset);
10605            // Zero out padding regions. There's no need to apply masks
10606            // because the unmasked parts will be overwritten by fields.
10607            // Write the fields.
10608            self.0.encode(encoder, offset + 0, depth)?;
10609            Ok(())
10610        }
10611    }
10612
10613    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10614        for ContextGetCookieManagerRequest
10615    {
10616        #[inline(always)]
10617        fn new_empty() -> Self {
10618            Self {
10619                manager: fidl::new_empty!(
10620                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10621                    fidl::encoding::DefaultFuchsiaResourceDialect
10622                ),
10623            }
10624        }
10625
10626        #[inline]
10627        unsafe fn decode(
10628            &mut self,
10629            decoder: &mut fidl::encoding::Decoder<
10630                '_,
10631                fidl::encoding::DefaultFuchsiaResourceDialect,
10632            >,
10633            offset: usize,
10634            _depth: fidl::encoding::Depth,
10635        ) -> fidl::Result<()> {
10636            decoder.debug_check_bounds::<Self>(offset);
10637            // Verify that padding bytes are zero.
10638            fidl::decode!(
10639                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookieManagerMarker>>,
10640                fidl::encoding::DefaultFuchsiaResourceDialect,
10641                &mut self.manager,
10642                decoder,
10643                offset + 0,
10644                _depth
10645            )?;
10646            Ok(())
10647        }
10648    }
10649
10650    impl fidl::encoding::ResourceTypeMarker for ContextProviderCreateRequest {
10651        type Borrowed<'a> = &'a mut Self;
10652        fn take_or_borrow<'a>(
10653            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10654        ) -> Self::Borrowed<'a> {
10655            value
10656        }
10657    }
10658
10659    unsafe impl fidl::encoding::TypeMarker for ContextProviderCreateRequest {
10660        type Owned = Self;
10661
10662        #[inline(always)]
10663        fn inline_align(_context: fidl::encoding::Context) -> usize {
10664            8
10665        }
10666
10667        #[inline(always)]
10668        fn inline_size(_context: fidl::encoding::Context) -> usize {
10669            24
10670        }
10671    }
10672
10673    unsafe impl
10674        fidl::encoding::Encode<
10675            ContextProviderCreateRequest,
10676            fidl::encoding::DefaultFuchsiaResourceDialect,
10677        > for &mut ContextProviderCreateRequest
10678    {
10679        #[inline]
10680        unsafe fn encode(
10681            self,
10682            encoder: &mut fidl::encoding::Encoder<
10683                '_,
10684                fidl::encoding::DefaultFuchsiaResourceDialect,
10685            >,
10686            offset: usize,
10687            _depth: fidl::encoding::Depth,
10688        ) -> fidl::Result<()> {
10689            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10690            // Delegate to tuple encoding.
10691            fidl::encoding::Encode::<ContextProviderCreateRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10692                (
10693                    <CreateContextParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
10694                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.context),
10695                ),
10696                encoder, offset, _depth
10697            )
10698        }
10699    }
10700    unsafe impl<
10701        T0: fidl::encoding::Encode<CreateContextParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
10702        T1: fidl::encoding::Encode<
10703                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10704                fidl::encoding::DefaultFuchsiaResourceDialect,
10705            >,
10706    >
10707        fidl::encoding::Encode<
10708            ContextProviderCreateRequest,
10709            fidl::encoding::DefaultFuchsiaResourceDialect,
10710        > for (T0, T1)
10711    {
10712        #[inline]
10713        unsafe fn encode(
10714            self,
10715            encoder: &mut fidl::encoding::Encoder<
10716                '_,
10717                fidl::encoding::DefaultFuchsiaResourceDialect,
10718            >,
10719            offset: usize,
10720            depth: fidl::encoding::Depth,
10721        ) -> fidl::Result<()> {
10722            encoder.debug_check_bounds::<ContextProviderCreateRequest>(offset);
10723            // Zero out padding regions. There's no need to apply masks
10724            // because the unmasked parts will be overwritten by fields.
10725            unsafe {
10726                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10727                (ptr as *mut u64).write_unaligned(0);
10728            }
10729            // Write the fields.
10730            self.0.encode(encoder, offset + 0, depth)?;
10731            self.1.encode(encoder, offset + 16, depth)?;
10732            Ok(())
10733        }
10734    }
10735
10736    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10737        for ContextProviderCreateRequest
10738    {
10739        #[inline(always)]
10740        fn new_empty() -> Self {
10741            Self {
10742                params: fidl::new_empty!(
10743                    CreateContextParams,
10744                    fidl::encoding::DefaultFuchsiaResourceDialect
10745                ),
10746                context: fidl::new_empty!(
10747                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10748                    fidl::encoding::DefaultFuchsiaResourceDialect
10749                ),
10750            }
10751        }
10752
10753        #[inline]
10754        unsafe fn decode(
10755            &mut self,
10756            decoder: &mut fidl::encoding::Decoder<
10757                '_,
10758                fidl::encoding::DefaultFuchsiaResourceDialect,
10759            >,
10760            offset: usize,
10761            _depth: fidl::encoding::Depth,
10762        ) -> fidl::Result<()> {
10763            decoder.debug_check_bounds::<Self>(offset);
10764            // Verify that padding bytes are zero.
10765            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10766            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10767            let mask = 0xffffffff00000000u64;
10768            let maskedval = padval & mask;
10769            if maskedval != 0 {
10770                return Err(fidl::Error::NonZeroPadding {
10771                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10772                });
10773            }
10774            fidl::decode!(
10775                CreateContextParams,
10776                fidl::encoding::DefaultFuchsiaResourceDialect,
10777                &mut self.params,
10778                decoder,
10779                offset + 0,
10780                _depth
10781            )?;
10782            fidl::decode!(
10783                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ContextMarker>>,
10784                fidl::encoding::DefaultFuchsiaResourceDialect,
10785                &mut self.context,
10786                decoder,
10787                offset + 16,
10788                _depth
10789            )?;
10790            Ok(())
10791        }
10792    }
10793
10794    impl fidl::encoding::ResourceTypeMarker for CookieManagerGetCookieListRequest {
10795        type Borrowed<'a> = &'a mut Self;
10796        fn take_or_borrow<'a>(
10797            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10798        ) -> Self::Borrowed<'a> {
10799            value
10800        }
10801    }
10802
10803    unsafe impl fidl::encoding::TypeMarker for CookieManagerGetCookieListRequest {
10804        type Owned = Self;
10805
10806        #[inline(always)]
10807        fn inline_align(_context: fidl::encoding::Context) -> usize {
10808            8
10809        }
10810
10811        #[inline(always)]
10812        fn inline_size(_context: fidl::encoding::Context) -> usize {
10813            40
10814        }
10815    }
10816
10817    unsafe impl
10818        fidl::encoding::Encode<
10819            CookieManagerGetCookieListRequest,
10820            fidl::encoding::DefaultFuchsiaResourceDialect,
10821        > for &mut CookieManagerGetCookieListRequest
10822    {
10823        #[inline]
10824        unsafe fn encode(
10825            self,
10826            encoder: &mut fidl::encoding::Encoder<
10827                '_,
10828                fidl::encoding::DefaultFuchsiaResourceDialect,
10829            >,
10830            offset: usize,
10831            _depth: fidl::encoding::Depth,
10832        ) -> fidl::Result<()> {
10833            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10834            // Delegate to tuple encoding.
10835            fidl::encoding::Encode::<CookieManagerGetCookieListRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10836                (
10837                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
10838                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
10839                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.cookies),
10840                ),
10841                encoder, offset, _depth
10842            )
10843        }
10844    }
10845    unsafe impl<
10846        T0: fidl::encoding::Encode<
10847                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10848                fidl::encoding::DefaultFuchsiaResourceDialect,
10849            >,
10850        T1: fidl::encoding::Encode<
10851                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10852                fidl::encoding::DefaultFuchsiaResourceDialect,
10853            >,
10854        T2: fidl::encoding::Encode<
10855                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10856                fidl::encoding::DefaultFuchsiaResourceDialect,
10857            >,
10858    >
10859        fidl::encoding::Encode<
10860            CookieManagerGetCookieListRequest,
10861            fidl::encoding::DefaultFuchsiaResourceDialect,
10862        > for (T0, T1, T2)
10863    {
10864        #[inline]
10865        unsafe fn encode(
10866            self,
10867            encoder: &mut fidl::encoding::Encoder<
10868                '_,
10869                fidl::encoding::DefaultFuchsiaResourceDialect,
10870            >,
10871            offset: usize,
10872            depth: fidl::encoding::Depth,
10873        ) -> fidl::Result<()> {
10874            encoder.debug_check_bounds::<CookieManagerGetCookieListRequest>(offset);
10875            // Zero out padding regions. There's no need to apply masks
10876            // because the unmasked parts will be overwritten by fields.
10877            unsafe {
10878                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
10879                (ptr as *mut u64).write_unaligned(0);
10880            }
10881            // Write the fields.
10882            self.0.encode(encoder, offset + 0, depth)?;
10883            self.1.encode(encoder, offset + 16, depth)?;
10884            self.2.encode(encoder, offset + 32, depth)?;
10885            Ok(())
10886        }
10887    }
10888
10889    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10890        for CookieManagerGetCookieListRequest
10891    {
10892        #[inline(always)]
10893        fn new_empty() -> Self {
10894            Self {
10895                url: fidl::new_empty!(
10896                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10897                    fidl::encoding::DefaultFuchsiaResourceDialect
10898                ),
10899                name: fidl::new_empty!(
10900                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10901                    fidl::encoding::DefaultFuchsiaResourceDialect
10902                ),
10903                cookies: fidl::new_empty!(
10904                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10905                    fidl::encoding::DefaultFuchsiaResourceDialect
10906                ),
10907            }
10908        }
10909
10910        #[inline]
10911        unsafe fn decode(
10912            &mut self,
10913            decoder: &mut fidl::encoding::Decoder<
10914                '_,
10915                fidl::encoding::DefaultFuchsiaResourceDialect,
10916            >,
10917            offset: usize,
10918            _depth: fidl::encoding::Depth,
10919        ) -> fidl::Result<()> {
10920            decoder.debug_check_bounds::<Self>(offset);
10921            // Verify that padding bytes are zero.
10922            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
10923            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10924            let mask = 0xffffffff00000000u64;
10925            let maskedval = padval & mask;
10926            if maskedval != 0 {
10927                return Err(fidl::Error::NonZeroPadding {
10928                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
10929                });
10930            }
10931            fidl::decode!(
10932                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
10933                fidl::encoding::DefaultFuchsiaResourceDialect,
10934                &mut self.url,
10935                decoder,
10936                offset + 0,
10937                _depth
10938            )?;
10939            fidl::decode!(
10940                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
10941                fidl::encoding::DefaultFuchsiaResourceDialect,
10942                &mut self.name,
10943                decoder,
10944                offset + 16,
10945                _depth
10946            )?;
10947            fidl::decode!(
10948                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
10949                fidl::encoding::DefaultFuchsiaResourceDialect,
10950                &mut self.cookies,
10951                decoder,
10952                offset + 32,
10953                _depth
10954            )?;
10955            Ok(())
10956        }
10957    }
10958
10959    impl fidl::encoding::ResourceTypeMarker for CookieManagerObserveCookieChangesRequest {
10960        type Borrowed<'a> = &'a mut Self;
10961        fn take_or_borrow<'a>(
10962            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10963        ) -> Self::Borrowed<'a> {
10964            value
10965        }
10966    }
10967
10968    unsafe impl fidl::encoding::TypeMarker for CookieManagerObserveCookieChangesRequest {
10969        type Owned = Self;
10970
10971        #[inline(always)]
10972        fn inline_align(_context: fidl::encoding::Context) -> usize {
10973            8
10974        }
10975
10976        #[inline(always)]
10977        fn inline_size(_context: fidl::encoding::Context) -> usize {
10978            40
10979        }
10980    }
10981
10982    unsafe impl
10983        fidl::encoding::Encode<
10984            CookieManagerObserveCookieChangesRequest,
10985            fidl::encoding::DefaultFuchsiaResourceDialect,
10986        > for &mut CookieManagerObserveCookieChangesRequest
10987    {
10988        #[inline]
10989        unsafe fn encode(
10990            self,
10991            encoder: &mut fidl::encoding::Encoder<
10992                '_,
10993                fidl::encoding::DefaultFuchsiaResourceDialect,
10994            >,
10995            offset: usize,
10996            _depth: fidl::encoding::Depth,
10997        ) -> fidl::Result<()> {
10998            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
10999            // Delegate to tuple encoding.
11000            fidl::encoding::Encode::<CookieManagerObserveCookieChangesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11001                (
11002                    <fidl::encoding::Optional<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
11003                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
11004                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changes),
11005                ),
11006                encoder, offset, _depth
11007            )
11008        }
11009    }
11010    unsafe impl<
11011        T0: fidl::encoding::Encode<
11012                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11013                fidl::encoding::DefaultFuchsiaResourceDialect,
11014            >,
11015        T1: fidl::encoding::Encode<
11016                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11017                fidl::encoding::DefaultFuchsiaResourceDialect,
11018            >,
11019        T2: fidl::encoding::Encode<
11020                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11021                fidl::encoding::DefaultFuchsiaResourceDialect,
11022            >,
11023    >
11024        fidl::encoding::Encode<
11025            CookieManagerObserveCookieChangesRequest,
11026            fidl::encoding::DefaultFuchsiaResourceDialect,
11027        > for (T0, T1, T2)
11028    {
11029        #[inline]
11030        unsafe fn encode(
11031            self,
11032            encoder: &mut fidl::encoding::Encoder<
11033                '_,
11034                fidl::encoding::DefaultFuchsiaResourceDialect,
11035            >,
11036            offset: usize,
11037            depth: fidl::encoding::Depth,
11038        ) -> fidl::Result<()> {
11039            encoder.debug_check_bounds::<CookieManagerObserveCookieChangesRequest>(offset);
11040            // Zero out padding regions. There's no need to apply masks
11041            // because the unmasked parts will be overwritten by fields.
11042            unsafe {
11043                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
11044                (ptr as *mut u64).write_unaligned(0);
11045            }
11046            // Write the fields.
11047            self.0.encode(encoder, offset + 0, depth)?;
11048            self.1.encode(encoder, offset + 16, depth)?;
11049            self.2.encode(encoder, offset + 32, depth)?;
11050            Ok(())
11051        }
11052    }
11053
11054    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11055        for CookieManagerObserveCookieChangesRequest
11056    {
11057        #[inline(always)]
11058        fn new_empty() -> Self {
11059            Self {
11060                url: fidl::new_empty!(
11061                    fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11062                    fidl::encoding::DefaultFuchsiaResourceDialect
11063                ),
11064                name: fidl::new_empty!(
11065                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11066                    fidl::encoding::DefaultFuchsiaResourceDialect
11067                ),
11068                changes: fidl::new_empty!(
11069                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11070                    fidl::encoding::DefaultFuchsiaResourceDialect
11071                ),
11072            }
11073        }
11074
11075        #[inline]
11076        unsafe fn decode(
11077            &mut self,
11078            decoder: &mut fidl::encoding::Decoder<
11079                '_,
11080                fidl::encoding::DefaultFuchsiaResourceDialect,
11081            >,
11082            offset: usize,
11083            _depth: fidl::encoding::Depth,
11084        ) -> fidl::Result<()> {
11085            decoder.debug_check_bounds::<Self>(offset);
11086            // Verify that padding bytes are zero.
11087            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
11088            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11089            let mask = 0xffffffff00000000u64;
11090            let maskedval = padval & mask;
11091            if maskedval != 0 {
11092                return Err(fidl::Error::NonZeroPadding {
11093                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
11094                });
11095            }
11096            fidl::decode!(
11097                fidl::encoding::Optional<fidl::encoding::BoundedString<65536>>,
11098                fidl::encoding::DefaultFuchsiaResourceDialect,
11099                &mut self.url,
11100                decoder,
11101                offset + 0,
11102                _depth
11103            )?;
11104            fidl::decode!(
11105                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
11106                fidl::encoding::DefaultFuchsiaResourceDialect,
11107                &mut self.name,
11108                decoder,
11109                offset + 16,
11110                _depth
11111            )?;
11112            fidl::decode!(
11113                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<CookiesIteratorMarker>>,
11114                fidl::encoding::DefaultFuchsiaResourceDialect,
11115                &mut self.changes,
11116                decoder,
11117                offset + 32,
11118                _depth
11119            )?;
11120            Ok(())
11121        }
11122    }
11123
11124    impl fidl::encoding::ResourceTypeMarker for CookiesIteratorGetNextResponse {
11125        type Borrowed<'a> = &'a mut Self;
11126        fn take_or_borrow<'a>(
11127            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11128        ) -> Self::Borrowed<'a> {
11129            value
11130        }
11131    }
11132
11133    unsafe impl fidl::encoding::TypeMarker for CookiesIteratorGetNextResponse {
11134        type Owned = Self;
11135
11136        #[inline(always)]
11137        fn inline_align(_context: fidl::encoding::Context) -> usize {
11138            8
11139        }
11140
11141        #[inline(always)]
11142        fn inline_size(_context: fidl::encoding::Context) -> usize {
11143            16
11144        }
11145    }
11146
11147    unsafe impl
11148        fidl::encoding::Encode<
11149            CookiesIteratorGetNextResponse,
11150            fidl::encoding::DefaultFuchsiaResourceDialect,
11151        > for &mut CookiesIteratorGetNextResponse
11152    {
11153        #[inline]
11154        unsafe fn encode(
11155            self,
11156            encoder: &mut fidl::encoding::Encoder<
11157                '_,
11158                fidl::encoding::DefaultFuchsiaResourceDialect,
11159            >,
11160            offset: usize,
11161            _depth: fidl::encoding::Depth,
11162        ) -> fidl::Result<()> {
11163            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11164            // Delegate to tuple encoding.
11165            fidl::encoding::Encode::<CookiesIteratorGetNextResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11166                (
11167                    <fidl::encoding::UnboundedVector<Cookie> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.changed_cookies),
11168                ),
11169                encoder, offset, _depth
11170            )
11171        }
11172    }
11173    unsafe impl<
11174        T0: fidl::encoding::Encode<
11175                fidl::encoding::UnboundedVector<Cookie>,
11176                fidl::encoding::DefaultFuchsiaResourceDialect,
11177            >,
11178    >
11179        fidl::encoding::Encode<
11180            CookiesIteratorGetNextResponse,
11181            fidl::encoding::DefaultFuchsiaResourceDialect,
11182        > for (T0,)
11183    {
11184        #[inline]
11185        unsafe fn encode(
11186            self,
11187            encoder: &mut fidl::encoding::Encoder<
11188                '_,
11189                fidl::encoding::DefaultFuchsiaResourceDialect,
11190            >,
11191            offset: usize,
11192            depth: fidl::encoding::Depth,
11193        ) -> fidl::Result<()> {
11194            encoder.debug_check_bounds::<CookiesIteratorGetNextResponse>(offset);
11195            // Zero out padding regions. There's no need to apply masks
11196            // because the unmasked parts will be overwritten by fields.
11197            // Write the fields.
11198            self.0.encode(encoder, offset + 0, depth)?;
11199            Ok(())
11200        }
11201    }
11202
11203    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11204        for CookiesIteratorGetNextResponse
11205    {
11206        #[inline(always)]
11207        fn new_empty() -> Self {
11208            Self {
11209                changed_cookies: fidl::new_empty!(
11210                    fidl::encoding::UnboundedVector<Cookie>,
11211                    fidl::encoding::DefaultFuchsiaResourceDialect
11212                ),
11213            }
11214        }
11215
11216        #[inline]
11217        unsafe fn decode(
11218            &mut self,
11219            decoder: &mut fidl::encoding::Decoder<
11220                '_,
11221                fidl::encoding::DefaultFuchsiaResourceDialect,
11222            >,
11223            offset: usize,
11224            _depth: fidl::encoding::Depth,
11225        ) -> fidl::Result<()> {
11226            decoder.debug_check_bounds::<Self>(offset);
11227            // Verify that padding bytes are zero.
11228            fidl::decode!(
11229                fidl::encoding::UnboundedVector<Cookie>,
11230                fidl::encoding::DefaultFuchsiaResourceDialect,
11231                &mut self.changed_cookies,
11232                decoder,
11233                offset + 0,
11234                _depth
11235            )?;
11236            Ok(())
11237        }
11238    }
11239
11240    impl fidl::encoding::ResourceTypeMarker for DebugEnableDevToolsRequest {
11241        type Borrowed<'a> = &'a mut Self;
11242        fn take_or_borrow<'a>(
11243            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11244        ) -> Self::Borrowed<'a> {
11245            value
11246        }
11247    }
11248
11249    unsafe impl fidl::encoding::TypeMarker for DebugEnableDevToolsRequest {
11250        type Owned = Self;
11251
11252        #[inline(always)]
11253        fn inline_align(_context: fidl::encoding::Context) -> usize {
11254            4
11255        }
11256
11257        #[inline(always)]
11258        fn inline_size(_context: fidl::encoding::Context) -> usize {
11259            4
11260        }
11261    }
11262
11263    unsafe impl
11264        fidl::encoding::Encode<
11265            DebugEnableDevToolsRequest,
11266            fidl::encoding::DefaultFuchsiaResourceDialect,
11267        > for &mut DebugEnableDevToolsRequest
11268    {
11269        #[inline]
11270        unsafe fn encode(
11271            self,
11272            encoder: &mut fidl::encoding::Encoder<
11273                '_,
11274                fidl::encoding::DefaultFuchsiaResourceDialect,
11275            >,
11276            offset: usize,
11277            _depth: fidl::encoding::Depth,
11278        ) -> fidl::Result<()> {
11279            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11280            // Delegate to tuple encoding.
11281            fidl::encoding::Encode::<DebugEnableDevToolsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11282                (
11283                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.listener),
11284                ),
11285                encoder, offset, _depth
11286            )
11287        }
11288    }
11289    unsafe impl<
11290        T0: fidl::encoding::Encode<
11291                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11292                fidl::encoding::DefaultFuchsiaResourceDialect,
11293            >,
11294    >
11295        fidl::encoding::Encode<
11296            DebugEnableDevToolsRequest,
11297            fidl::encoding::DefaultFuchsiaResourceDialect,
11298        > for (T0,)
11299    {
11300        #[inline]
11301        unsafe fn encode(
11302            self,
11303            encoder: &mut fidl::encoding::Encoder<
11304                '_,
11305                fidl::encoding::DefaultFuchsiaResourceDialect,
11306            >,
11307            offset: usize,
11308            depth: fidl::encoding::Depth,
11309        ) -> fidl::Result<()> {
11310            encoder.debug_check_bounds::<DebugEnableDevToolsRequest>(offset);
11311            // Zero out padding regions. There's no need to apply masks
11312            // because the unmasked parts will be overwritten by fields.
11313            // Write the fields.
11314            self.0.encode(encoder, offset + 0, depth)?;
11315            Ok(())
11316        }
11317    }
11318
11319    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11320        for DebugEnableDevToolsRequest
11321    {
11322        #[inline(always)]
11323        fn new_empty() -> Self {
11324            Self {
11325                listener: fidl::new_empty!(
11326                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11327                    fidl::encoding::DefaultFuchsiaResourceDialect
11328                ),
11329            }
11330        }
11331
11332        #[inline]
11333        unsafe fn decode(
11334            &mut self,
11335            decoder: &mut fidl::encoding::Decoder<
11336                '_,
11337                fidl::encoding::DefaultFuchsiaResourceDialect,
11338            >,
11339            offset: usize,
11340            _depth: fidl::encoding::Depth,
11341        ) -> fidl::Result<()> {
11342            decoder.debug_check_bounds::<Self>(offset);
11343            // Verify that padding bytes are zero.
11344            fidl::decode!(
11345                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DevToolsListenerMarker>>,
11346                fidl::encoding::DefaultFuchsiaResourceDialect,
11347                &mut self.listener,
11348                decoder,
11349                offset + 0,
11350                _depth
11351            )?;
11352            Ok(())
11353        }
11354    }
11355
11356    impl fidl::encoding::ResourceTypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11357        type Borrowed<'a> = &'a mut Self;
11358        fn take_or_borrow<'a>(
11359            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11360        ) -> Self::Borrowed<'a> {
11361            value
11362        }
11363    }
11364
11365    unsafe impl fidl::encoding::TypeMarker for DevToolsListenerOnContextDevToolsAvailableRequest {
11366        type Owned = Self;
11367
11368        #[inline(always)]
11369        fn inline_align(_context: fidl::encoding::Context) -> usize {
11370            4
11371        }
11372
11373        #[inline(always)]
11374        fn inline_size(_context: fidl::encoding::Context) -> usize {
11375            4
11376        }
11377    }
11378
11379    unsafe impl
11380        fidl::encoding::Encode<
11381            DevToolsListenerOnContextDevToolsAvailableRequest,
11382            fidl::encoding::DefaultFuchsiaResourceDialect,
11383        > for &mut DevToolsListenerOnContextDevToolsAvailableRequest
11384    {
11385        #[inline]
11386        unsafe fn encode(
11387            self,
11388            encoder: &mut fidl::encoding::Encoder<
11389                '_,
11390                fidl::encoding::DefaultFuchsiaResourceDialect,
11391            >,
11392            offset: usize,
11393            _depth: fidl::encoding::Depth,
11394        ) -> fidl::Result<()> {
11395            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11396            // Delegate to tuple encoding.
11397            fidl::encoding::Encode::<
11398                DevToolsListenerOnContextDevToolsAvailableRequest,
11399                fidl::encoding::DefaultFuchsiaResourceDialect,
11400            >::encode(
11401                (<fidl::encoding::Endpoint<
11402                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11403                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11404                    &mut self.listener
11405                ),),
11406                encoder,
11407                offset,
11408                _depth,
11409            )
11410        }
11411    }
11412    unsafe impl<
11413        T0: fidl::encoding::Encode<
11414                fidl::encoding::Endpoint<
11415                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11416                >,
11417                fidl::encoding::DefaultFuchsiaResourceDialect,
11418            >,
11419    >
11420        fidl::encoding::Encode<
11421            DevToolsListenerOnContextDevToolsAvailableRequest,
11422            fidl::encoding::DefaultFuchsiaResourceDialect,
11423        > for (T0,)
11424    {
11425        #[inline]
11426        unsafe fn encode(
11427            self,
11428            encoder: &mut fidl::encoding::Encoder<
11429                '_,
11430                fidl::encoding::DefaultFuchsiaResourceDialect,
11431            >,
11432            offset: usize,
11433            depth: fidl::encoding::Depth,
11434        ) -> fidl::Result<()> {
11435            encoder.debug_check_bounds::<DevToolsListenerOnContextDevToolsAvailableRequest>(offset);
11436            // Zero out padding regions. There's no need to apply masks
11437            // because the unmasked parts will be overwritten by fields.
11438            // Write the fields.
11439            self.0.encode(encoder, offset + 0, depth)?;
11440            Ok(())
11441        }
11442    }
11443
11444    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11445        for DevToolsListenerOnContextDevToolsAvailableRequest
11446    {
11447        #[inline(always)]
11448        fn new_empty() -> Self {
11449            Self {
11450                listener: fidl::new_empty!(
11451                    fidl::encoding::Endpoint<
11452                        fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11453                    >,
11454                    fidl::encoding::DefaultFuchsiaResourceDialect
11455                ),
11456            }
11457        }
11458
11459        #[inline]
11460        unsafe fn decode(
11461            &mut self,
11462            decoder: &mut fidl::encoding::Decoder<
11463                '_,
11464                fidl::encoding::DefaultFuchsiaResourceDialect,
11465            >,
11466            offset: usize,
11467            _depth: fidl::encoding::Depth,
11468        ) -> fidl::Result<()> {
11469            decoder.debug_check_bounds::<Self>(offset);
11470            // Verify that padding bytes are zero.
11471            fidl::decode!(
11472                fidl::encoding::Endpoint<
11473                    fidl::endpoints::ServerEnd<DevToolsPerContextListenerMarker>,
11474                >,
11475                fidl::encoding::DefaultFuchsiaResourceDialect,
11476                &mut self.listener,
11477                decoder,
11478                offset + 0,
11479                _depth
11480            )?;
11481            Ok(())
11482        }
11483    }
11484
11485    impl fidl::encoding::ResourceTypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11486        type Borrowed<'a> = &'a mut Self;
11487        fn take_or_borrow<'a>(
11488            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11489        ) -> Self::Borrowed<'a> {
11490            value
11491        }
11492    }
11493
11494    unsafe impl fidl::encoding::TypeMarker for FrameAddBeforeLoadJavaScriptRequest {
11495        type Owned = Self;
11496
11497        #[inline(always)]
11498        fn inline_align(_context: fidl::encoding::Context) -> usize {
11499            8
11500        }
11501
11502        #[inline(always)]
11503        fn inline_size(_context: fidl::encoding::Context) -> usize {
11504            40
11505        }
11506    }
11507
11508    unsafe impl
11509        fidl::encoding::Encode<
11510            FrameAddBeforeLoadJavaScriptRequest,
11511            fidl::encoding::DefaultFuchsiaResourceDialect,
11512        > for &mut FrameAddBeforeLoadJavaScriptRequest
11513    {
11514        #[inline]
11515        unsafe fn encode(
11516            self,
11517            encoder: &mut fidl::encoding::Encoder<
11518                '_,
11519                fidl::encoding::DefaultFuchsiaResourceDialect,
11520            >,
11521            offset: usize,
11522            _depth: fidl::encoding::Depth,
11523        ) -> fidl::Result<()> {
11524            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11525            // Delegate to tuple encoding.
11526            fidl::encoding::Encode::<FrameAddBeforeLoadJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11527                (
11528                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
11529                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
11530                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
11531                ),
11532                encoder, offset, _depth
11533            )
11534        }
11535    }
11536    unsafe impl<
11537        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
11538        T1: fidl::encoding::Encode<
11539                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11540                fidl::encoding::DefaultFuchsiaResourceDialect,
11541            >,
11542        T2: fidl::encoding::Encode<
11543                fidl_fuchsia_mem::Buffer,
11544                fidl::encoding::DefaultFuchsiaResourceDialect,
11545            >,
11546    >
11547        fidl::encoding::Encode<
11548            FrameAddBeforeLoadJavaScriptRequest,
11549            fidl::encoding::DefaultFuchsiaResourceDialect,
11550        > for (T0, T1, T2)
11551    {
11552        #[inline]
11553        unsafe fn encode(
11554            self,
11555            encoder: &mut fidl::encoding::Encoder<
11556                '_,
11557                fidl::encoding::DefaultFuchsiaResourceDialect,
11558            >,
11559            offset: usize,
11560            depth: fidl::encoding::Depth,
11561        ) -> fidl::Result<()> {
11562            encoder.debug_check_bounds::<FrameAddBeforeLoadJavaScriptRequest>(offset);
11563            // Zero out padding regions. There's no need to apply masks
11564            // because the unmasked parts will be overwritten by fields.
11565            // Write the fields.
11566            self.0.encode(encoder, offset + 0, depth)?;
11567            self.1.encode(encoder, offset + 8, depth)?;
11568            self.2.encode(encoder, offset + 24, depth)?;
11569            Ok(())
11570        }
11571    }
11572
11573    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11574        for FrameAddBeforeLoadJavaScriptRequest
11575    {
11576        #[inline(always)]
11577        fn new_empty() -> Self {
11578            Self {
11579                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
11580                origins: fidl::new_empty!(
11581                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11582                    fidl::encoding::DefaultFuchsiaResourceDialect
11583                ),
11584                script: fidl::new_empty!(
11585                    fidl_fuchsia_mem::Buffer,
11586                    fidl::encoding::DefaultFuchsiaResourceDialect
11587                ),
11588            }
11589        }
11590
11591        #[inline]
11592        unsafe fn decode(
11593            &mut self,
11594            decoder: &mut fidl::encoding::Decoder<
11595                '_,
11596                fidl::encoding::DefaultFuchsiaResourceDialect,
11597            >,
11598            offset: usize,
11599            _depth: fidl::encoding::Depth,
11600        ) -> fidl::Result<()> {
11601            decoder.debug_check_bounds::<Self>(offset);
11602            // Verify that padding bytes are zero.
11603            fidl::decode!(
11604                u64,
11605                fidl::encoding::DefaultFuchsiaResourceDialect,
11606                &mut self.id,
11607                decoder,
11608                offset + 0,
11609                _depth
11610            )?;
11611            fidl::decode!(
11612                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
11613                fidl::encoding::DefaultFuchsiaResourceDialect,
11614                &mut self.origins,
11615                decoder,
11616                offset + 8,
11617                _depth
11618            )?;
11619            fidl::decode!(
11620                fidl_fuchsia_mem::Buffer,
11621                fidl::encoding::DefaultFuchsiaResourceDialect,
11622                &mut self.script,
11623                decoder,
11624                offset + 24,
11625                _depth
11626            )?;
11627            Ok(())
11628        }
11629    }
11630
11631    impl fidl::encoding::ResourceTypeMarker for FrameCreateView2Request {
11632        type Borrowed<'a> = &'a mut Self;
11633        fn take_or_borrow<'a>(
11634            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11635        ) -> Self::Borrowed<'a> {
11636            value
11637        }
11638    }
11639
11640    unsafe impl fidl::encoding::TypeMarker for FrameCreateView2Request {
11641        type Owned = Self;
11642
11643        #[inline(always)]
11644        fn inline_align(_context: fidl::encoding::Context) -> usize {
11645            8
11646        }
11647
11648        #[inline(always)]
11649        fn inline_size(_context: fidl::encoding::Context) -> usize {
11650            16
11651        }
11652    }
11653
11654    unsafe impl
11655        fidl::encoding::Encode<
11656            FrameCreateView2Request,
11657            fidl::encoding::DefaultFuchsiaResourceDialect,
11658        > for &mut FrameCreateView2Request
11659    {
11660        #[inline]
11661        unsafe fn encode(
11662            self,
11663            encoder: &mut fidl::encoding::Encoder<
11664                '_,
11665                fidl::encoding::DefaultFuchsiaResourceDialect,
11666            >,
11667            offset: usize,
11668            _depth: fidl::encoding::Depth,
11669        ) -> fidl::Result<()> {
11670            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11671            // Delegate to tuple encoding.
11672            fidl::encoding::Encode::<
11673                FrameCreateView2Request,
11674                fidl::encoding::DefaultFuchsiaResourceDialect,
11675            >::encode(
11676                (<CreateView2Args as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11677                    &mut self.args,
11678                ),),
11679                encoder,
11680                offset,
11681                _depth,
11682            )
11683        }
11684    }
11685    unsafe impl<
11686        T0: fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>,
11687    >
11688        fidl::encoding::Encode<
11689            FrameCreateView2Request,
11690            fidl::encoding::DefaultFuchsiaResourceDialect,
11691        > for (T0,)
11692    {
11693        #[inline]
11694        unsafe fn encode(
11695            self,
11696            encoder: &mut fidl::encoding::Encoder<
11697                '_,
11698                fidl::encoding::DefaultFuchsiaResourceDialect,
11699            >,
11700            offset: usize,
11701            depth: fidl::encoding::Depth,
11702        ) -> fidl::Result<()> {
11703            encoder.debug_check_bounds::<FrameCreateView2Request>(offset);
11704            // Zero out padding regions. There's no need to apply masks
11705            // because the unmasked parts will be overwritten by fields.
11706            // Write the fields.
11707            self.0.encode(encoder, offset + 0, depth)?;
11708            Ok(())
11709        }
11710    }
11711
11712    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11713        for FrameCreateView2Request
11714    {
11715        #[inline(always)]
11716        fn new_empty() -> Self {
11717            Self {
11718                args: fidl::new_empty!(
11719                    CreateView2Args,
11720                    fidl::encoding::DefaultFuchsiaResourceDialect
11721                ),
11722            }
11723        }
11724
11725        #[inline]
11726        unsafe fn decode(
11727            &mut self,
11728            decoder: &mut fidl::encoding::Decoder<
11729                '_,
11730                fidl::encoding::DefaultFuchsiaResourceDialect,
11731            >,
11732            offset: usize,
11733            _depth: fidl::encoding::Depth,
11734        ) -> fidl::Result<()> {
11735            decoder.debug_check_bounds::<Self>(offset);
11736            // Verify that padding bytes are zero.
11737            fidl::decode!(
11738                CreateView2Args,
11739                fidl::encoding::DefaultFuchsiaResourceDialect,
11740                &mut self.args,
11741                decoder,
11742                offset + 0,
11743                _depth
11744            )?;
11745            Ok(())
11746        }
11747    }
11748
11749    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewRequest {
11750        type Borrowed<'a> = &'a mut Self;
11751        fn take_or_borrow<'a>(
11752            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11753        ) -> Self::Borrowed<'a> {
11754            value
11755        }
11756    }
11757
11758    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewRequest {
11759        type Owned = Self;
11760
11761        #[inline(always)]
11762        fn inline_align(_context: fidl::encoding::Context) -> usize {
11763            4
11764        }
11765
11766        #[inline(always)]
11767        fn inline_size(_context: fidl::encoding::Context) -> usize {
11768            4
11769        }
11770    }
11771
11772    unsafe impl
11773        fidl::encoding::Encode<
11774            FrameCreateViewRequest,
11775            fidl::encoding::DefaultFuchsiaResourceDialect,
11776        > for &mut FrameCreateViewRequest
11777    {
11778        #[inline]
11779        unsafe fn encode(
11780            self,
11781            encoder: &mut fidl::encoding::Encoder<
11782                '_,
11783                fidl::encoding::DefaultFuchsiaResourceDialect,
11784            >,
11785            offset: usize,
11786            _depth: fidl::encoding::Depth,
11787        ) -> fidl::Result<()> {
11788            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11789            // Delegate to tuple encoding.
11790            fidl::encoding::Encode::<FrameCreateViewRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11791                (
11792                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11793                ),
11794                encoder, offset, _depth
11795            )
11796        }
11797    }
11798    unsafe impl<
11799        T0: fidl::encoding::Encode<
11800                fidl_fuchsia_ui_views::ViewToken,
11801                fidl::encoding::DefaultFuchsiaResourceDialect,
11802            >,
11803    >
11804        fidl::encoding::Encode<
11805            FrameCreateViewRequest,
11806            fidl::encoding::DefaultFuchsiaResourceDialect,
11807        > for (T0,)
11808    {
11809        #[inline]
11810        unsafe fn encode(
11811            self,
11812            encoder: &mut fidl::encoding::Encoder<
11813                '_,
11814                fidl::encoding::DefaultFuchsiaResourceDialect,
11815            >,
11816            offset: usize,
11817            depth: fidl::encoding::Depth,
11818        ) -> fidl::Result<()> {
11819            encoder.debug_check_bounds::<FrameCreateViewRequest>(offset);
11820            // Zero out padding regions. There's no need to apply masks
11821            // because the unmasked parts will be overwritten by fields.
11822            // Write the fields.
11823            self.0.encode(encoder, offset + 0, depth)?;
11824            Ok(())
11825        }
11826    }
11827
11828    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11829        for FrameCreateViewRequest
11830    {
11831        #[inline(always)]
11832        fn new_empty() -> Self {
11833            Self {
11834                view_token: fidl::new_empty!(
11835                    fidl_fuchsia_ui_views::ViewToken,
11836                    fidl::encoding::DefaultFuchsiaResourceDialect
11837                ),
11838            }
11839        }
11840
11841        #[inline]
11842        unsafe fn decode(
11843            &mut self,
11844            decoder: &mut fidl::encoding::Decoder<
11845                '_,
11846                fidl::encoding::DefaultFuchsiaResourceDialect,
11847            >,
11848            offset: usize,
11849            _depth: fidl::encoding::Depth,
11850        ) -> fidl::Result<()> {
11851            decoder.debug_check_bounds::<Self>(offset);
11852            // Verify that padding bytes are zero.
11853            fidl::decode!(
11854                fidl_fuchsia_ui_views::ViewToken,
11855                fidl::encoding::DefaultFuchsiaResourceDialect,
11856                &mut self.view_token,
11857                decoder,
11858                offset + 0,
11859                _depth
11860            )?;
11861            Ok(())
11862        }
11863    }
11864
11865    impl fidl::encoding::ResourceTypeMarker for FrameCreateViewWithViewRefRequest {
11866        type Borrowed<'a> = &'a mut Self;
11867        fn take_or_borrow<'a>(
11868            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11869        ) -> Self::Borrowed<'a> {
11870            value
11871        }
11872    }
11873
11874    unsafe impl fidl::encoding::TypeMarker for FrameCreateViewWithViewRefRequest {
11875        type Owned = Self;
11876
11877        #[inline(always)]
11878        fn inline_align(_context: fidl::encoding::Context) -> usize {
11879            4
11880        }
11881
11882        #[inline(always)]
11883        fn inline_size(_context: fidl::encoding::Context) -> usize {
11884            12
11885        }
11886    }
11887
11888    unsafe impl
11889        fidl::encoding::Encode<
11890            FrameCreateViewWithViewRefRequest,
11891            fidl::encoding::DefaultFuchsiaResourceDialect,
11892        > for &mut FrameCreateViewWithViewRefRequest
11893    {
11894        #[inline]
11895        unsafe fn encode(
11896            self,
11897            encoder: &mut fidl::encoding::Encoder<
11898                '_,
11899                fidl::encoding::DefaultFuchsiaResourceDialect,
11900            >,
11901            offset: usize,
11902            _depth: fidl::encoding::Depth,
11903        ) -> fidl::Result<()> {
11904            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11905            // Delegate to tuple encoding.
11906            fidl::encoding::Encode::<FrameCreateViewWithViewRefRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11907                (
11908                    <fidl_fuchsia_ui_views::ViewToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_token),
11909                    <fidl_fuchsia_ui_views::ViewRefControl as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref_control),
11910                    <fidl_fuchsia_ui_views::ViewRef as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.view_ref),
11911                ),
11912                encoder, offset, _depth
11913            )
11914        }
11915    }
11916    unsafe impl<
11917        T0: fidl::encoding::Encode<
11918                fidl_fuchsia_ui_views::ViewToken,
11919                fidl::encoding::DefaultFuchsiaResourceDialect,
11920            >,
11921        T1: fidl::encoding::Encode<
11922                fidl_fuchsia_ui_views::ViewRefControl,
11923                fidl::encoding::DefaultFuchsiaResourceDialect,
11924            >,
11925        T2: fidl::encoding::Encode<
11926                fidl_fuchsia_ui_views::ViewRef,
11927                fidl::encoding::DefaultFuchsiaResourceDialect,
11928            >,
11929    >
11930        fidl::encoding::Encode<
11931            FrameCreateViewWithViewRefRequest,
11932            fidl::encoding::DefaultFuchsiaResourceDialect,
11933        > for (T0, T1, T2)
11934    {
11935        #[inline]
11936        unsafe fn encode(
11937            self,
11938            encoder: &mut fidl::encoding::Encoder<
11939                '_,
11940                fidl::encoding::DefaultFuchsiaResourceDialect,
11941            >,
11942            offset: usize,
11943            depth: fidl::encoding::Depth,
11944        ) -> fidl::Result<()> {
11945            encoder.debug_check_bounds::<FrameCreateViewWithViewRefRequest>(offset);
11946            // Zero out padding regions. There's no need to apply masks
11947            // because the unmasked parts will be overwritten by fields.
11948            // Write the fields.
11949            self.0.encode(encoder, offset + 0, depth)?;
11950            self.1.encode(encoder, offset + 4, depth)?;
11951            self.2.encode(encoder, offset + 8, depth)?;
11952            Ok(())
11953        }
11954    }
11955
11956    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11957        for FrameCreateViewWithViewRefRequest
11958    {
11959        #[inline(always)]
11960        fn new_empty() -> Self {
11961            Self {
11962                view_token: fidl::new_empty!(
11963                    fidl_fuchsia_ui_views::ViewToken,
11964                    fidl::encoding::DefaultFuchsiaResourceDialect
11965                ),
11966                view_ref_control: fidl::new_empty!(
11967                    fidl_fuchsia_ui_views::ViewRefControl,
11968                    fidl::encoding::DefaultFuchsiaResourceDialect
11969                ),
11970                view_ref: fidl::new_empty!(
11971                    fidl_fuchsia_ui_views::ViewRef,
11972                    fidl::encoding::DefaultFuchsiaResourceDialect
11973                ),
11974            }
11975        }
11976
11977        #[inline]
11978        unsafe fn decode(
11979            &mut self,
11980            decoder: &mut fidl::encoding::Decoder<
11981                '_,
11982                fidl::encoding::DefaultFuchsiaResourceDialect,
11983            >,
11984            offset: usize,
11985            _depth: fidl::encoding::Depth,
11986        ) -> fidl::Result<()> {
11987            decoder.debug_check_bounds::<Self>(offset);
11988            // Verify that padding bytes are zero.
11989            fidl::decode!(
11990                fidl_fuchsia_ui_views::ViewToken,
11991                fidl::encoding::DefaultFuchsiaResourceDialect,
11992                &mut self.view_token,
11993                decoder,
11994                offset + 0,
11995                _depth
11996            )?;
11997            fidl::decode!(
11998                fidl_fuchsia_ui_views::ViewRefControl,
11999                fidl::encoding::DefaultFuchsiaResourceDialect,
12000                &mut self.view_ref_control,
12001                decoder,
12002                offset + 4,
12003                _depth
12004            )?;
12005            fidl::decode!(
12006                fidl_fuchsia_ui_views::ViewRef,
12007                fidl::encoding::DefaultFuchsiaResourceDialect,
12008                &mut self.view_ref,
12009                decoder,
12010                offset + 8,
12011                _depth
12012            )?;
12013            Ok(())
12014        }
12015    }
12016
12017    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptNoResultRequest {
12018        type Borrowed<'a> = &'a mut Self;
12019        fn take_or_borrow<'a>(
12020            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12021        ) -> Self::Borrowed<'a> {
12022            value
12023        }
12024    }
12025
12026    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptNoResultRequest {
12027        type Owned = Self;
12028
12029        #[inline(always)]
12030        fn inline_align(_context: fidl::encoding::Context) -> usize {
12031            8
12032        }
12033
12034        #[inline(always)]
12035        fn inline_size(_context: fidl::encoding::Context) -> usize {
12036            32
12037        }
12038    }
12039
12040    unsafe impl
12041        fidl::encoding::Encode<
12042            FrameExecuteJavaScriptNoResultRequest,
12043            fidl::encoding::DefaultFuchsiaResourceDialect,
12044        > for &mut FrameExecuteJavaScriptNoResultRequest
12045    {
12046        #[inline]
12047        unsafe fn encode(
12048            self,
12049            encoder: &mut fidl::encoding::Encoder<
12050                '_,
12051                fidl::encoding::DefaultFuchsiaResourceDialect,
12052            >,
12053            offset: usize,
12054            _depth: fidl::encoding::Depth,
12055        ) -> fidl::Result<()> {
12056            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
12057            // Delegate to tuple encoding.
12058            fidl::encoding::Encode::<FrameExecuteJavaScriptNoResultRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12059                (
12060                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12061                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12062                ),
12063                encoder, offset, _depth
12064            )
12065        }
12066    }
12067    unsafe impl<
12068        T0: fidl::encoding::Encode<
12069                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12070                fidl::encoding::DefaultFuchsiaResourceDialect,
12071            >,
12072        T1: fidl::encoding::Encode<
12073                fidl_fuchsia_mem::Buffer,
12074                fidl::encoding::DefaultFuchsiaResourceDialect,
12075            >,
12076    >
12077        fidl::encoding::Encode<
12078            FrameExecuteJavaScriptNoResultRequest,
12079            fidl::encoding::DefaultFuchsiaResourceDialect,
12080        > for (T0, T1)
12081    {
12082        #[inline]
12083        unsafe fn encode(
12084            self,
12085            encoder: &mut fidl::encoding::Encoder<
12086                '_,
12087                fidl::encoding::DefaultFuchsiaResourceDialect,
12088            >,
12089            offset: usize,
12090            depth: fidl::encoding::Depth,
12091        ) -> fidl::Result<()> {
12092            encoder.debug_check_bounds::<FrameExecuteJavaScriptNoResultRequest>(offset);
12093            // Zero out padding regions. There's no need to apply masks
12094            // because the unmasked parts will be overwritten by fields.
12095            // Write the fields.
12096            self.0.encode(encoder, offset + 0, depth)?;
12097            self.1.encode(encoder, offset + 16, depth)?;
12098            Ok(())
12099        }
12100    }
12101
12102    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12103        for FrameExecuteJavaScriptNoResultRequest
12104    {
12105        #[inline(always)]
12106        fn new_empty() -> Self {
12107            Self {
12108                origins: fidl::new_empty!(
12109                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12110                    fidl::encoding::DefaultFuchsiaResourceDialect
12111                ),
12112                script: fidl::new_empty!(
12113                    fidl_fuchsia_mem::Buffer,
12114                    fidl::encoding::DefaultFuchsiaResourceDialect
12115                ),
12116            }
12117        }
12118
12119        #[inline]
12120        unsafe fn decode(
12121            &mut self,
12122            decoder: &mut fidl::encoding::Decoder<
12123                '_,
12124                fidl::encoding::DefaultFuchsiaResourceDialect,
12125            >,
12126            offset: usize,
12127            _depth: fidl::encoding::Depth,
12128        ) -> fidl::Result<()> {
12129            decoder.debug_check_bounds::<Self>(offset);
12130            // Verify that padding bytes are zero.
12131            fidl::decode!(
12132                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12133                fidl::encoding::DefaultFuchsiaResourceDialect,
12134                &mut self.origins,
12135                decoder,
12136                offset + 0,
12137                _depth
12138            )?;
12139            fidl::decode!(
12140                fidl_fuchsia_mem::Buffer,
12141                fidl::encoding::DefaultFuchsiaResourceDialect,
12142                &mut self.script,
12143                decoder,
12144                offset + 16,
12145                _depth
12146            )?;
12147            Ok(())
12148        }
12149    }
12150
12151    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptRequest {
12152        type Borrowed<'a> = &'a mut Self;
12153        fn take_or_borrow<'a>(
12154            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12155        ) -> Self::Borrowed<'a> {
12156            value
12157        }
12158    }
12159
12160    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptRequest {
12161        type Owned = Self;
12162
12163        #[inline(always)]
12164        fn inline_align(_context: fidl::encoding::Context) -> usize {
12165            8
12166        }
12167
12168        #[inline(always)]
12169        fn inline_size(_context: fidl::encoding::Context) -> usize {
12170            32
12171        }
12172    }
12173
12174    unsafe impl
12175        fidl::encoding::Encode<
12176            FrameExecuteJavaScriptRequest,
12177            fidl::encoding::DefaultFuchsiaResourceDialect,
12178        > for &mut FrameExecuteJavaScriptRequest
12179    {
12180        #[inline]
12181        unsafe fn encode(
12182            self,
12183            encoder: &mut fidl::encoding::Encoder<
12184                '_,
12185                fidl::encoding::DefaultFuchsiaResourceDialect,
12186            >,
12187            offset: usize,
12188            _depth: fidl::encoding::Depth,
12189        ) -> fidl::Result<()> {
12190            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12191            // Delegate to tuple encoding.
12192            fidl::encoding::Encode::<FrameExecuteJavaScriptRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12193                (
12194                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>> as fidl::encoding::ValueTypeMarker>::borrow(&self.origins),
12195                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.script),
12196                ),
12197                encoder, offset, _depth
12198            )
12199        }
12200    }
12201    unsafe impl<
12202        T0: fidl::encoding::Encode<
12203                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12204                fidl::encoding::DefaultFuchsiaResourceDialect,
12205            >,
12206        T1: fidl::encoding::Encode<
12207                fidl_fuchsia_mem::Buffer,
12208                fidl::encoding::DefaultFuchsiaResourceDialect,
12209            >,
12210    >
12211        fidl::encoding::Encode<
12212            FrameExecuteJavaScriptRequest,
12213            fidl::encoding::DefaultFuchsiaResourceDialect,
12214        > for (T0, T1)
12215    {
12216        #[inline]
12217        unsafe fn encode(
12218            self,
12219            encoder: &mut fidl::encoding::Encoder<
12220                '_,
12221                fidl::encoding::DefaultFuchsiaResourceDialect,
12222            >,
12223            offset: usize,
12224            depth: fidl::encoding::Depth,
12225        ) -> fidl::Result<()> {
12226            encoder.debug_check_bounds::<FrameExecuteJavaScriptRequest>(offset);
12227            // Zero out padding regions. There's no need to apply masks
12228            // because the unmasked parts will be overwritten by fields.
12229            // Write the fields.
12230            self.0.encode(encoder, offset + 0, depth)?;
12231            self.1.encode(encoder, offset + 16, depth)?;
12232            Ok(())
12233        }
12234    }
12235
12236    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12237        for FrameExecuteJavaScriptRequest
12238    {
12239        #[inline(always)]
12240        fn new_empty() -> Self {
12241            Self {
12242                origins: fidl::new_empty!(
12243                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12244                    fidl::encoding::DefaultFuchsiaResourceDialect
12245                ),
12246                script: fidl::new_empty!(
12247                    fidl_fuchsia_mem::Buffer,
12248                    fidl::encoding::DefaultFuchsiaResourceDialect
12249                ),
12250            }
12251        }
12252
12253        #[inline]
12254        unsafe fn decode(
12255            &mut self,
12256            decoder: &mut fidl::encoding::Decoder<
12257                '_,
12258                fidl::encoding::DefaultFuchsiaResourceDialect,
12259            >,
12260            offset: usize,
12261            _depth: fidl::encoding::Depth,
12262        ) -> fidl::Result<()> {
12263            decoder.debug_check_bounds::<Self>(offset);
12264            // Verify that padding bytes are zero.
12265            fidl::decode!(
12266                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<65536>>,
12267                fidl::encoding::DefaultFuchsiaResourceDialect,
12268                &mut self.origins,
12269                decoder,
12270                offset + 0,
12271                _depth
12272            )?;
12273            fidl::decode!(
12274                fidl_fuchsia_mem::Buffer,
12275                fidl::encoding::DefaultFuchsiaResourceDialect,
12276                &mut self.script,
12277                decoder,
12278                offset + 16,
12279                _depth
12280            )?;
12281            Ok(())
12282        }
12283    }
12284
12285    impl fidl::encoding::ResourceTypeMarker for FrameGetMediaPlayerRequest {
12286        type Borrowed<'a> = &'a mut Self;
12287        fn take_or_borrow<'a>(
12288            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12289        ) -> Self::Borrowed<'a> {
12290            value
12291        }
12292    }
12293
12294    unsafe impl fidl::encoding::TypeMarker for FrameGetMediaPlayerRequest {
12295        type Owned = Self;
12296
12297        #[inline(always)]
12298        fn inline_align(_context: fidl::encoding::Context) -> usize {
12299            4
12300        }
12301
12302        #[inline(always)]
12303        fn inline_size(_context: fidl::encoding::Context) -> usize {
12304            4
12305        }
12306    }
12307
12308    unsafe impl
12309        fidl::encoding::Encode<
12310            FrameGetMediaPlayerRequest,
12311            fidl::encoding::DefaultFuchsiaResourceDialect,
12312        > for &mut FrameGetMediaPlayerRequest
12313    {
12314        #[inline]
12315        unsafe fn encode(
12316            self,
12317            encoder: &mut fidl::encoding::Encoder<
12318                '_,
12319                fidl::encoding::DefaultFuchsiaResourceDialect,
12320            >,
12321            offset: usize,
12322            _depth: fidl::encoding::Depth,
12323        ) -> fidl::Result<()> {
12324            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12325            // Delegate to tuple encoding.
12326            fidl::encoding::Encode::<
12327                FrameGetMediaPlayerRequest,
12328                fidl::encoding::DefaultFuchsiaResourceDialect,
12329            >::encode(
12330                (<fidl::encoding::Endpoint<
12331                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12332                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12333                    &mut self.player
12334                ),),
12335                encoder,
12336                offset,
12337                _depth,
12338            )
12339        }
12340    }
12341    unsafe impl<
12342        T0: fidl::encoding::Encode<
12343                fidl::encoding::Endpoint<
12344                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12345                >,
12346                fidl::encoding::DefaultFuchsiaResourceDialect,
12347            >,
12348    >
12349        fidl::encoding::Encode<
12350            FrameGetMediaPlayerRequest,
12351            fidl::encoding::DefaultFuchsiaResourceDialect,
12352        > for (T0,)
12353    {
12354        #[inline]
12355        unsafe fn encode(
12356            self,
12357            encoder: &mut fidl::encoding::Encoder<
12358                '_,
12359                fidl::encoding::DefaultFuchsiaResourceDialect,
12360            >,
12361            offset: usize,
12362            depth: fidl::encoding::Depth,
12363        ) -> fidl::Result<()> {
12364            encoder.debug_check_bounds::<FrameGetMediaPlayerRequest>(offset);
12365            // Zero out padding regions. There's no need to apply masks
12366            // because the unmasked parts will be overwritten by fields.
12367            // Write the fields.
12368            self.0.encode(encoder, offset + 0, depth)?;
12369            Ok(())
12370        }
12371    }
12372
12373    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12374        for FrameGetMediaPlayerRequest
12375    {
12376        #[inline(always)]
12377        fn new_empty() -> Self {
12378            Self {
12379                player: fidl::new_empty!(
12380                    fidl::encoding::Endpoint<
12381                        fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12382                    >,
12383                    fidl::encoding::DefaultFuchsiaResourceDialect
12384                ),
12385            }
12386        }
12387
12388        #[inline]
12389        unsafe fn decode(
12390            &mut self,
12391            decoder: &mut fidl::encoding::Decoder<
12392                '_,
12393                fidl::encoding::DefaultFuchsiaResourceDialect,
12394            >,
12395            offset: usize,
12396            _depth: fidl::encoding::Depth,
12397        ) -> fidl::Result<()> {
12398            decoder.debug_check_bounds::<Self>(offset);
12399            // Verify that padding bytes are zero.
12400            fidl::decode!(
12401                fidl::encoding::Endpoint<
12402                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_sessions2::PlayerMarker>,
12403                >,
12404                fidl::encoding::DefaultFuchsiaResourceDialect,
12405                &mut self.player,
12406                decoder,
12407                offset + 0,
12408                _depth
12409            )?;
12410            Ok(())
12411        }
12412    }
12413
12414    impl fidl::encoding::ResourceTypeMarker for FrameGetNavigationControllerRequest {
12415        type Borrowed<'a> = &'a mut Self;
12416        fn take_or_borrow<'a>(
12417            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12418        ) -> Self::Borrowed<'a> {
12419            value
12420        }
12421    }
12422
12423    unsafe impl fidl::encoding::TypeMarker for FrameGetNavigationControllerRequest {
12424        type Owned = Self;
12425
12426        #[inline(always)]
12427        fn inline_align(_context: fidl::encoding::Context) -> usize {
12428            4
12429        }
12430
12431        #[inline(always)]
12432        fn inline_size(_context: fidl::encoding::Context) -> usize {
12433            4
12434        }
12435    }
12436
12437    unsafe impl
12438        fidl::encoding::Encode<
12439            FrameGetNavigationControllerRequest,
12440            fidl::encoding::DefaultFuchsiaResourceDialect,
12441        > for &mut FrameGetNavigationControllerRequest
12442    {
12443        #[inline]
12444        unsafe fn encode(
12445            self,
12446            encoder: &mut fidl::encoding::Encoder<
12447                '_,
12448                fidl::encoding::DefaultFuchsiaResourceDialect,
12449            >,
12450            offset: usize,
12451            _depth: fidl::encoding::Depth,
12452        ) -> fidl::Result<()> {
12453            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12454            // Delegate to tuple encoding.
12455            fidl::encoding::Encode::<
12456                FrameGetNavigationControllerRequest,
12457                fidl::encoding::DefaultFuchsiaResourceDialect,
12458            >::encode(
12459                (
12460                    <fidl::encoding::Endpoint<
12461                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12462                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12463                        &mut self.controller
12464                    ),
12465                ),
12466                encoder,
12467                offset,
12468                _depth,
12469            )
12470        }
12471    }
12472    unsafe impl<
12473        T0: fidl::encoding::Encode<
12474                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12475                fidl::encoding::DefaultFuchsiaResourceDialect,
12476            >,
12477    >
12478        fidl::encoding::Encode<
12479            FrameGetNavigationControllerRequest,
12480            fidl::encoding::DefaultFuchsiaResourceDialect,
12481        > for (T0,)
12482    {
12483        #[inline]
12484        unsafe fn encode(
12485            self,
12486            encoder: &mut fidl::encoding::Encoder<
12487                '_,
12488                fidl::encoding::DefaultFuchsiaResourceDialect,
12489            >,
12490            offset: usize,
12491            depth: fidl::encoding::Depth,
12492        ) -> fidl::Result<()> {
12493            encoder.debug_check_bounds::<FrameGetNavigationControllerRequest>(offset);
12494            // Zero out padding regions. There's no need to apply masks
12495            // because the unmasked parts will be overwritten by fields.
12496            // Write the fields.
12497            self.0.encode(encoder, offset + 0, depth)?;
12498            Ok(())
12499        }
12500    }
12501
12502    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12503        for FrameGetNavigationControllerRequest
12504    {
12505        #[inline(always)]
12506        fn new_empty() -> Self {
12507            Self {
12508                controller: fidl::new_empty!(
12509                    fidl::encoding::Endpoint<
12510                        fidl::endpoints::ServerEnd<NavigationControllerMarker>,
12511                    >,
12512                    fidl::encoding::DefaultFuchsiaResourceDialect
12513                ),
12514            }
12515        }
12516
12517        #[inline]
12518        unsafe fn decode(
12519            &mut self,
12520            decoder: &mut fidl::encoding::Decoder<
12521                '_,
12522                fidl::encoding::DefaultFuchsiaResourceDialect,
12523            >,
12524            offset: usize,
12525            _depth: fidl::encoding::Depth,
12526        ) -> fidl::Result<()> {
12527            decoder.debug_check_bounds::<Self>(offset);
12528            // Verify that padding bytes are zero.
12529            fidl::decode!(
12530                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NavigationControllerMarker>>,
12531                fidl::encoding::DefaultFuchsiaResourceDialect,
12532                &mut self.controller,
12533                decoder,
12534                offset + 0,
12535                _depth
12536            )?;
12537            Ok(())
12538        }
12539    }
12540
12541    impl fidl::encoding::ResourceTypeMarker for FrameHostCreateFrameWithParamsRequest {
12542        type Borrowed<'a> = &'a mut Self;
12543        fn take_or_borrow<'a>(
12544            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12545        ) -> Self::Borrowed<'a> {
12546            value
12547        }
12548    }
12549
12550    unsafe impl fidl::encoding::TypeMarker for FrameHostCreateFrameWithParamsRequest {
12551        type Owned = Self;
12552
12553        #[inline(always)]
12554        fn inline_align(_context: fidl::encoding::Context) -> usize {
12555            8
12556        }
12557
12558        #[inline(always)]
12559        fn inline_size(_context: fidl::encoding::Context) -> usize {
12560            24
12561        }
12562    }
12563
12564    unsafe impl
12565        fidl::encoding::Encode<
12566            FrameHostCreateFrameWithParamsRequest,
12567            fidl::encoding::DefaultFuchsiaResourceDialect,
12568        > for &mut FrameHostCreateFrameWithParamsRequest
12569    {
12570        #[inline]
12571        unsafe fn encode(
12572            self,
12573            encoder: &mut fidl::encoding::Encoder<
12574                '_,
12575                fidl::encoding::DefaultFuchsiaResourceDialect,
12576            >,
12577            offset: usize,
12578            _depth: fidl::encoding::Depth,
12579        ) -> fidl::Result<()> {
12580            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12581            // Delegate to tuple encoding.
12582            fidl::encoding::Encode::<FrameHostCreateFrameWithParamsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12583                (
12584                    <CreateFrameParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
12585                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
12586                ),
12587                encoder, offset, _depth
12588            )
12589        }
12590    }
12591    unsafe impl<
12592        T0: fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
12593        T1: fidl::encoding::Encode<
12594                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12595                fidl::encoding::DefaultFuchsiaResourceDialect,
12596            >,
12597    >
12598        fidl::encoding::Encode<
12599            FrameHostCreateFrameWithParamsRequest,
12600            fidl::encoding::DefaultFuchsiaResourceDialect,
12601        > for (T0, T1)
12602    {
12603        #[inline]
12604        unsafe fn encode(
12605            self,
12606            encoder: &mut fidl::encoding::Encoder<
12607                '_,
12608                fidl::encoding::DefaultFuchsiaResourceDialect,
12609            >,
12610            offset: usize,
12611            depth: fidl::encoding::Depth,
12612        ) -> fidl::Result<()> {
12613            encoder.debug_check_bounds::<FrameHostCreateFrameWithParamsRequest>(offset);
12614            // Zero out padding regions. There's no need to apply masks
12615            // because the unmasked parts will be overwritten by fields.
12616            unsafe {
12617                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
12618                (ptr as *mut u64).write_unaligned(0);
12619            }
12620            // Write the fields.
12621            self.0.encode(encoder, offset + 0, depth)?;
12622            self.1.encode(encoder, offset + 16, depth)?;
12623            Ok(())
12624        }
12625    }
12626
12627    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12628        for FrameHostCreateFrameWithParamsRequest
12629    {
12630        #[inline(always)]
12631        fn new_empty() -> Self {
12632            Self {
12633                params: fidl::new_empty!(
12634                    CreateFrameParams,
12635                    fidl::encoding::DefaultFuchsiaResourceDialect
12636                ),
12637                frame: fidl::new_empty!(
12638                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12639                    fidl::encoding::DefaultFuchsiaResourceDialect
12640                ),
12641            }
12642        }
12643
12644        #[inline]
12645        unsafe fn decode(
12646            &mut self,
12647            decoder: &mut fidl::encoding::Decoder<
12648                '_,
12649                fidl::encoding::DefaultFuchsiaResourceDialect,
12650            >,
12651            offset: usize,
12652            _depth: fidl::encoding::Depth,
12653        ) -> fidl::Result<()> {
12654            decoder.debug_check_bounds::<Self>(offset);
12655            // Verify that padding bytes are zero.
12656            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
12657            let padval = unsafe { (ptr as *const u64).read_unaligned() };
12658            let mask = 0xffffffff00000000u64;
12659            let maskedval = padval & mask;
12660            if maskedval != 0 {
12661                return Err(fidl::Error::NonZeroPadding {
12662                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
12663                });
12664            }
12665            fidl::decode!(
12666                CreateFrameParams,
12667                fidl::encoding::DefaultFuchsiaResourceDialect,
12668                &mut self.params,
12669                decoder,
12670                offset + 0,
12671                _depth
12672            )?;
12673            fidl::decode!(
12674                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FrameMarker>>,
12675                fidl::encoding::DefaultFuchsiaResourceDialect,
12676                &mut self.frame,
12677                decoder,
12678                offset + 16,
12679                _depth
12680            )?;
12681            Ok(())
12682        }
12683    }
12684
12685    impl fidl::encoding::ResourceTypeMarker for FramePostMessageRequest {
12686        type Borrowed<'a> = &'a mut Self;
12687        fn take_or_borrow<'a>(
12688            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12689        ) -> Self::Borrowed<'a> {
12690            value
12691        }
12692    }
12693
12694    unsafe impl fidl::encoding::TypeMarker for FramePostMessageRequest {
12695        type Owned = Self;
12696
12697        #[inline(always)]
12698        fn inline_align(_context: fidl::encoding::Context) -> usize {
12699            8
12700        }
12701
12702        #[inline(always)]
12703        fn inline_size(_context: fidl::encoding::Context) -> usize {
12704            32
12705        }
12706    }
12707
12708    unsafe impl
12709        fidl::encoding::Encode<
12710            FramePostMessageRequest,
12711            fidl::encoding::DefaultFuchsiaResourceDialect,
12712        > for &mut FramePostMessageRequest
12713    {
12714        #[inline]
12715        unsafe fn encode(
12716            self,
12717            encoder: &mut fidl::encoding::Encoder<
12718                '_,
12719                fidl::encoding::DefaultFuchsiaResourceDialect,
12720            >,
12721            offset: usize,
12722            _depth: fidl::encoding::Depth,
12723        ) -> fidl::Result<()> {
12724            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12725            // Delegate to tuple encoding.
12726            fidl::encoding::Encode::<FramePostMessageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
12727                (
12728                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.target_origin),
12729                    <WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.message),
12730                ),
12731                encoder, offset, _depth
12732            )
12733        }
12734    }
12735    unsafe impl<
12736        T0: fidl::encoding::Encode<
12737                fidl::encoding::BoundedString<65536>,
12738                fidl::encoding::DefaultFuchsiaResourceDialect,
12739            >,
12740        T1: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
12741    >
12742        fidl::encoding::Encode<
12743            FramePostMessageRequest,
12744            fidl::encoding::DefaultFuchsiaResourceDialect,
12745        > for (T0, T1)
12746    {
12747        #[inline]
12748        unsafe fn encode(
12749            self,
12750            encoder: &mut fidl::encoding::Encoder<
12751                '_,
12752                fidl::encoding::DefaultFuchsiaResourceDialect,
12753            >,
12754            offset: usize,
12755            depth: fidl::encoding::Depth,
12756        ) -> fidl::Result<()> {
12757            encoder.debug_check_bounds::<FramePostMessageRequest>(offset);
12758            // Zero out padding regions. There's no need to apply masks
12759            // because the unmasked parts will be overwritten by fields.
12760            // Write the fields.
12761            self.0.encode(encoder, offset + 0, depth)?;
12762            self.1.encode(encoder, offset + 16, depth)?;
12763            Ok(())
12764        }
12765    }
12766
12767    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12768        for FramePostMessageRequest
12769    {
12770        #[inline(always)]
12771        fn new_empty() -> Self {
12772            Self {
12773                target_origin: fidl::new_empty!(
12774                    fidl::encoding::BoundedString<65536>,
12775                    fidl::encoding::DefaultFuchsiaResourceDialect
12776                ),
12777                message: fidl::new_empty!(
12778                    WebMessage,
12779                    fidl::encoding::DefaultFuchsiaResourceDialect
12780                ),
12781            }
12782        }
12783
12784        #[inline]
12785        unsafe fn decode(
12786            &mut self,
12787            decoder: &mut fidl::encoding::Decoder<
12788                '_,
12789                fidl::encoding::DefaultFuchsiaResourceDialect,
12790            >,
12791            offset: usize,
12792            _depth: fidl::encoding::Depth,
12793        ) -> fidl::Result<()> {
12794            decoder.debug_check_bounds::<Self>(offset);
12795            // Verify that padding bytes are zero.
12796            fidl::decode!(
12797                fidl::encoding::BoundedString<65536>,
12798                fidl::encoding::DefaultFuchsiaResourceDialect,
12799                &mut self.target_origin,
12800                decoder,
12801                offset + 0,
12802                _depth
12803            )?;
12804            fidl::decode!(
12805                WebMessage,
12806                fidl::encoding::DefaultFuchsiaResourceDialect,
12807                &mut self.message,
12808                decoder,
12809                offset + 16,
12810                _depth
12811            )?;
12812            Ok(())
12813        }
12814    }
12815
12816    impl fidl::encoding::ResourceTypeMarker for FrameSetConsoleLogSinkRequest {
12817        type Borrowed<'a> = &'a mut Self;
12818        fn take_or_borrow<'a>(
12819            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12820        ) -> Self::Borrowed<'a> {
12821            value
12822        }
12823    }
12824
12825    unsafe impl fidl::encoding::TypeMarker for FrameSetConsoleLogSinkRequest {
12826        type Owned = Self;
12827
12828        #[inline(always)]
12829        fn inline_align(_context: fidl::encoding::Context) -> usize {
12830            4
12831        }
12832
12833        #[inline(always)]
12834        fn inline_size(_context: fidl::encoding::Context) -> usize {
12835            4
12836        }
12837    }
12838
12839    unsafe impl
12840        fidl::encoding::Encode<
12841            FrameSetConsoleLogSinkRequest,
12842            fidl::encoding::DefaultFuchsiaResourceDialect,
12843        > for &mut FrameSetConsoleLogSinkRequest
12844    {
12845        #[inline]
12846        unsafe fn encode(
12847            self,
12848            encoder: &mut fidl::encoding::Encoder<
12849                '_,
12850                fidl::encoding::DefaultFuchsiaResourceDialect,
12851            >,
12852            offset: usize,
12853            _depth: fidl::encoding::Depth,
12854        ) -> fidl::Result<()> {
12855            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12856            // Delegate to tuple encoding.
12857            fidl::encoding::Encode::<
12858                FrameSetConsoleLogSinkRequest,
12859                fidl::encoding::DefaultFuchsiaResourceDialect,
12860            >::encode(
12861                (<fidl::encoding::Optional<
12862                    fidl::encoding::Endpoint<
12863                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12864                    >,
12865                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12866                    &mut self.sink
12867                ),),
12868                encoder,
12869                offset,
12870                _depth,
12871            )
12872        }
12873    }
12874    unsafe impl<
12875        T0: fidl::encoding::Encode<
12876                fidl::encoding::Optional<
12877                    fidl::encoding::Endpoint<
12878                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12879                    >,
12880                >,
12881                fidl::encoding::DefaultFuchsiaResourceDialect,
12882            >,
12883    >
12884        fidl::encoding::Encode<
12885            FrameSetConsoleLogSinkRequest,
12886            fidl::encoding::DefaultFuchsiaResourceDialect,
12887        > for (T0,)
12888    {
12889        #[inline]
12890        unsafe fn encode(
12891            self,
12892            encoder: &mut fidl::encoding::Encoder<
12893                '_,
12894                fidl::encoding::DefaultFuchsiaResourceDialect,
12895            >,
12896            offset: usize,
12897            depth: fidl::encoding::Depth,
12898        ) -> fidl::Result<()> {
12899            encoder.debug_check_bounds::<FrameSetConsoleLogSinkRequest>(offset);
12900            // Zero out padding regions. There's no need to apply masks
12901            // because the unmasked parts will be overwritten by fields.
12902            // Write the fields.
12903            self.0.encode(encoder, offset + 0, depth)?;
12904            Ok(())
12905        }
12906    }
12907
12908    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12909        for FrameSetConsoleLogSinkRequest
12910    {
12911        #[inline(always)]
12912        fn new_empty() -> Self {
12913            Self {
12914                sink: fidl::new_empty!(
12915                    fidl::encoding::Optional<
12916                        fidl::encoding::Endpoint<
12917                            fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12918                        >,
12919                    >,
12920                    fidl::encoding::DefaultFuchsiaResourceDialect
12921                ),
12922            }
12923        }
12924
12925        #[inline]
12926        unsafe fn decode(
12927            &mut self,
12928            decoder: &mut fidl::encoding::Decoder<
12929                '_,
12930                fidl::encoding::DefaultFuchsiaResourceDialect,
12931            >,
12932            offset: usize,
12933            _depth: fidl::encoding::Depth,
12934        ) -> fidl::Result<()> {
12935            decoder.debug_check_bounds::<Self>(offset);
12936            // Verify that padding bytes are zero.
12937            fidl::decode!(
12938                fidl::encoding::Optional<
12939                    fidl::encoding::Endpoint<
12940                        fidl::endpoints::ClientEnd<fidl_fuchsia_logger::LogSinkMarker>,
12941                    >,
12942                >,
12943                fidl::encoding::DefaultFuchsiaResourceDialect,
12944                &mut self.sink,
12945                decoder,
12946                offset + 0,
12947                _depth
12948            )?;
12949            Ok(())
12950        }
12951    }
12952
12953    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListener2Request {
12954        type Borrowed<'a> = &'a mut Self;
12955        fn take_or_borrow<'a>(
12956            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12957        ) -> Self::Borrowed<'a> {
12958            value
12959        }
12960    }
12961
12962    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListener2Request {
12963        type Owned = Self;
12964
12965        #[inline(always)]
12966        fn inline_align(_context: fidl::encoding::Context) -> usize {
12967            8
12968        }
12969
12970        #[inline(always)]
12971        fn inline_size(_context: fidl::encoding::Context) -> usize {
12972            16
12973        }
12974    }
12975
12976    unsafe impl
12977        fidl::encoding::Encode<
12978            FrameSetNavigationEventListener2Request,
12979            fidl::encoding::DefaultFuchsiaResourceDialect,
12980        > for &mut FrameSetNavigationEventListener2Request
12981    {
12982        #[inline]
12983        unsafe fn encode(
12984            self,
12985            encoder: &mut fidl::encoding::Encoder<
12986                '_,
12987                fidl::encoding::DefaultFuchsiaResourceDialect,
12988            >,
12989            offset: usize,
12990            _depth: fidl::encoding::Depth,
12991        ) -> fidl::Result<()> {
12992            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
12993            // Delegate to tuple encoding.
12994            fidl::encoding::Encode::<
12995                FrameSetNavigationEventListener2Request,
12996                fidl::encoding::DefaultFuchsiaResourceDialect,
12997            >::encode(
12998                (
12999                    <fidl::encoding::Optional<
13000                        fidl::encoding::Endpoint<
13001                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13002                        >,
13003                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13004                        &mut self.listener
13005                    ),
13006                    <NavigationEventListenerFlags as fidl::encoding::ValueTypeMarker>::borrow(
13007                        &self.flags,
13008                    ),
13009                ),
13010                encoder,
13011                offset,
13012                _depth,
13013            )
13014        }
13015    }
13016    unsafe impl<
13017        T0: fidl::encoding::Encode<
13018                fidl::encoding::Optional<
13019                    fidl::encoding::Endpoint<
13020                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13021                    >,
13022                >,
13023                fidl::encoding::DefaultFuchsiaResourceDialect,
13024            >,
13025        T1: fidl::encoding::Encode<
13026                NavigationEventListenerFlags,
13027                fidl::encoding::DefaultFuchsiaResourceDialect,
13028            >,
13029    >
13030        fidl::encoding::Encode<
13031            FrameSetNavigationEventListener2Request,
13032            fidl::encoding::DefaultFuchsiaResourceDialect,
13033        > for (T0, T1)
13034    {
13035        #[inline]
13036        unsafe fn encode(
13037            self,
13038            encoder: &mut fidl::encoding::Encoder<
13039                '_,
13040                fidl::encoding::DefaultFuchsiaResourceDialect,
13041            >,
13042            offset: usize,
13043            depth: fidl::encoding::Depth,
13044        ) -> fidl::Result<()> {
13045            encoder.debug_check_bounds::<FrameSetNavigationEventListener2Request>(offset);
13046            // Zero out padding regions. There's no need to apply masks
13047            // because the unmasked parts will be overwritten by fields.
13048            unsafe {
13049                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
13050                (ptr as *mut u64).write_unaligned(0);
13051            }
13052            // Write the fields.
13053            self.0.encode(encoder, offset + 0, depth)?;
13054            self.1.encode(encoder, offset + 8, depth)?;
13055            Ok(())
13056        }
13057    }
13058
13059    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13060        for FrameSetNavigationEventListener2Request
13061    {
13062        #[inline(always)]
13063        fn new_empty() -> Self {
13064            Self {
13065                listener: fidl::new_empty!(
13066                    fidl::encoding::Optional<
13067                        fidl::encoding::Endpoint<
13068                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13069                        >,
13070                    >,
13071                    fidl::encoding::DefaultFuchsiaResourceDialect
13072                ),
13073                flags: fidl::new_empty!(
13074                    NavigationEventListenerFlags,
13075                    fidl::encoding::DefaultFuchsiaResourceDialect
13076                ),
13077            }
13078        }
13079
13080        #[inline]
13081        unsafe fn decode(
13082            &mut self,
13083            decoder: &mut fidl::encoding::Decoder<
13084                '_,
13085                fidl::encoding::DefaultFuchsiaResourceDialect,
13086            >,
13087            offset: usize,
13088            _depth: fidl::encoding::Depth,
13089        ) -> fidl::Result<()> {
13090            decoder.debug_check_bounds::<Self>(offset);
13091            // Verify that padding bytes are zero.
13092            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
13093            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13094            let mask = 0xffffffff00000000u64;
13095            let maskedval = padval & mask;
13096            if maskedval != 0 {
13097                return Err(fidl::Error::NonZeroPadding {
13098                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
13099                });
13100            }
13101            fidl::decode!(
13102                fidl::encoding::Optional<
13103                    fidl::encoding::Endpoint<
13104                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13105                    >,
13106                >,
13107                fidl::encoding::DefaultFuchsiaResourceDialect,
13108                &mut self.listener,
13109                decoder,
13110                offset + 0,
13111                _depth
13112            )?;
13113            fidl::decode!(
13114                NavigationEventListenerFlags,
13115                fidl::encoding::DefaultFuchsiaResourceDialect,
13116                &mut self.flags,
13117                decoder,
13118                offset + 8,
13119                _depth
13120            )?;
13121            Ok(())
13122        }
13123    }
13124
13125    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationEventListenerRequest {
13126        type Borrowed<'a> = &'a mut Self;
13127        fn take_or_borrow<'a>(
13128            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13129        ) -> Self::Borrowed<'a> {
13130            value
13131        }
13132    }
13133
13134    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationEventListenerRequest {
13135        type Owned = Self;
13136
13137        #[inline(always)]
13138        fn inline_align(_context: fidl::encoding::Context) -> usize {
13139            4
13140        }
13141
13142        #[inline(always)]
13143        fn inline_size(_context: fidl::encoding::Context) -> usize {
13144            4
13145        }
13146    }
13147
13148    unsafe impl
13149        fidl::encoding::Encode<
13150            FrameSetNavigationEventListenerRequest,
13151            fidl::encoding::DefaultFuchsiaResourceDialect,
13152        > for &mut FrameSetNavigationEventListenerRequest
13153    {
13154        #[inline]
13155        unsafe fn encode(
13156            self,
13157            encoder: &mut fidl::encoding::Encoder<
13158                '_,
13159                fidl::encoding::DefaultFuchsiaResourceDialect,
13160            >,
13161            offset: usize,
13162            _depth: fidl::encoding::Depth,
13163        ) -> fidl::Result<()> {
13164            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13165            // Delegate to tuple encoding.
13166            fidl::encoding::Encode::<
13167                FrameSetNavigationEventListenerRequest,
13168                fidl::encoding::DefaultFuchsiaResourceDialect,
13169            >::encode(
13170                (<fidl::encoding::Optional<
13171                    fidl::encoding::Endpoint<
13172                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13173                    >,
13174                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13175                    &mut self.listener
13176                ),),
13177                encoder,
13178                offset,
13179                _depth,
13180            )
13181        }
13182    }
13183    unsafe impl<
13184        T0: fidl::encoding::Encode<
13185                fidl::encoding::Optional<
13186                    fidl::encoding::Endpoint<
13187                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13188                    >,
13189                >,
13190                fidl::encoding::DefaultFuchsiaResourceDialect,
13191            >,
13192    >
13193        fidl::encoding::Encode<
13194            FrameSetNavigationEventListenerRequest,
13195            fidl::encoding::DefaultFuchsiaResourceDialect,
13196        > for (T0,)
13197    {
13198        #[inline]
13199        unsafe fn encode(
13200            self,
13201            encoder: &mut fidl::encoding::Encoder<
13202                '_,
13203                fidl::encoding::DefaultFuchsiaResourceDialect,
13204            >,
13205            offset: usize,
13206            depth: fidl::encoding::Depth,
13207        ) -> fidl::Result<()> {
13208            encoder.debug_check_bounds::<FrameSetNavigationEventListenerRequest>(offset);
13209            // Zero out padding regions. There's no need to apply masks
13210            // because the unmasked parts will be overwritten by fields.
13211            // Write the fields.
13212            self.0.encode(encoder, offset + 0, depth)?;
13213            Ok(())
13214        }
13215    }
13216
13217    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13218        for FrameSetNavigationEventListenerRequest
13219    {
13220        #[inline(always)]
13221        fn new_empty() -> Self {
13222            Self {
13223                listener: fidl::new_empty!(
13224                    fidl::encoding::Optional<
13225                        fidl::encoding::Endpoint<
13226                            fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13227                        >,
13228                    >,
13229                    fidl::encoding::DefaultFuchsiaResourceDialect
13230                ),
13231            }
13232        }
13233
13234        #[inline]
13235        unsafe fn decode(
13236            &mut self,
13237            decoder: &mut fidl::encoding::Decoder<
13238                '_,
13239                fidl::encoding::DefaultFuchsiaResourceDialect,
13240            >,
13241            offset: usize,
13242            _depth: fidl::encoding::Depth,
13243        ) -> fidl::Result<()> {
13244            decoder.debug_check_bounds::<Self>(offset);
13245            // Verify that padding bytes are zero.
13246            fidl::decode!(
13247                fidl::encoding::Optional<
13248                    fidl::encoding::Endpoint<
13249                        fidl::endpoints::ClientEnd<NavigationEventListenerMarker>,
13250                    >,
13251                >,
13252                fidl::encoding::DefaultFuchsiaResourceDialect,
13253                &mut self.listener,
13254                decoder,
13255                offset + 0,
13256                _depth
13257            )?;
13258            Ok(())
13259        }
13260    }
13261
13262    impl fidl::encoding::ResourceTypeMarker for FrameSetNavigationPolicyProviderRequest {
13263        type Borrowed<'a> = &'a mut Self;
13264        fn take_or_borrow<'a>(
13265            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13266        ) -> Self::Borrowed<'a> {
13267            value
13268        }
13269    }
13270
13271    unsafe impl fidl::encoding::TypeMarker for FrameSetNavigationPolicyProviderRequest {
13272        type Owned = Self;
13273
13274        #[inline(always)]
13275        fn inline_align(_context: fidl::encoding::Context) -> usize {
13276            8
13277        }
13278
13279        #[inline(always)]
13280        fn inline_size(_context: fidl::encoding::Context) -> usize {
13281            24
13282        }
13283    }
13284
13285    unsafe impl
13286        fidl::encoding::Encode<
13287            FrameSetNavigationPolicyProviderRequest,
13288            fidl::encoding::DefaultFuchsiaResourceDialect,
13289        > for &mut FrameSetNavigationPolicyProviderRequest
13290    {
13291        #[inline]
13292        unsafe fn encode(
13293            self,
13294            encoder: &mut fidl::encoding::Encoder<
13295                '_,
13296                fidl::encoding::DefaultFuchsiaResourceDialect,
13297            >,
13298            offset: usize,
13299            _depth: fidl::encoding::Depth,
13300        ) -> fidl::Result<()> {
13301            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13302            // Delegate to tuple encoding.
13303            fidl::encoding::Encode::<
13304                FrameSetNavigationPolicyProviderRequest,
13305                fidl::encoding::DefaultFuchsiaResourceDialect,
13306            >::encode(
13307                (
13308                    <NavigationPolicyProviderParams as fidl::encoding::ValueTypeMarker>::borrow(
13309                        &self.params,
13310                    ),
13311                    <fidl::encoding::Endpoint<
13312                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13313                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13314                        &mut self.provider
13315                    ),
13316                ),
13317                encoder,
13318                offset,
13319                _depth,
13320            )
13321        }
13322    }
13323    unsafe impl<
13324        T0: fidl::encoding::Encode<
13325                NavigationPolicyProviderParams,
13326                fidl::encoding::DefaultFuchsiaResourceDialect,
13327            >,
13328        T1: fidl::encoding::Encode<
13329                fidl::encoding::Endpoint<
13330                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13331                >,
13332                fidl::encoding::DefaultFuchsiaResourceDialect,
13333            >,
13334    >
13335        fidl::encoding::Encode<
13336            FrameSetNavigationPolicyProviderRequest,
13337            fidl::encoding::DefaultFuchsiaResourceDialect,
13338        > for (T0, T1)
13339    {
13340        #[inline]
13341        unsafe fn encode(
13342            self,
13343            encoder: &mut fidl::encoding::Encoder<
13344                '_,
13345                fidl::encoding::DefaultFuchsiaResourceDialect,
13346            >,
13347            offset: usize,
13348            depth: fidl::encoding::Depth,
13349        ) -> fidl::Result<()> {
13350            encoder.debug_check_bounds::<FrameSetNavigationPolicyProviderRequest>(offset);
13351            // Zero out padding regions. There's no need to apply masks
13352            // because the unmasked parts will be overwritten by fields.
13353            unsafe {
13354                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
13355                (ptr as *mut u64).write_unaligned(0);
13356            }
13357            // Write the fields.
13358            self.0.encode(encoder, offset + 0, depth)?;
13359            self.1.encode(encoder, offset + 16, depth)?;
13360            Ok(())
13361        }
13362    }
13363
13364    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13365        for FrameSetNavigationPolicyProviderRequest
13366    {
13367        #[inline(always)]
13368        fn new_empty() -> Self {
13369            Self {
13370                params: fidl::new_empty!(
13371                    NavigationPolicyProviderParams,
13372                    fidl::encoding::DefaultFuchsiaResourceDialect
13373                ),
13374                provider: fidl::new_empty!(
13375                    fidl::encoding::Endpoint<
13376                        fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13377                    >,
13378                    fidl::encoding::DefaultFuchsiaResourceDialect
13379                ),
13380            }
13381        }
13382
13383        #[inline]
13384        unsafe fn decode(
13385            &mut self,
13386            decoder: &mut fidl::encoding::Decoder<
13387                '_,
13388                fidl::encoding::DefaultFuchsiaResourceDialect,
13389            >,
13390            offset: usize,
13391            _depth: fidl::encoding::Depth,
13392        ) -> fidl::Result<()> {
13393            decoder.debug_check_bounds::<Self>(offset);
13394            // Verify that padding bytes are zero.
13395            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
13396            let padval = unsafe { (ptr as *const u64).read_unaligned() };
13397            let mask = 0xffffffff00000000u64;
13398            let maskedval = padval & mask;
13399            if maskedval != 0 {
13400                return Err(fidl::Error::NonZeroPadding {
13401                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
13402                });
13403            }
13404            fidl::decode!(
13405                NavigationPolicyProviderParams,
13406                fidl::encoding::DefaultFuchsiaResourceDialect,
13407                &mut self.params,
13408                decoder,
13409                offset + 0,
13410                _depth
13411            )?;
13412            fidl::decode!(
13413                fidl::encoding::Endpoint<
13414                    fidl::endpoints::ClientEnd<NavigationPolicyProviderMarker>,
13415                >,
13416                fidl::encoding::DefaultFuchsiaResourceDialect,
13417                &mut self.provider,
13418                decoder,
13419                offset + 16,
13420                _depth
13421            )?;
13422            Ok(())
13423        }
13424    }
13425
13426    impl fidl::encoding::ResourceTypeMarker for FrameSetPopupFrameCreationListenerRequest {
13427        type Borrowed<'a> = &'a mut Self;
13428        fn take_or_borrow<'a>(
13429            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13430        ) -> Self::Borrowed<'a> {
13431            value
13432        }
13433    }
13434
13435    unsafe impl fidl::encoding::TypeMarker for FrameSetPopupFrameCreationListenerRequest {
13436        type Owned = Self;
13437
13438        #[inline(always)]
13439        fn inline_align(_context: fidl::encoding::Context) -> usize {
13440            4
13441        }
13442
13443        #[inline(always)]
13444        fn inline_size(_context: fidl::encoding::Context) -> usize {
13445            4
13446        }
13447    }
13448
13449    unsafe impl
13450        fidl::encoding::Encode<
13451            FrameSetPopupFrameCreationListenerRequest,
13452            fidl::encoding::DefaultFuchsiaResourceDialect,
13453        > for &mut FrameSetPopupFrameCreationListenerRequest
13454    {
13455        #[inline]
13456        unsafe fn encode(
13457            self,
13458            encoder: &mut fidl::encoding::Encoder<
13459                '_,
13460                fidl::encoding::DefaultFuchsiaResourceDialect,
13461            >,
13462            offset: usize,
13463            _depth: fidl::encoding::Depth,
13464        ) -> fidl::Result<()> {
13465            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13466            // Delegate to tuple encoding.
13467            fidl::encoding::Encode::<
13468                FrameSetPopupFrameCreationListenerRequest,
13469                fidl::encoding::DefaultFuchsiaResourceDialect,
13470            >::encode(
13471                (<fidl::encoding::Optional<
13472                    fidl::encoding::Endpoint<
13473                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13474                    >,
13475                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13476                    &mut self.listener
13477                ),),
13478                encoder,
13479                offset,
13480                _depth,
13481            )
13482        }
13483    }
13484    unsafe impl<
13485        T0: fidl::encoding::Encode<
13486                fidl::encoding::Optional<
13487                    fidl::encoding::Endpoint<
13488                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13489                    >,
13490                >,
13491                fidl::encoding::DefaultFuchsiaResourceDialect,
13492            >,
13493    >
13494        fidl::encoding::Encode<
13495            FrameSetPopupFrameCreationListenerRequest,
13496            fidl::encoding::DefaultFuchsiaResourceDialect,
13497        > for (T0,)
13498    {
13499        #[inline]
13500        unsafe fn encode(
13501            self,
13502            encoder: &mut fidl::encoding::Encoder<
13503                '_,
13504                fidl::encoding::DefaultFuchsiaResourceDialect,
13505            >,
13506            offset: usize,
13507            depth: fidl::encoding::Depth,
13508        ) -> fidl::Result<()> {
13509            encoder.debug_check_bounds::<FrameSetPopupFrameCreationListenerRequest>(offset);
13510            // Zero out padding regions. There's no need to apply masks
13511            // because the unmasked parts will be overwritten by fields.
13512            // Write the fields.
13513            self.0.encode(encoder, offset + 0, depth)?;
13514            Ok(())
13515        }
13516    }
13517
13518    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13519        for FrameSetPopupFrameCreationListenerRequest
13520    {
13521        #[inline(always)]
13522        fn new_empty() -> Self {
13523            Self {
13524                listener: fidl::new_empty!(
13525                    fidl::encoding::Optional<
13526                        fidl::encoding::Endpoint<
13527                            fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13528                        >,
13529                    >,
13530                    fidl::encoding::DefaultFuchsiaResourceDialect
13531                ),
13532            }
13533        }
13534
13535        #[inline]
13536        unsafe fn decode(
13537            &mut self,
13538            decoder: &mut fidl::encoding::Decoder<
13539                '_,
13540                fidl::encoding::DefaultFuchsiaResourceDialect,
13541            >,
13542            offset: usize,
13543            _depth: fidl::encoding::Depth,
13544        ) -> fidl::Result<()> {
13545            decoder.debug_check_bounds::<Self>(offset);
13546            // Verify that padding bytes are zero.
13547            fidl::decode!(
13548                fidl::encoding::Optional<
13549                    fidl::encoding::Endpoint<
13550                        fidl::endpoints::ClientEnd<PopupFrameCreationListenerMarker>,
13551                    >,
13552                >,
13553                fidl::encoding::DefaultFuchsiaResourceDialect,
13554                &mut self.listener,
13555                decoder,
13556                offset + 0,
13557                _depth
13558            )?;
13559            Ok(())
13560        }
13561    }
13562
13563    impl fidl::encoding::ResourceTypeMarker for FrameExecuteJavaScriptResponse {
13564        type Borrowed<'a> = &'a mut Self;
13565        fn take_or_borrow<'a>(
13566            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13567        ) -> Self::Borrowed<'a> {
13568            value
13569        }
13570    }
13571
13572    unsafe impl fidl::encoding::TypeMarker for FrameExecuteJavaScriptResponse {
13573        type Owned = Self;
13574
13575        #[inline(always)]
13576        fn inline_align(_context: fidl::encoding::Context) -> usize {
13577            8
13578        }
13579
13580        #[inline(always)]
13581        fn inline_size(_context: fidl::encoding::Context) -> usize {
13582            16
13583        }
13584    }
13585
13586    unsafe impl
13587        fidl::encoding::Encode<
13588            FrameExecuteJavaScriptResponse,
13589            fidl::encoding::DefaultFuchsiaResourceDialect,
13590        > for &mut FrameExecuteJavaScriptResponse
13591    {
13592        #[inline]
13593        unsafe fn encode(
13594            self,
13595            encoder: &mut fidl::encoding::Encoder<
13596                '_,
13597                fidl::encoding::DefaultFuchsiaResourceDialect,
13598            >,
13599            offset: usize,
13600            _depth: fidl::encoding::Depth,
13601        ) -> fidl::Result<()> {
13602            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13603            // Delegate to tuple encoding.
13604            fidl::encoding::Encode::<
13605                FrameExecuteJavaScriptResponse,
13606                fidl::encoding::DefaultFuchsiaResourceDialect,
13607            >::encode(
13608                (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13609                    &mut self.result,
13610                ),),
13611                encoder,
13612                offset,
13613                _depth,
13614            )
13615        }
13616    }
13617    unsafe impl<
13618        T0: fidl::encoding::Encode<
13619                fidl_fuchsia_mem::Buffer,
13620                fidl::encoding::DefaultFuchsiaResourceDialect,
13621            >,
13622    >
13623        fidl::encoding::Encode<
13624            FrameExecuteJavaScriptResponse,
13625            fidl::encoding::DefaultFuchsiaResourceDialect,
13626        > for (T0,)
13627    {
13628        #[inline]
13629        unsafe fn encode(
13630            self,
13631            encoder: &mut fidl::encoding::Encoder<
13632                '_,
13633                fidl::encoding::DefaultFuchsiaResourceDialect,
13634            >,
13635            offset: usize,
13636            depth: fidl::encoding::Depth,
13637        ) -> fidl::Result<()> {
13638            encoder.debug_check_bounds::<FrameExecuteJavaScriptResponse>(offset);
13639            // Zero out padding regions. There's no need to apply masks
13640            // because the unmasked parts will be overwritten by fields.
13641            // Write the fields.
13642            self.0.encode(encoder, offset + 0, depth)?;
13643            Ok(())
13644        }
13645    }
13646
13647    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13648        for FrameExecuteJavaScriptResponse
13649    {
13650        #[inline(always)]
13651        fn new_empty() -> Self {
13652            Self {
13653                result: fidl::new_empty!(
13654                    fidl_fuchsia_mem::Buffer,
13655                    fidl::encoding::DefaultFuchsiaResourceDialect
13656                ),
13657            }
13658        }
13659
13660        #[inline]
13661        unsafe fn decode(
13662            &mut self,
13663            decoder: &mut fidl::encoding::Decoder<
13664                '_,
13665                fidl::encoding::DefaultFuchsiaResourceDialect,
13666            >,
13667            offset: usize,
13668            _depth: fidl::encoding::Depth,
13669        ) -> fidl::Result<()> {
13670            decoder.debug_check_bounds::<Self>(offset);
13671            // Verify that padding bytes are zero.
13672            fidl::decode!(
13673                fidl_fuchsia_mem::Buffer,
13674                fidl::encoding::DefaultFuchsiaResourceDialect,
13675                &mut self.result,
13676                decoder,
13677                offset + 0,
13678                _depth
13679            )?;
13680            Ok(())
13681        }
13682    }
13683
13684    impl fidl::encoding::ResourceTypeMarker for MessagePortPostMessageRequest {
13685        type Borrowed<'a> = &'a mut Self;
13686        fn take_or_borrow<'a>(
13687            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13688        ) -> Self::Borrowed<'a> {
13689            value
13690        }
13691    }
13692
13693    unsafe impl fidl::encoding::TypeMarker for MessagePortPostMessageRequest {
13694        type Owned = Self;
13695
13696        #[inline(always)]
13697        fn inline_align(_context: fidl::encoding::Context) -> usize {
13698            8
13699        }
13700
13701        #[inline(always)]
13702        fn inline_size(_context: fidl::encoding::Context) -> usize {
13703            16
13704        }
13705    }
13706
13707    unsafe impl
13708        fidl::encoding::Encode<
13709            MessagePortPostMessageRequest,
13710            fidl::encoding::DefaultFuchsiaResourceDialect,
13711        > for &mut MessagePortPostMessageRequest
13712    {
13713        #[inline]
13714        unsafe fn encode(
13715            self,
13716            encoder: &mut fidl::encoding::Encoder<
13717                '_,
13718                fidl::encoding::DefaultFuchsiaResourceDialect,
13719            >,
13720            offset: usize,
13721            _depth: fidl::encoding::Depth,
13722        ) -> fidl::Result<()> {
13723            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13724            // Delegate to tuple encoding.
13725            fidl::encoding::Encode::<
13726                MessagePortPostMessageRequest,
13727                fidl::encoding::DefaultFuchsiaResourceDialect,
13728            >::encode(
13729                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13730                    &mut self.message,
13731                ),),
13732                encoder,
13733                offset,
13734                _depth,
13735            )
13736        }
13737    }
13738    unsafe impl<
13739        T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
13740    >
13741        fidl::encoding::Encode<
13742            MessagePortPostMessageRequest,
13743            fidl::encoding::DefaultFuchsiaResourceDialect,
13744        > for (T0,)
13745    {
13746        #[inline]
13747        unsafe fn encode(
13748            self,
13749            encoder: &mut fidl::encoding::Encoder<
13750                '_,
13751                fidl::encoding::DefaultFuchsiaResourceDialect,
13752            >,
13753            offset: usize,
13754            depth: fidl::encoding::Depth,
13755        ) -> fidl::Result<()> {
13756            encoder.debug_check_bounds::<MessagePortPostMessageRequest>(offset);
13757            // Zero out padding regions. There's no need to apply masks
13758            // because the unmasked parts will be overwritten by fields.
13759            // Write the fields.
13760            self.0.encode(encoder, offset + 0, depth)?;
13761            Ok(())
13762        }
13763    }
13764
13765    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13766        for MessagePortPostMessageRequest
13767    {
13768        #[inline(always)]
13769        fn new_empty() -> Self {
13770            Self {
13771                message: fidl::new_empty!(
13772                    WebMessage,
13773                    fidl::encoding::DefaultFuchsiaResourceDialect
13774                ),
13775            }
13776        }
13777
13778        #[inline]
13779        unsafe fn decode(
13780            &mut self,
13781            decoder: &mut fidl::encoding::Decoder<
13782                '_,
13783                fidl::encoding::DefaultFuchsiaResourceDialect,
13784            >,
13785            offset: usize,
13786            _depth: fidl::encoding::Depth,
13787        ) -> fidl::Result<()> {
13788            decoder.debug_check_bounds::<Self>(offset);
13789            // Verify that padding bytes are zero.
13790            fidl::decode!(
13791                WebMessage,
13792                fidl::encoding::DefaultFuchsiaResourceDialect,
13793                &mut self.message,
13794                decoder,
13795                offset + 0,
13796                _depth
13797            )?;
13798            Ok(())
13799        }
13800    }
13801
13802    impl fidl::encoding::ResourceTypeMarker for MessagePortReceiveMessageResponse {
13803        type Borrowed<'a> = &'a mut Self;
13804        fn take_or_borrow<'a>(
13805            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13806        ) -> Self::Borrowed<'a> {
13807            value
13808        }
13809    }
13810
13811    unsafe impl fidl::encoding::TypeMarker for MessagePortReceiveMessageResponse {
13812        type Owned = Self;
13813
13814        #[inline(always)]
13815        fn inline_align(_context: fidl::encoding::Context) -> usize {
13816            8
13817        }
13818
13819        #[inline(always)]
13820        fn inline_size(_context: fidl::encoding::Context) -> usize {
13821            16
13822        }
13823    }
13824
13825    unsafe impl
13826        fidl::encoding::Encode<
13827            MessagePortReceiveMessageResponse,
13828            fidl::encoding::DefaultFuchsiaResourceDialect,
13829        > for &mut MessagePortReceiveMessageResponse
13830    {
13831        #[inline]
13832        unsafe fn encode(
13833            self,
13834            encoder: &mut fidl::encoding::Encoder<
13835                '_,
13836                fidl::encoding::DefaultFuchsiaResourceDialect,
13837            >,
13838            offset: usize,
13839            _depth: fidl::encoding::Depth,
13840        ) -> fidl::Result<()> {
13841            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13842            // Delegate to tuple encoding.
13843            fidl::encoding::Encode::<
13844                MessagePortReceiveMessageResponse,
13845                fidl::encoding::DefaultFuchsiaResourceDialect,
13846            >::encode(
13847                (<WebMessage as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13848                    &mut self.message,
13849                ),),
13850                encoder,
13851                offset,
13852                _depth,
13853            )
13854        }
13855    }
13856    unsafe impl<
13857        T0: fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>,
13858    >
13859        fidl::encoding::Encode<
13860            MessagePortReceiveMessageResponse,
13861            fidl::encoding::DefaultFuchsiaResourceDialect,
13862        > for (T0,)
13863    {
13864        #[inline]
13865        unsafe fn encode(
13866            self,
13867            encoder: &mut fidl::encoding::Encoder<
13868                '_,
13869                fidl::encoding::DefaultFuchsiaResourceDialect,
13870            >,
13871            offset: usize,
13872            depth: fidl::encoding::Depth,
13873        ) -> fidl::Result<()> {
13874            encoder.debug_check_bounds::<MessagePortReceiveMessageResponse>(offset);
13875            // Zero out padding regions. There's no need to apply masks
13876            // because the unmasked parts will be overwritten by fields.
13877            // Write the fields.
13878            self.0.encode(encoder, offset + 0, depth)?;
13879            Ok(())
13880        }
13881    }
13882
13883    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13884        for MessagePortReceiveMessageResponse
13885    {
13886        #[inline(always)]
13887        fn new_empty() -> Self {
13888            Self {
13889                message: fidl::new_empty!(
13890                    WebMessage,
13891                    fidl::encoding::DefaultFuchsiaResourceDialect
13892                ),
13893            }
13894        }
13895
13896        #[inline]
13897        unsafe fn decode(
13898            &mut self,
13899            decoder: &mut fidl::encoding::Decoder<
13900                '_,
13901                fidl::encoding::DefaultFuchsiaResourceDialect,
13902            >,
13903            offset: usize,
13904            _depth: fidl::encoding::Depth,
13905        ) -> fidl::Result<()> {
13906            decoder.debug_check_bounds::<Self>(offset);
13907            // Verify that padding bytes are zero.
13908            fidl::decode!(
13909                WebMessage,
13910                fidl::encoding::DefaultFuchsiaResourceDialect,
13911                &mut self.message,
13912                decoder,
13913                offset + 0,
13914                _depth
13915            )?;
13916            Ok(())
13917        }
13918    }
13919
13920    impl fidl::encoding::ResourceTypeMarker for NavigationControllerLoadUrlRequest {
13921        type Borrowed<'a> = &'a mut Self;
13922        fn take_or_borrow<'a>(
13923            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13924        ) -> Self::Borrowed<'a> {
13925            value
13926        }
13927    }
13928
13929    unsafe impl fidl::encoding::TypeMarker for NavigationControllerLoadUrlRequest {
13930        type Owned = Self;
13931
13932        #[inline(always)]
13933        fn inline_align(_context: fidl::encoding::Context) -> usize {
13934            8
13935        }
13936
13937        #[inline(always)]
13938        fn inline_size(_context: fidl::encoding::Context) -> usize {
13939            32
13940        }
13941    }
13942
13943    unsafe impl
13944        fidl::encoding::Encode<
13945            NavigationControllerLoadUrlRequest,
13946            fidl::encoding::DefaultFuchsiaResourceDialect,
13947        > for &mut NavigationControllerLoadUrlRequest
13948    {
13949        #[inline]
13950        unsafe fn encode(
13951            self,
13952            encoder: &mut fidl::encoding::Encoder<
13953                '_,
13954                fidl::encoding::DefaultFuchsiaResourceDialect,
13955            >,
13956            offset: usize,
13957            _depth: fidl::encoding::Depth,
13958        ) -> fidl::Result<()> {
13959            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13960            // Delegate to tuple encoding.
13961            fidl::encoding::Encode::<NavigationControllerLoadUrlRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
13962                (
13963                    <fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
13964                    <LoadUrlParams as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.params),
13965                ),
13966                encoder, offset, _depth
13967            )
13968        }
13969    }
13970    unsafe impl<
13971        T0: fidl::encoding::Encode<
13972                fidl::encoding::BoundedString<65536>,
13973                fidl::encoding::DefaultFuchsiaResourceDialect,
13974            >,
13975        T1: fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
13976    >
13977        fidl::encoding::Encode<
13978            NavigationControllerLoadUrlRequest,
13979            fidl::encoding::DefaultFuchsiaResourceDialect,
13980        > for (T0, T1)
13981    {
13982        #[inline]
13983        unsafe fn encode(
13984            self,
13985            encoder: &mut fidl::encoding::Encoder<
13986                '_,
13987                fidl::encoding::DefaultFuchsiaResourceDialect,
13988            >,
13989            offset: usize,
13990            depth: fidl::encoding::Depth,
13991        ) -> fidl::Result<()> {
13992            encoder.debug_check_bounds::<NavigationControllerLoadUrlRequest>(offset);
13993            // Zero out padding regions. There's no need to apply masks
13994            // because the unmasked parts will be overwritten by fields.
13995            // Write the fields.
13996            self.0.encode(encoder, offset + 0, depth)?;
13997            self.1.encode(encoder, offset + 16, depth)?;
13998            Ok(())
13999        }
14000    }
14001
14002    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14003        for NavigationControllerLoadUrlRequest
14004    {
14005        #[inline(always)]
14006        fn new_empty() -> Self {
14007            Self {
14008                url: fidl::new_empty!(
14009                    fidl::encoding::BoundedString<65536>,
14010                    fidl::encoding::DefaultFuchsiaResourceDialect
14011                ),
14012                params: fidl::new_empty!(
14013                    LoadUrlParams,
14014                    fidl::encoding::DefaultFuchsiaResourceDialect
14015                ),
14016            }
14017        }
14018
14019        #[inline]
14020        unsafe fn decode(
14021            &mut self,
14022            decoder: &mut fidl::encoding::Decoder<
14023                '_,
14024                fidl::encoding::DefaultFuchsiaResourceDialect,
14025            >,
14026            offset: usize,
14027            _depth: fidl::encoding::Depth,
14028        ) -> fidl::Result<()> {
14029            decoder.debug_check_bounds::<Self>(offset);
14030            // Verify that padding bytes are zero.
14031            fidl::decode!(
14032                fidl::encoding::BoundedString<65536>,
14033                fidl::encoding::DefaultFuchsiaResourceDialect,
14034                &mut self.url,
14035                decoder,
14036                offset + 0,
14037                _depth
14038            )?;
14039            fidl::decode!(
14040                LoadUrlParams,
14041                fidl::encoding::DefaultFuchsiaResourceDialect,
14042                &mut self.params,
14043                decoder,
14044                offset + 16,
14045                _depth
14046            )?;
14047            Ok(())
14048        }
14049    }
14050
14051    impl fidl::encoding::ResourceTypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
14052        type Borrowed<'a> = &'a mut Self;
14053        fn take_or_borrow<'a>(
14054            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14055        ) -> Self::Borrowed<'a> {
14056            value
14057        }
14058    }
14059
14060    unsafe impl fidl::encoding::TypeMarker for NavigationEventListenerOnNavigationStateChangedRequest {
14061        type Owned = Self;
14062
14063        #[inline(always)]
14064        fn inline_align(_context: fidl::encoding::Context) -> usize {
14065            8
14066        }
14067
14068        #[inline(always)]
14069        fn inline_size(_context: fidl::encoding::Context) -> usize {
14070            16
14071        }
14072    }
14073
14074    unsafe impl
14075        fidl::encoding::Encode<
14076            NavigationEventListenerOnNavigationStateChangedRequest,
14077            fidl::encoding::DefaultFuchsiaResourceDialect,
14078        > for &mut NavigationEventListenerOnNavigationStateChangedRequest
14079    {
14080        #[inline]
14081        unsafe fn encode(
14082            self,
14083            encoder: &mut fidl::encoding::Encoder<
14084                '_,
14085                fidl::encoding::DefaultFuchsiaResourceDialect,
14086            >,
14087            offset: usize,
14088            _depth: fidl::encoding::Depth,
14089        ) -> fidl::Result<()> {
14090            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
14091                offset,
14092            );
14093            // Delegate to tuple encoding.
14094            fidl::encoding::Encode::<
14095                NavigationEventListenerOnNavigationStateChangedRequest,
14096                fidl::encoding::DefaultFuchsiaResourceDialect,
14097            >::encode(
14098                (<NavigationState as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14099                    &mut self.change,
14100                ),),
14101                encoder,
14102                offset,
14103                _depth,
14104            )
14105        }
14106    }
14107    unsafe impl<
14108        T0: fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>,
14109    >
14110        fidl::encoding::Encode<
14111            NavigationEventListenerOnNavigationStateChangedRequest,
14112            fidl::encoding::DefaultFuchsiaResourceDialect,
14113        > for (T0,)
14114    {
14115        #[inline]
14116        unsafe fn encode(
14117            self,
14118            encoder: &mut fidl::encoding::Encoder<
14119                '_,
14120                fidl::encoding::DefaultFuchsiaResourceDialect,
14121            >,
14122            offset: usize,
14123            depth: fidl::encoding::Depth,
14124        ) -> fidl::Result<()> {
14125            encoder.debug_check_bounds::<NavigationEventListenerOnNavigationStateChangedRequest>(
14126                offset,
14127            );
14128            // Zero out padding regions. There's no need to apply masks
14129            // because the unmasked parts will be overwritten by fields.
14130            // Write the fields.
14131            self.0.encode(encoder, offset + 0, depth)?;
14132            Ok(())
14133        }
14134    }
14135
14136    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14137        for NavigationEventListenerOnNavigationStateChangedRequest
14138    {
14139        #[inline(always)]
14140        fn new_empty() -> Self {
14141            Self {
14142                change: fidl::new_empty!(
14143                    NavigationState,
14144                    fidl::encoding::DefaultFuchsiaResourceDialect
14145                ),
14146            }
14147        }
14148
14149        #[inline]
14150        unsafe fn decode(
14151            &mut self,
14152            decoder: &mut fidl::encoding::Decoder<
14153                '_,
14154                fidl::encoding::DefaultFuchsiaResourceDialect,
14155            >,
14156            offset: usize,
14157            _depth: fidl::encoding::Depth,
14158        ) -> fidl::Result<()> {
14159            decoder.debug_check_bounds::<Self>(offset);
14160            // Verify that padding bytes are zero.
14161            fidl::decode!(
14162                NavigationState,
14163                fidl::encoding::DefaultFuchsiaResourceDialect,
14164                &mut self.change,
14165                decoder,
14166                offset + 0,
14167                _depth
14168            )?;
14169            Ok(())
14170        }
14171    }
14172
14173    impl fidl::encoding::ResourceTypeMarker
14174        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14175    {
14176        type Borrowed<'a> = &'a mut Self;
14177        fn take_or_borrow<'a>(
14178            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14179        ) -> Self::Borrowed<'a> {
14180            value
14181        }
14182    }
14183
14184    unsafe impl fidl::encoding::TypeMarker
14185        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14186    {
14187        type Owned = Self;
14188
14189        #[inline(always)]
14190        fn inline_align(_context: fidl::encoding::Context) -> usize {
14191            8
14192        }
14193
14194        #[inline(always)]
14195        fn inline_size(_context: fidl::encoding::Context) -> usize {
14196            16
14197        }
14198    }
14199
14200    unsafe impl
14201        fidl::encoding::Encode<
14202            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14203            fidl::encoding::DefaultFuchsiaResourceDialect,
14204        > for &mut NavigationPolicyProviderEvaluateRequestedNavigationResponse
14205    {
14206        #[inline]
14207        unsafe fn encode(
14208            self,
14209            encoder: &mut fidl::encoding::Encoder<
14210                '_,
14211                fidl::encoding::DefaultFuchsiaResourceDialect,
14212            >,
14213            offset: usize,
14214            _depth: fidl::encoding::Depth,
14215        ) -> fidl::Result<()> {
14216            encoder
14217                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14218                    offset,
14219                );
14220            // Delegate to tuple encoding.
14221            fidl::encoding::Encode::<
14222                NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14223                fidl::encoding::DefaultFuchsiaResourceDialect,
14224            >::encode(
14225                (<NavigationDecision as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14226                    &mut self.decision,
14227                ),),
14228                encoder,
14229                offset,
14230                _depth,
14231            )
14232        }
14233    }
14234    unsafe impl<
14235        T0: fidl::encoding::Encode<NavigationDecision, fidl::encoding::DefaultFuchsiaResourceDialect>,
14236    >
14237        fidl::encoding::Encode<
14238            NavigationPolicyProviderEvaluateRequestedNavigationResponse,
14239            fidl::encoding::DefaultFuchsiaResourceDialect,
14240        > for (T0,)
14241    {
14242        #[inline]
14243        unsafe fn encode(
14244            self,
14245            encoder: &mut fidl::encoding::Encoder<
14246                '_,
14247                fidl::encoding::DefaultFuchsiaResourceDialect,
14248            >,
14249            offset: usize,
14250            depth: fidl::encoding::Depth,
14251        ) -> fidl::Result<()> {
14252            encoder
14253                .debug_check_bounds::<NavigationPolicyProviderEvaluateRequestedNavigationResponse>(
14254                    offset,
14255                );
14256            // Zero out padding regions. There's no need to apply masks
14257            // because the unmasked parts will be overwritten by fields.
14258            // Write the fields.
14259            self.0.encode(encoder, offset + 0, depth)?;
14260            Ok(())
14261        }
14262    }
14263
14264    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14265        for NavigationPolicyProviderEvaluateRequestedNavigationResponse
14266    {
14267        #[inline(always)]
14268        fn new_empty() -> Self {
14269            Self {
14270                decision: fidl::new_empty!(
14271                    NavigationDecision,
14272                    fidl::encoding::DefaultFuchsiaResourceDialect
14273                ),
14274            }
14275        }
14276
14277        #[inline]
14278        unsafe fn decode(
14279            &mut self,
14280            decoder: &mut fidl::encoding::Decoder<
14281                '_,
14282                fidl::encoding::DefaultFuchsiaResourceDialect,
14283            >,
14284            offset: usize,
14285            _depth: fidl::encoding::Depth,
14286        ) -> fidl::Result<()> {
14287            decoder.debug_check_bounds::<Self>(offset);
14288            // Verify that padding bytes are zero.
14289            fidl::decode!(
14290                NavigationDecision,
14291                fidl::encoding::DefaultFuchsiaResourceDialect,
14292                &mut self.decision,
14293                decoder,
14294                offset + 0,
14295                _depth
14296            )?;
14297            Ok(())
14298        }
14299    }
14300
14301    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14302        type Borrowed<'a> = &'a mut Self;
14303        fn take_or_borrow<'a>(
14304            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14305        ) -> Self::Borrowed<'a> {
14306            value
14307        }
14308    }
14309
14310    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationListenerOnPopupFrameCreatedRequest {
14311        type Owned = Self;
14312
14313        #[inline(always)]
14314        fn inline_align(_context: fidl::encoding::Context) -> usize {
14315            8
14316        }
14317
14318        #[inline(always)]
14319        fn inline_size(_context: fidl::encoding::Context) -> usize {
14320            24
14321        }
14322    }
14323
14324    unsafe impl
14325        fidl::encoding::Encode<
14326            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14327            fidl::encoding::DefaultFuchsiaResourceDialect,
14328        > for &mut PopupFrameCreationListenerOnPopupFrameCreatedRequest
14329    {
14330        #[inline]
14331        unsafe fn encode(
14332            self,
14333            encoder: &mut fidl::encoding::Encoder<
14334                '_,
14335                fidl::encoding::DefaultFuchsiaResourceDialect,
14336            >,
14337            offset: usize,
14338            _depth: fidl::encoding::Depth,
14339        ) -> fidl::Result<()> {
14340            encoder
14341                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14342            // Delegate to tuple encoding.
14343            fidl::encoding::Encode::<PopupFrameCreationListenerOnPopupFrameCreatedRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
14344                (
14345                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.frame),
14346                    <PopupFrameCreationInfo as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.info),
14347                ),
14348                encoder, offset, _depth
14349            )
14350        }
14351    }
14352    unsafe impl<
14353        T0: fidl::encoding::Encode<
14354                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14355                fidl::encoding::DefaultFuchsiaResourceDialect,
14356            >,
14357        T1: fidl::encoding::Encode<
14358                PopupFrameCreationInfo,
14359                fidl::encoding::DefaultFuchsiaResourceDialect,
14360            >,
14361    >
14362        fidl::encoding::Encode<
14363            PopupFrameCreationListenerOnPopupFrameCreatedRequest,
14364            fidl::encoding::DefaultFuchsiaResourceDialect,
14365        > for (T0, T1)
14366    {
14367        #[inline]
14368        unsafe fn encode(
14369            self,
14370            encoder: &mut fidl::encoding::Encoder<
14371                '_,
14372                fidl::encoding::DefaultFuchsiaResourceDialect,
14373            >,
14374            offset: usize,
14375            depth: fidl::encoding::Depth,
14376        ) -> fidl::Result<()> {
14377            encoder
14378                .debug_check_bounds::<PopupFrameCreationListenerOnPopupFrameCreatedRequest>(offset);
14379            // Zero out padding regions. There's no need to apply masks
14380            // because the unmasked parts will be overwritten by fields.
14381            unsafe {
14382                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
14383                (ptr as *mut u64).write_unaligned(0);
14384            }
14385            // Write the fields.
14386            self.0.encode(encoder, offset + 0, depth)?;
14387            self.1.encode(encoder, offset + 8, depth)?;
14388            Ok(())
14389        }
14390    }
14391
14392    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14393        for PopupFrameCreationListenerOnPopupFrameCreatedRequest
14394    {
14395        #[inline(always)]
14396        fn new_empty() -> Self {
14397            Self {
14398                frame: fidl::new_empty!(
14399                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14400                    fidl::encoding::DefaultFuchsiaResourceDialect
14401                ),
14402                info: fidl::new_empty!(
14403                    PopupFrameCreationInfo,
14404                    fidl::encoding::DefaultFuchsiaResourceDialect
14405                ),
14406            }
14407        }
14408
14409        #[inline]
14410        unsafe fn decode(
14411            &mut self,
14412            decoder: &mut fidl::encoding::Decoder<
14413                '_,
14414                fidl::encoding::DefaultFuchsiaResourceDialect,
14415            >,
14416            offset: usize,
14417            _depth: fidl::encoding::Depth,
14418        ) -> fidl::Result<()> {
14419            decoder.debug_check_bounds::<Self>(offset);
14420            // Verify that padding bytes are zero.
14421            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
14422            let padval = unsafe { (ptr as *const u64).read_unaligned() };
14423            let mask = 0xffffffff00000000u64;
14424            let maskedval = padval & mask;
14425            if maskedval != 0 {
14426                return Err(fidl::Error::NonZeroPadding {
14427                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
14428                });
14429            }
14430            fidl::decode!(
14431                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<FrameMarker>>,
14432                fidl::encoding::DefaultFuchsiaResourceDialect,
14433                &mut self.frame,
14434                decoder,
14435                offset + 0,
14436                _depth
14437            )?;
14438            fidl::decode!(
14439                PopupFrameCreationInfo,
14440                fidl::encoding::DefaultFuchsiaResourceDialect,
14441                &mut self.info,
14442                decoder,
14443                offset + 8,
14444                _depth
14445            )?;
14446            Ok(())
14447        }
14448    }
14449
14450    impl ContentDirectoryProvider {
14451        #[inline(always)]
14452        fn max_ordinal_present(&self) -> u64 {
14453            if let Some(_) = self.directory {
14454                return 2;
14455            }
14456            if let Some(_) = self.name {
14457                return 1;
14458            }
14459            0
14460        }
14461    }
14462
14463    impl fidl::encoding::ResourceTypeMarker for ContentDirectoryProvider {
14464        type Borrowed<'a> = &'a mut Self;
14465        fn take_or_borrow<'a>(
14466            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14467        ) -> Self::Borrowed<'a> {
14468            value
14469        }
14470    }
14471
14472    unsafe impl fidl::encoding::TypeMarker for ContentDirectoryProvider {
14473        type Owned = Self;
14474
14475        #[inline(always)]
14476        fn inline_align(_context: fidl::encoding::Context) -> usize {
14477            8
14478        }
14479
14480        #[inline(always)]
14481        fn inline_size(_context: fidl::encoding::Context) -> usize {
14482            16
14483        }
14484    }
14485
14486    unsafe impl
14487        fidl::encoding::Encode<
14488            ContentDirectoryProvider,
14489            fidl::encoding::DefaultFuchsiaResourceDialect,
14490        > for &mut ContentDirectoryProvider
14491    {
14492        unsafe fn encode(
14493            self,
14494            encoder: &mut fidl::encoding::Encoder<
14495                '_,
14496                fidl::encoding::DefaultFuchsiaResourceDialect,
14497            >,
14498            offset: usize,
14499            mut depth: fidl::encoding::Depth,
14500        ) -> fidl::Result<()> {
14501            encoder.debug_check_bounds::<ContentDirectoryProvider>(offset);
14502            // Vector header
14503            let max_ordinal: u64 = self.max_ordinal_present();
14504            encoder.write_num(max_ordinal, offset);
14505            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14506            // Calling encoder.out_of_line_offset(0) is not allowed.
14507            if max_ordinal == 0 {
14508                return Ok(());
14509            }
14510            depth.increment()?;
14511            let envelope_size = 8;
14512            let bytes_len = max_ordinal as usize * envelope_size;
14513            #[allow(unused_variables)]
14514            let offset = encoder.out_of_line_offset(bytes_len);
14515            let mut _prev_end_offset: usize = 0;
14516            if 1 > max_ordinal {
14517                return Ok(());
14518            }
14519
14520            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14521            // are envelope_size bytes.
14522            let cur_offset: usize = (1 - 1) * envelope_size;
14523
14524            // Zero reserved fields.
14525            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14526
14527            // Safety:
14528            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14529            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14530            //   envelope_size bytes, there is always sufficient room.
14531            fidl::encoding::encode_in_envelope_optional::<
14532                fidl::encoding::BoundedString<255>,
14533                fidl::encoding::DefaultFuchsiaResourceDialect,
14534            >(
14535                self.name.as_ref().map(
14536                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
14537                ),
14538                encoder,
14539                offset + cur_offset,
14540                depth,
14541            )?;
14542
14543            _prev_end_offset = cur_offset + envelope_size;
14544            if 2 > max_ordinal {
14545                return Ok(());
14546            }
14547
14548            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14549            // are envelope_size bytes.
14550            let cur_offset: usize = (2 - 1) * envelope_size;
14551
14552            // Zero reserved fields.
14553            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14554
14555            // Safety:
14556            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14557            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14558            //   envelope_size bytes, there is always sufficient room.
14559            fidl::encoding::encode_in_envelope_optional::<
14560                fidl::encoding::Endpoint<
14561                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14562                >,
14563                fidl::encoding::DefaultFuchsiaResourceDialect,
14564            >(
14565                self.directory.as_mut().map(
14566                    <fidl::encoding::Endpoint<
14567                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14568                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
14569                ),
14570                encoder,
14571                offset + cur_offset,
14572                depth,
14573            )?;
14574
14575            _prev_end_offset = cur_offset + envelope_size;
14576
14577            Ok(())
14578        }
14579    }
14580
14581    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14582        for ContentDirectoryProvider
14583    {
14584        #[inline(always)]
14585        fn new_empty() -> Self {
14586            Self::default()
14587        }
14588
14589        unsafe fn decode(
14590            &mut self,
14591            decoder: &mut fidl::encoding::Decoder<
14592                '_,
14593                fidl::encoding::DefaultFuchsiaResourceDialect,
14594            >,
14595            offset: usize,
14596            mut depth: fidl::encoding::Depth,
14597        ) -> fidl::Result<()> {
14598            decoder.debug_check_bounds::<Self>(offset);
14599            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14600                None => return Err(fidl::Error::NotNullable),
14601                Some(len) => len,
14602            };
14603            // Calling decoder.out_of_line_offset(0) is not allowed.
14604            if len == 0 {
14605                return Ok(());
14606            };
14607            depth.increment()?;
14608            let envelope_size = 8;
14609            let bytes_len = len * envelope_size;
14610            let offset = decoder.out_of_line_offset(bytes_len)?;
14611            // Decode the envelope for each type.
14612            let mut _next_ordinal_to_read = 0;
14613            let mut next_offset = offset;
14614            let end_offset = offset + bytes_len;
14615            _next_ordinal_to_read += 1;
14616            if next_offset >= end_offset {
14617                return Ok(());
14618            }
14619
14620            // Decode unknown envelopes for gaps in ordinals.
14621            while _next_ordinal_to_read < 1 {
14622                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14623                _next_ordinal_to_read += 1;
14624                next_offset += envelope_size;
14625            }
14626
14627            let next_out_of_line = decoder.next_out_of_line();
14628            let handles_before = decoder.remaining_handles();
14629            if let Some((inlined, num_bytes, num_handles)) =
14630                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14631            {
14632                let member_inline_size =
14633                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
14634                        decoder.context,
14635                    );
14636                if inlined != (member_inline_size <= 4) {
14637                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14638                }
14639                let inner_offset;
14640                let mut inner_depth = depth.clone();
14641                if inlined {
14642                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14643                    inner_offset = next_offset;
14644                } else {
14645                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14646                    inner_depth.increment()?;
14647                }
14648                let val_ref = self.name.get_or_insert_with(|| {
14649                    fidl::new_empty!(
14650                        fidl::encoding::BoundedString<255>,
14651                        fidl::encoding::DefaultFuchsiaResourceDialect
14652                    )
14653                });
14654                fidl::decode!(
14655                    fidl::encoding::BoundedString<255>,
14656                    fidl::encoding::DefaultFuchsiaResourceDialect,
14657                    val_ref,
14658                    decoder,
14659                    inner_offset,
14660                    inner_depth
14661                )?;
14662                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14663                {
14664                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14665                }
14666                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14667                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14668                }
14669            }
14670
14671            next_offset += envelope_size;
14672            _next_ordinal_to_read += 1;
14673            if next_offset >= end_offset {
14674                return Ok(());
14675            }
14676
14677            // Decode unknown envelopes for gaps in ordinals.
14678            while _next_ordinal_to_read < 2 {
14679                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14680                _next_ordinal_to_read += 1;
14681                next_offset += envelope_size;
14682            }
14683
14684            let next_out_of_line = decoder.next_out_of_line();
14685            let handles_before = decoder.remaining_handles();
14686            if let Some((inlined, num_bytes, num_handles)) =
14687                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14688            {
14689                let member_inline_size = <fidl::encoding::Endpoint<
14690                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14691                > as fidl::encoding::TypeMarker>::inline_size(
14692                    decoder.context
14693                );
14694                if inlined != (member_inline_size <= 4) {
14695                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14696                }
14697                let inner_offset;
14698                let mut inner_depth = depth.clone();
14699                if inlined {
14700                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14701                    inner_offset = next_offset;
14702                } else {
14703                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14704                    inner_depth.increment()?;
14705                }
14706                let val_ref = self.directory.get_or_insert_with(|| {
14707                    fidl::new_empty!(
14708                        fidl::encoding::Endpoint<
14709                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14710                        >,
14711                        fidl::encoding::DefaultFuchsiaResourceDialect
14712                    )
14713                });
14714                fidl::decode!(
14715                    fidl::encoding::Endpoint<
14716                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
14717                    >,
14718                    fidl::encoding::DefaultFuchsiaResourceDialect,
14719                    val_ref,
14720                    decoder,
14721                    inner_offset,
14722                    inner_depth
14723                )?;
14724                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14725                {
14726                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14727                }
14728                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14729                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14730                }
14731            }
14732
14733            next_offset += envelope_size;
14734
14735            // Decode the remaining unknown envelopes.
14736            while next_offset < end_offset {
14737                _next_ordinal_to_read += 1;
14738                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14739                next_offset += envelope_size;
14740            }
14741
14742            Ok(())
14743        }
14744    }
14745
14746    impl Cookie {
14747        #[inline(always)]
14748        fn max_ordinal_present(&self) -> u64 {
14749            if let Some(_) = self.value {
14750                return 2;
14751            }
14752            if let Some(_) = self.id {
14753                return 1;
14754            }
14755            0
14756        }
14757    }
14758
14759    impl fidl::encoding::ResourceTypeMarker for Cookie {
14760        type Borrowed<'a> = &'a mut Self;
14761        fn take_or_borrow<'a>(
14762            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14763        ) -> Self::Borrowed<'a> {
14764            value
14765        }
14766    }
14767
14768    unsafe impl fidl::encoding::TypeMarker for Cookie {
14769        type Owned = Self;
14770
14771        #[inline(always)]
14772        fn inline_align(_context: fidl::encoding::Context) -> usize {
14773            8
14774        }
14775
14776        #[inline(always)]
14777        fn inline_size(_context: fidl::encoding::Context) -> usize {
14778            16
14779        }
14780    }
14781
14782    unsafe impl fidl::encoding::Encode<Cookie, fidl::encoding::DefaultFuchsiaResourceDialect>
14783        for &mut Cookie
14784    {
14785        unsafe fn encode(
14786            self,
14787            encoder: &mut fidl::encoding::Encoder<
14788                '_,
14789                fidl::encoding::DefaultFuchsiaResourceDialect,
14790            >,
14791            offset: usize,
14792            mut depth: fidl::encoding::Depth,
14793        ) -> fidl::Result<()> {
14794            encoder.debug_check_bounds::<Cookie>(offset);
14795            // Vector header
14796            let max_ordinal: u64 = self.max_ordinal_present();
14797            encoder.write_num(max_ordinal, offset);
14798            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14799            // Calling encoder.out_of_line_offset(0) is not allowed.
14800            if max_ordinal == 0 {
14801                return Ok(());
14802            }
14803            depth.increment()?;
14804            let envelope_size = 8;
14805            let bytes_len = max_ordinal as usize * envelope_size;
14806            #[allow(unused_variables)]
14807            let offset = encoder.out_of_line_offset(bytes_len);
14808            let mut _prev_end_offset: usize = 0;
14809            if 1 > max_ordinal {
14810                return Ok(());
14811            }
14812
14813            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14814            // are envelope_size bytes.
14815            let cur_offset: usize = (1 - 1) * envelope_size;
14816
14817            // Zero reserved fields.
14818            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14819
14820            // Safety:
14821            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14822            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14823            //   envelope_size bytes, there is always sufficient room.
14824            fidl::encoding::encode_in_envelope_optional::<
14825                CookieId,
14826                fidl::encoding::DefaultFuchsiaResourceDialect,
14827            >(
14828                self.id.as_ref().map(<CookieId as fidl::encoding::ValueTypeMarker>::borrow),
14829                encoder,
14830                offset + cur_offset,
14831                depth,
14832            )?;
14833
14834            _prev_end_offset = cur_offset + envelope_size;
14835            if 2 > max_ordinal {
14836                return Ok(());
14837            }
14838
14839            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14840            // are envelope_size bytes.
14841            let cur_offset: usize = (2 - 1) * envelope_size;
14842
14843            // Zero reserved fields.
14844            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14845
14846            // Safety:
14847            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14848            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14849            //   envelope_size bytes, there is always sufficient room.
14850            fidl::encoding::encode_in_envelope_optional::<
14851                fidl::encoding::UnboundedString,
14852                fidl::encoding::DefaultFuchsiaResourceDialect,
14853            >(
14854                self.value.as_ref().map(
14855                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
14856                ),
14857                encoder,
14858                offset + cur_offset,
14859                depth,
14860            )?;
14861
14862            _prev_end_offset = cur_offset + envelope_size;
14863
14864            Ok(())
14865        }
14866    }
14867
14868    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Cookie {
14869        #[inline(always)]
14870        fn new_empty() -> Self {
14871            Self::default()
14872        }
14873
14874        unsafe fn decode(
14875            &mut self,
14876            decoder: &mut fidl::encoding::Decoder<
14877                '_,
14878                fidl::encoding::DefaultFuchsiaResourceDialect,
14879            >,
14880            offset: usize,
14881            mut depth: fidl::encoding::Depth,
14882        ) -> fidl::Result<()> {
14883            decoder.debug_check_bounds::<Self>(offset);
14884            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14885                None => return Err(fidl::Error::NotNullable),
14886                Some(len) => len,
14887            };
14888            // Calling decoder.out_of_line_offset(0) is not allowed.
14889            if len == 0 {
14890                return Ok(());
14891            };
14892            depth.increment()?;
14893            let envelope_size = 8;
14894            let bytes_len = len * envelope_size;
14895            let offset = decoder.out_of_line_offset(bytes_len)?;
14896            // Decode the envelope for each type.
14897            let mut _next_ordinal_to_read = 0;
14898            let mut next_offset = offset;
14899            let end_offset = offset + bytes_len;
14900            _next_ordinal_to_read += 1;
14901            if next_offset >= end_offset {
14902                return Ok(());
14903            }
14904
14905            // Decode unknown envelopes for gaps in ordinals.
14906            while _next_ordinal_to_read < 1 {
14907                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14908                _next_ordinal_to_read += 1;
14909                next_offset += envelope_size;
14910            }
14911
14912            let next_out_of_line = decoder.next_out_of_line();
14913            let handles_before = decoder.remaining_handles();
14914            if let Some((inlined, num_bytes, num_handles)) =
14915                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14916            {
14917                let member_inline_size =
14918                    <CookieId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14919                if inlined != (member_inline_size <= 4) {
14920                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14921                }
14922                let inner_offset;
14923                let mut inner_depth = depth.clone();
14924                if inlined {
14925                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14926                    inner_offset = next_offset;
14927                } else {
14928                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14929                    inner_depth.increment()?;
14930                }
14931                let val_ref = self.id.get_or_insert_with(|| {
14932                    fidl::new_empty!(CookieId, fidl::encoding::DefaultFuchsiaResourceDialect)
14933                });
14934                fidl::decode!(
14935                    CookieId,
14936                    fidl::encoding::DefaultFuchsiaResourceDialect,
14937                    val_ref,
14938                    decoder,
14939                    inner_offset,
14940                    inner_depth
14941                )?;
14942                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14943                {
14944                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14945                }
14946                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14947                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14948                }
14949            }
14950
14951            next_offset += envelope_size;
14952            _next_ordinal_to_read += 1;
14953            if next_offset >= end_offset {
14954                return Ok(());
14955            }
14956
14957            // Decode unknown envelopes for gaps in ordinals.
14958            while _next_ordinal_to_read < 2 {
14959                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14960                _next_ordinal_to_read += 1;
14961                next_offset += envelope_size;
14962            }
14963
14964            let next_out_of_line = decoder.next_out_of_line();
14965            let handles_before = decoder.remaining_handles();
14966            if let Some((inlined, num_bytes, num_handles)) =
14967                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14968            {
14969                let member_inline_size =
14970                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
14971                        decoder.context,
14972                    );
14973                if inlined != (member_inline_size <= 4) {
14974                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14975                }
14976                let inner_offset;
14977                let mut inner_depth = depth.clone();
14978                if inlined {
14979                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14980                    inner_offset = next_offset;
14981                } else {
14982                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14983                    inner_depth.increment()?;
14984                }
14985                let val_ref = self.value.get_or_insert_with(|| {
14986                    fidl::new_empty!(
14987                        fidl::encoding::UnboundedString,
14988                        fidl::encoding::DefaultFuchsiaResourceDialect
14989                    )
14990                });
14991                fidl::decode!(
14992                    fidl::encoding::UnboundedString,
14993                    fidl::encoding::DefaultFuchsiaResourceDialect,
14994                    val_ref,
14995                    decoder,
14996                    inner_offset,
14997                    inner_depth
14998                )?;
14999                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15000                {
15001                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15002                }
15003                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15004                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15005                }
15006            }
15007
15008            next_offset += envelope_size;
15009
15010            // Decode the remaining unknown envelopes.
15011            while next_offset < end_offset {
15012                _next_ordinal_to_read += 1;
15013                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15014                next_offset += envelope_size;
15015            }
15016
15017            Ok(())
15018        }
15019    }
15020
15021    impl CreateContextParams {
15022        #[inline(always)]
15023        fn max_ordinal_present(&self) -> u64 {
15024            if let Some(_) = self.data_quota_bytes {
15025                return 13;
15026            }
15027            if let Some(_) = self.cdm_data_quota_bytes {
15028                return 12;
15029            }
15030            if let Some(_) = self.cdm_data_directory {
15031                return 11;
15032            }
15033            if let Some(_) = self.cors_exempt_headers {
15034                return 10;
15035            }
15036            if let Some(_) = self.unsafely_treat_insecure_origins_as_secure {
15037                return 9;
15038            }
15039            if let Some(_) = self.playready_key_system {
15040                return 8;
15041            }
15042            if let Some(_) = self.features {
15043                return 7;
15044            }
15045            if let Some(_) = self.content_directories {
15046                return 6;
15047            }
15048            if let Some(_) = self.remote_debugging_port {
15049                return 5;
15050            }
15051            if let Some(_) = self.user_agent_version {
15052                return 4;
15053            }
15054            if let Some(_) = self.user_agent_product {
15055                return 3;
15056            }
15057            if let Some(_) = self.data_directory {
15058                return 2;
15059            }
15060            if let Some(_) = self.service_directory {
15061                return 1;
15062            }
15063            0
15064        }
15065    }
15066
15067    impl fidl::encoding::ResourceTypeMarker for CreateContextParams {
15068        type Borrowed<'a> = &'a mut Self;
15069        fn take_or_borrow<'a>(
15070            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15071        ) -> Self::Borrowed<'a> {
15072            value
15073        }
15074    }
15075
15076    unsafe impl fidl::encoding::TypeMarker for CreateContextParams {
15077        type Owned = Self;
15078
15079        #[inline(always)]
15080        fn inline_align(_context: fidl::encoding::Context) -> usize {
15081            8
15082        }
15083
15084        #[inline(always)]
15085        fn inline_size(_context: fidl::encoding::Context) -> usize {
15086            16
15087        }
15088    }
15089
15090    unsafe impl
15091        fidl::encoding::Encode<CreateContextParams, fidl::encoding::DefaultFuchsiaResourceDialect>
15092        for &mut CreateContextParams
15093    {
15094        unsafe fn encode(
15095            self,
15096            encoder: &mut fidl::encoding::Encoder<
15097                '_,
15098                fidl::encoding::DefaultFuchsiaResourceDialect,
15099            >,
15100            offset: usize,
15101            mut depth: fidl::encoding::Depth,
15102        ) -> fidl::Result<()> {
15103            encoder.debug_check_bounds::<CreateContextParams>(offset);
15104            // Vector header
15105            let max_ordinal: u64 = self.max_ordinal_present();
15106            encoder.write_num(max_ordinal, offset);
15107            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15108            // Calling encoder.out_of_line_offset(0) is not allowed.
15109            if max_ordinal == 0 {
15110                return Ok(());
15111            }
15112            depth.increment()?;
15113            let envelope_size = 8;
15114            let bytes_len = max_ordinal as usize * envelope_size;
15115            #[allow(unused_variables)]
15116            let offset = encoder.out_of_line_offset(bytes_len);
15117            let mut _prev_end_offset: usize = 0;
15118            if 1 > max_ordinal {
15119                return Ok(());
15120            }
15121
15122            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15123            // are envelope_size bytes.
15124            let cur_offset: usize = (1 - 1) * envelope_size;
15125
15126            // Zero reserved fields.
15127            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15128
15129            // Safety:
15130            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15131            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15132            //   envelope_size bytes, there is always sufficient room.
15133            fidl::encoding::encode_in_envelope_optional::<
15134                fidl::encoding::Endpoint<
15135                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15136                >,
15137                fidl::encoding::DefaultFuchsiaResourceDialect,
15138            >(
15139                self.service_directory.as_mut().map(
15140                    <fidl::encoding::Endpoint<
15141                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15142                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15143                ),
15144                encoder,
15145                offset + cur_offset,
15146                depth,
15147            )?;
15148
15149            _prev_end_offset = cur_offset + envelope_size;
15150            if 2 > max_ordinal {
15151                return Ok(());
15152            }
15153
15154            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15155            // are envelope_size bytes.
15156            let cur_offset: usize = (2 - 1) * envelope_size;
15157
15158            // Zero reserved fields.
15159            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15160
15161            // Safety:
15162            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15163            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15164            //   envelope_size bytes, there is always sufficient room.
15165            fidl::encoding::encode_in_envelope_optional::<
15166                fidl::encoding::Endpoint<
15167                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15168                >,
15169                fidl::encoding::DefaultFuchsiaResourceDialect,
15170            >(
15171                self.data_directory.as_mut().map(
15172                    <fidl::encoding::Endpoint<
15173                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15174                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15175                ),
15176                encoder,
15177                offset + cur_offset,
15178                depth,
15179            )?;
15180
15181            _prev_end_offset = cur_offset + envelope_size;
15182            if 3 > max_ordinal {
15183                return Ok(());
15184            }
15185
15186            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15187            // are envelope_size bytes.
15188            let cur_offset: usize = (3 - 1) * envelope_size;
15189
15190            // Zero reserved fields.
15191            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15192
15193            // Safety:
15194            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15195            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15196            //   envelope_size bytes, there is always sufficient room.
15197            fidl::encoding::encode_in_envelope_optional::<
15198                fidl::encoding::BoundedString<128>,
15199                fidl::encoding::DefaultFuchsiaResourceDialect,
15200            >(
15201                self.user_agent_product.as_ref().map(
15202                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15203                ),
15204                encoder,
15205                offset + cur_offset,
15206                depth,
15207            )?;
15208
15209            _prev_end_offset = cur_offset + envelope_size;
15210            if 4 > max_ordinal {
15211                return Ok(());
15212            }
15213
15214            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15215            // are envelope_size bytes.
15216            let cur_offset: usize = (4 - 1) * envelope_size;
15217
15218            // Zero reserved fields.
15219            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15220
15221            // Safety:
15222            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15223            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15224            //   envelope_size bytes, there is always sufficient room.
15225            fidl::encoding::encode_in_envelope_optional::<
15226                fidl::encoding::BoundedString<128>,
15227                fidl::encoding::DefaultFuchsiaResourceDialect,
15228            >(
15229                self.user_agent_version.as_ref().map(
15230                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15231                ),
15232                encoder,
15233                offset + cur_offset,
15234                depth,
15235            )?;
15236
15237            _prev_end_offset = cur_offset + envelope_size;
15238            if 5 > max_ordinal {
15239                return Ok(());
15240            }
15241
15242            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15243            // are envelope_size bytes.
15244            let cur_offset: usize = (5 - 1) * envelope_size;
15245
15246            // Zero reserved fields.
15247            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15248
15249            // Safety:
15250            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15251            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15252            //   envelope_size bytes, there is always sufficient room.
15253            fidl::encoding::encode_in_envelope_optional::<
15254                u16,
15255                fidl::encoding::DefaultFuchsiaResourceDialect,
15256            >(
15257                self.remote_debugging_port
15258                    .as_ref()
15259                    .map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
15260                encoder,
15261                offset + cur_offset,
15262                depth,
15263            )?;
15264
15265            _prev_end_offset = cur_offset + envelope_size;
15266            if 6 > max_ordinal {
15267                return Ok(());
15268            }
15269
15270            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15271            // are envelope_size bytes.
15272            let cur_offset: usize = (6 - 1) * envelope_size;
15273
15274            // Zero reserved fields.
15275            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15276
15277            // Safety:
15278            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15279            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15280            //   envelope_size bytes, there is always sufficient room.
15281            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15282            self.content_directories.as_mut().map(<fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15283            encoder, offset + cur_offset, depth
15284        )?;
15285
15286            _prev_end_offset = cur_offset + envelope_size;
15287            if 7 > max_ordinal {
15288                return Ok(());
15289            }
15290
15291            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15292            // are envelope_size bytes.
15293            let cur_offset: usize = (7 - 1) * envelope_size;
15294
15295            // Zero reserved fields.
15296            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15297
15298            // Safety:
15299            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15300            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15301            //   envelope_size bytes, there is always sufficient room.
15302            fidl::encoding::encode_in_envelope_optional::<
15303                ContextFeatureFlags,
15304                fidl::encoding::DefaultFuchsiaResourceDialect,
15305            >(
15306                self.features
15307                    .as_ref()
15308                    .map(<ContextFeatureFlags as fidl::encoding::ValueTypeMarker>::borrow),
15309                encoder,
15310                offset + cur_offset,
15311                depth,
15312            )?;
15313
15314            _prev_end_offset = cur_offset + envelope_size;
15315            if 8 > max_ordinal {
15316                return Ok(());
15317            }
15318
15319            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15320            // are envelope_size bytes.
15321            let cur_offset: usize = (8 - 1) * envelope_size;
15322
15323            // Zero reserved fields.
15324            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15325
15326            // Safety:
15327            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15328            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15329            //   envelope_size bytes, there is always sufficient room.
15330            fidl::encoding::encode_in_envelope_optional::<
15331                fidl::encoding::BoundedString<128>,
15332                fidl::encoding::DefaultFuchsiaResourceDialect,
15333            >(
15334                self.playready_key_system.as_ref().map(
15335                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
15336                ),
15337                encoder,
15338                offset + cur_offset,
15339                depth,
15340            )?;
15341
15342            _prev_end_offset = cur_offset + envelope_size;
15343            if 9 > max_ordinal {
15344                return Ok(());
15345            }
15346
15347            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15348            // are envelope_size bytes.
15349            let cur_offset: usize = (9 - 1) * envelope_size;
15350
15351            // Zero reserved fields.
15352            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15353
15354            // Safety:
15355            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15356            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15357            //   envelope_size bytes, there is always sufficient room.
15358            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15359            self.unsafely_treat_insecure_origins_as_secure.as_ref().map(<fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100> as fidl::encoding::ValueTypeMarker>::borrow),
15360            encoder, offset + cur_offset, depth
15361        )?;
15362
15363            _prev_end_offset = cur_offset + envelope_size;
15364            if 10 > max_ordinal {
15365                return Ok(());
15366            }
15367
15368            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15369            // are envelope_size bytes.
15370            let cur_offset: usize = (10 - 1) * envelope_size;
15371
15372            // Zero reserved fields.
15373            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15374
15375            // Safety:
15376            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15377            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15378            //   envelope_size bytes, there is always sufficient room.
15379            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15380            self.cors_exempt_headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>> as fidl::encoding::ValueTypeMarker>::borrow),
15381            encoder, offset + cur_offset, depth
15382        )?;
15383
15384            _prev_end_offset = cur_offset + envelope_size;
15385            if 11 > max_ordinal {
15386                return Ok(());
15387            }
15388
15389            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15390            // are envelope_size bytes.
15391            let cur_offset: usize = (11 - 1) * envelope_size;
15392
15393            // Zero reserved fields.
15394            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15395
15396            // Safety:
15397            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15398            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15399            //   envelope_size bytes, there is always sufficient room.
15400            fidl::encoding::encode_in_envelope_optional::<
15401                fidl::encoding::Endpoint<
15402                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15403                >,
15404                fidl::encoding::DefaultFuchsiaResourceDialect,
15405            >(
15406                self.cdm_data_directory.as_mut().map(
15407                    <fidl::encoding::Endpoint<
15408                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15409                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
15410                ),
15411                encoder,
15412                offset + cur_offset,
15413                depth,
15414            )?;
15415
15416            _prev_end_offset = cur_offset + envelope_size;
15417            if 12 > max_ordinal {
15418                return Ok(());
15419            }
15420
15421            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15422            // are envelope_size bytes.
15423            let cur_offset: usize = (12 - 1) * envelope_size;
15424
15425            // Zero reserved fields.
15426            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15427
15428            // Safety:
15429            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15430            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15431            //   envelope_size bytes, there is always sufficient room.
15432            fidl::encoding::encode_in_envelope_optional::<
15433                u64,
15434                fidl::encoding::DefaultFuchsiaResourceDialect,
15435            >(
15436                self.cdm_data_quota_bytes
15437                    .as_ref()
15438                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15439                encoder,
15440                offset + cur_offset,
15441                depth,
15442            )?;
15443
15444            _prev_end_offset = cur_offset + envelope_size;
15445            if 13 > max_ordinal {
15446                return Ok(());
15447            }
15448
15449            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15450            // are envelope_size bytes.
15451            let cur_offset: usize = (13 - 1) * envelope_size;
15452
15453            // Zero reserved fields.
15454            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15455
15456            // Safety:
15457            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15458            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15459            //   envelope_size bytes, there is always sufficient room.
15460            fidl::encoding::encode_in_envelope_optional::<
15461                u64,
15462                fidl::encoding::DefaultFuchsiaResourceDialect,
15463            >(
15464                self.data_quota_bytes
15465                    .as_ref()
15466                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
15467                encoder,
15468                offset + cur_offset,
15469                depth,
15470            )?;
15471
15472            _prev_end_offset = cur_offset + envelope_size;
15473
15474            Ok(())
15475        }
15476    }
15477
15478    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15479        for CreateContextParams
15480    {
15481        #[inline(always)]
15482        fn new_empty() -> Self {
15483            Self::default()
15484        }
15485
15486        unsafe fn decode(
15487            &mut self,
15488            decoder: &mut fidl::encoding::Decoder<
15489                '_,
15490                fidl::encoding::DefaultFuchsiaResourceDialect,
15491            >,
15492            offset: usize,
15493            mut depth: fidl::encoding::Depth,
15494        ) -> fidl::Result<()> {
15495            decoder.debug_check_bounds::<Self>(offset);
15496            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15497                None => return Err(fidl::Error::NotNullable),
15498                Some(len) => len,
15499            };
15500            // Calling decoder.out_of_line_offset(0) is not allowed.
15501            if len == 0 {
15502                return Ok(());
15503            };
15504            depth.increment()?;
15505            let envelope_size = 8;
15506            let bytes_len = len * envelope_size;
15507            let offset = decoder.out_of_line_offset(bytes_len)?;
15508            // Decode the envelope for each type.
15509            let mut _next_ordinal_to_read = 0;
15510            let mut next_offset = offset;
15511            let end_offset = offset + bytes_len;
15512            _next_ordinal_to_read += 1;
15513            if next_offset >= end_offset {
15514                return Ok(());
15515            }
15516
15517            // Decode unknown envelopes for gaps in ordinals.
15518            while _next_ordinal_to_read < 1 {
15519                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15520                _next_ordinal_to_read += 1;
15521                next_offset += envelope_size;
15522            }
15523
15524            let next_out_of_line = decoder.next_out_of_line();
15525            let handles_before = decoder.remaining_handles();
15526            if let Some((inlined, num_bytes, num_handles)) =
15527                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15528            {
15529                let member_inline_size = <fidl::encoding::Endpoint<
15530                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15531                > as fidl::encoding::TypeMarker>::inline_size(
15532                    decoder.context
15533                );
15534                if inlined != (member_inline_size <= 4) {
15535                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15536                }
15537                let inner_offset;
15538                let mut inner_depth = depth.clone();
15539                if inlined {
15540                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15541                    inner_offset = next_offset;
15542                } else {
15543                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15544                    inner_depth.increment()?;
15545                }
15546                let val_ref = self.service_directory.get_or_insert_with(|| {
15547                    fidl::new_empty!(
15548                        fidl::encoding::Endpoint<
15549                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15550                        >,
15551                        fidl::encoding::DefaultFuchsiaResourceDialect
15552                    )
15553                });
15554                fidl::decode!(
15555                    fidl::encoding::Endpoint<
15556                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15557                    >,
15558                    fidl::encoding::DefaultFuchsiaResourceDialect,
15559                    val_ref,
15560                    decoder,
15561                    inner_offset,
15562                    inner_depth
15563                )?;
15564                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15565                {
15566                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15567                }
15568                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15569                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15570                }
15571            }
15572
15573            next_offset += envelope_size;
15574            _next_ordinal_to_read += 1;
15575            if next_offset >= end_offset {
15576                return Ok(());
15577            }
15578
15579            // Decode unknown envelopes for gaps in ordinals.
15580            while _next_ordinal_to_read < 2 {
15581                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15582                _next_ordinal_to_read += 1;
15583                next_offset += envelope_size;
15584            }
15585
15586            let next_out_of_line = decoder.next_out_of_line();
15587            let handles_before = decoder.remaining_handles();
15588            if let Some((inlined, num_bytes, num_handles)) =
15589                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15590            {
15591                let member_inline_size = <fidl::encoding::Endpoint<
15592                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15593                > as fidl::encoding::TypeMarker>::inline_size(
15594                    decoder.context
15595                );
15596                if inlined != (member_inline_size <= 4) {
15597                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15598                }
15599                let inner_offset;
15600                let mut inner_depth = depth.clone();
15601                if inlined {
15602                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15603                    inner_offset = next_offset;
15604                } else {
15605                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15606                    inner_depth.increment()?;
15607                }
15608                let val_ref = self.data_directory.get_or_insert_with(|| {
15609                    fidl::new_empty!(
15610                        fidl::encoding::Endpoint<
15611                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15612                        >,
15613                        fidl::encoding::DefaultFuchsiaResourceDialect
15614                    )
15615                });
15616                fidl::decode!(
15617                    fidl::encoding::Endpoint<
15618                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
15619                    >,
15620                    fidl::encoding::DefaultFuchsiaResourceDialect,
15621                    val_ref,
15622                    decoder,
15623                    inner_offset,
15624                    inner_depth
15625                )?;
15626                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15627                {
15628                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15629                }
15630                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15631                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15632                }
15633            }
15634
15635            next_offset += envelope_size;
15636            _next_ordinal_to_read += 1;
15637            if next_offset >= end_offset {
15638                return Ok(());
15639            }
15640
15641            // Decode unknown envelopes for gaps in ordinals.
15642            while _next_ordinal_to_read < 3 {
15643                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15644                _next_ordinal_to_read += 1;
15645                next_offset += envelope_size;
15646            }
15647
15648            let next_out_of_line = decoder.next_out_of_line();
15649            let handles_before = decoder.remaining_handles();
15650            if let Some((inlined, num_bytes, num_handles)) =
15651                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15652            {
15653                let member_inline_size =
15654                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15655                        decoder.context,
15656                    );
15657                if inlined != (member_inline_size <= 4) {
15658                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15659                }
15660                let inner_offset;
15661                let mut inner_depth = depth.clone();
15662                if inlined {
15663                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15664                    inner_offset = next_offset;
15665                } else {
15666                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15667                    inner_depth.increment()?;
15668                }
15669                let val_ref = self.user_agent_product.get_or_insert_with(|| {
15670                    fidl::new_empty!(
15671                        fidl::encoding::BoundedString<128>,
15672                        fidl::encoding::DefaultFuchsiaResourceDialect
15673                    )
15674                });
15675                fidl::decode!(
15676                    fidl::encoding::BoundedString<128>,
15677                    fidl::encoding::DefaultFuchsiaResourceDialect,
15678                    val_ref,
15679                    decoder,
15680                    inner_offset,
15681                    inner_depth
15682                )?;
15683                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15684                {
15685                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15686                }
15687                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15688                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15689                }
15690            }
15691
15692            next_offset += envelope_size;
15693            _next_ordinal_to_read += 1;
15694            if next_offset >= end_offset {
15695                return Ok(());
15696            }
15697
15698            // Decode unknown envelopes for gaps in ordinals.
15699            while _next_ordinal_to_read < 4 {
15700                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15701                _next_ordinal_to_read += 1;
15702                next_offset += envelope_size;
15703            }
15704
15705            let next_out_of_line = decoder.next_out_of_line();
15706            let handles_before = decoder.remaining_handles();
15707            if let Some((inlined, num_bytes, num_handles)) =
15708                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15709            {
15710                let member_inline_size =
15711                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15712                        decoder.context,
15713                    );
15714                if inlined != (member_inline_size <= 4) {
15715                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15716                }
15717                let inner_offset;
15718                let mut inner_depth = depth.clone();
15719                if inlined {
15720                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15721                    inner_offset = next_offset;
15722                } else {
15723                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15724                    inner_depth.increment()?;
15725                }
15726                let val_ref = self.user_agent_version.get_or_insert_with(|| {
15727                    fidl::new_empty!(
15728                        fidl::encoding::BoundedString<128>,
15729                        fidl::encoding::DefaultFuchsiaResourceDialect
15730                    )
15731                });
15732                fidl::decode!(
15733                    fidl::encoding::BoundedString<128>,
15734                    fidl::encoding::DefaultFuchsiaResourceDialect,
15735                    val_ref,
15736                    decoder,
15737                    inner_offset,
15738                    inner_depth
15739                )?;
15740                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15741                {
15742                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15743                }
15744                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15745                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15746                }
15747            }
15748
15749            next_offset += envelope_size;
15750            _next_ordinal_to_read += 1;
15751            if next_offset >= end_offset {
15752                return Ok(());
15753            }
15754
15755            // Decode unknown envelopes for gaps in ordinals.
15756            while _next_ordinal_to_read < 5 {
15757                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15758                _next_ordinal_to_read += 1;
15759                next_offset += envelope_size;
15760            }
15761
15762            let next_out_of_line = decoder.next_out_of_line();
15763            let handles_before = decoder.remaining_handles();
15764            if let Some((inlined, num_bytes, num_handles)) =
15765                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15766            {
15767                let member_inline_size =
15768                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15769                if inlined != (member_inline_size <= 4) {
15770                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15771                }
15772                let inner_offset;
15773                let mut inner_depth = depth.clone();
15774                if inlined {
15775                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15776                    inner_offset = next_offset;
15777                } else {
15778                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15779                    inner_depth.increment()?;
15780                }
15781                let val_ref = self.remote_debugging_port.get_or_insert_with(|| {
15782                    fidl::new_empty!(u16, fidl::encoding::DefaultFuchsiaResourceDialect)
15783                });
15784                fidl::decode!(
15785                    u16,
15786                    fidl::encoding::DefaultFuchsiaResourceDialect,
15787                    val_ref,
15788                    decoder,
15789                    inner_offset,
15790                    inner_depth
15791                )?;
15792                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15793                {
15794                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15795                }
15796                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15797                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15798                }
15799            }
15800
15801            next_offset += envelope_size;
15802            _next_ordinal_to_read += 1;
15803            if next_offset >= end_offset {
15804                return Ok(());
15805            }
15806
15807            // Decode unknown envelopes for gaps in ordinals.
15808            while _next_ordinal_to_read < 6 {
15809                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15810                _next_ordinal_to_read += 1;
15811                next_offset += envelope_size;
15812            }
15813
15814            let next_out_of_line = decoder.next_out_of_line();
15815            let handles_before = decoder.remaining_handles();
15816            if let Some((inlined, num_bytes, num_handles)) =
15817                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15818            {
15819                let member_inline_size = <fidl::encoding::Vector<ContentDirectoryProvider, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
15820                if inlined != (member_inline_size <= 4) {
15821                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15822                }
15823                let inner_offset;
15824                let mut inner_depth = depth.clone();
15825                if inlined {
15826                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15827                    inner_offset = next_offset;
15828                } else {
15829                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15830                    inner_depth.increment()?;
15831                }
15832                let val_ref =
15833                self.content_directories.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect));
15834                fidl::decode!(fidl::encoding::Vector<ContentDirectoryProvider, 100>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
15835                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15836                {
15837                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15838                }
15839                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15840                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15841                }
15842            }
15843
15844            next_offset += envelope_size;
15845            _next_ordinal_to_read += 1;
15846            if next_offset >= end_offset {
15847                return Ok(());
15848            }
15849
15850            // Decode unknown envelopes for gaps in ordinals.
15851            while _next_ordinal_to_read < 7 {
15852                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15853                _next_ordinal_to_read += 1;
15854                next_offset += envelope_size;
15855            }
15856
15857            let next_out_of_line = decoder.next_out_of_line();
15858            let handles_before = decoder.remaining_handles();
15859            if let Some((inlined, num_bytes, num_handles)) =
15860                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15861            {
15862                let member_inline_size =
15863                    <ContextFeatureFlags as fidl::encoding::TypeMarker>::inline_size(
15864                        decoder.context,
15865                    );
15866                if inlined != (member_inline_size <= 4) {
15867                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15868                }
15869                let inner_offset;
15870                let mut inner_depth = depth.clone();
15871                if inlined {
15872                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15873                    inner_offset = next_offset;
15874                } else {
15875                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15876                    inner_depth.increment()?;
15877                }
15878                let val_ref = self.features.get_or_insert_with(|| {
15879                    fidl::new_empty!(
15880                        ContextFeatureFlags,
15881                        fidl::encoding::DefaultFuchsiaResourceDialect
15882                    )
15883                });
15884                fidl::decode!(
15885                    ContextFeatureFlags,
15886                    fidl::encoding::DefaultFuchsiaResourceDialect,
15887                    val_ref,
15888                    decoder,
15889                    inner_offset,
15890                    inner_depth
15891                )?;
15892                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15893                {
15894                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15895                }
15896                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15897                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15898                }
15899            }
15900
15901            next_offset += envelope_size;
15902            _next_ordinal_to_read += 1;
15903            if next_offset >= end_offset {
15904                return Ok(());
15905            }
15906
15907            // Decode unknown envelopes for gaps in ordinals.
15908            while _next_ordinal_to_read < 8 {
15909                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15910                _next_ordinal_to_read += 1;
15911                next_offset += envelope_size;
15912            }
15913
15914            let next_out_of_line = decoder.next_out_of_line();
15915            let handles_before = decoder.remaining_handles();
15916            if let Some((inlined, num_bytes, num_handles)) =
15917                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15918            {
15919                let member_inline_size =
15920                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
15921                        decoder.context,
15922                    );
15923                if inlined != (member_inline_size <= 4) {
15924                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15925                }
15926                let inner_offset;
15927                let mut inner_depth = depth.clone();
15928                if inlined {
15929                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15930                    inner_offset = next_offset;
15931                } else {
15932                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15933                    inner_depth.increment()?;
15934                }
15935                let val_ref = self.playready_key_system.get_or_insert_with(|| {
15936                    fidl::new_empty!(
15937                        fidl::encoding::BoundedString<128>,
15938                        fidl::encoding::DefaultFuchsiaResourceDialect
15939                    )
15940                });
15941                fidl::decode!(
15942                    fidl::encoding::BoundedString<128>,
15943                    fidl::encoding::DefaultFuchsiaResourceDialect,
15944                    val_ref,
15945                    decoder,
15946                    inner_offset,
15947                    inner_depth
15948                )?;
15949                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15950                {
15951                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15952                }
15953                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15954                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15955                }
15956            }
15957
15958            next_offset += envelope_size;
15959            _next_ordinal_to_read += 1;
15960            if next_offset >= end_offset {
15961                return Ok(());
15962            }
15963
15964            // Decode unknown envelopes for gaps in ordinals.
15965            while _next_ordinal_to_read < 9 {
15966                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15967                _next_ordinal_to_read += 1;
15968                next_offset += envelope_size;
15969            }
15970
15971            let next_out_of_line = decoder.next_out_of_line();
15972            let handles_before = decoder.remaining_handles();
15973            if let Some((inlined, num_bytes, num_handles)) =
15974                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15975            {
15976                let member_inline_size = <fidl::encoding::Vector<
15977                    fidl::encoding::BoundedString<513>,
15978                    100,
15979                > as fidl::encoding::TypeMarker>::inline_size(
15980                    decoder.context
15981                );
15982                if inlined != (member_inline_size <= 4) {
15983                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15984                }
15985                let inner_offset;
15986                let mut inner_depth = depth.clone();
15987                if inlined {
15988                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15989                    inner_offset = next_offset;
15990                } else {
15991                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15992                    inner_depth.increment()?;
15993                }
15994                let val_ref =
15995                    self.unsafely_treat_insecure_origins_as_secure.get_or_insert_with(|| {
15996                        fidl::new_empty!(
15997                            fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
15998                            fidl::encoding::DefaultFuchsiaResourceDialect
15999                        )
16000                    });
16001                fidl::decode!(
16002                    fidl::encoding::Vector<fidl::encoding::BoundedString<513>, 100>,
16003                    fidl::encoding::DefaultFuchsiaResourceDialect,
16004                    val_ref,
16005                    decoder,
16006                    inner_offset,
16007                    inner_depth
16008                )?;
16009                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16010                {
16011                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16012                }
16013                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16014                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16015                }
16016            }
16017
16018            next_offset += envelope_size;
16019            _next_ordinal_to_read += 1;
16020            if next_offset >= end_offset {
16021                return Ok(());
16022            }
16023
16024            // Decode unknown envelopes for gaps in ordinals.
16025            while _next_ordinal_to_read < 10 {
16026                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16027                _next_ordinal_to_read += 1;
16028                next_offset += envelope_size;
16029            }
16030
16031            let next_out_of_line = decoder.next_out_of_line();
16032            let handles_before = decoder.remaining_handles();
16033            if let Some((inlined, num_bytes, num_handles)) =
16034                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16035            {
16036                let member_inline_size = <fidl::encoding::UnboundedVector<
16037                    fidl::encoding::UnboundedVector<u8>,
16038                > as fidl::encoding::TypeMarker>::inline_size(
16039                    decoder.context
16040                );
16041                if inlined != (member_inline_size <= 4) {
16042                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16043                }
16044                let inner_offset;
16045                let mut inner_depth = depth.clone();
16046                if inlined {
16047                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16048                    inner_offset = next_offset;
16049                } else {
16050                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16051                    inner_depth.increment()?;
16052                }
16053                let val_ref = self.cors_exempt_headers.get_or_insert_with(|| {
16054                    fidl::new_empty!(
16055                        fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
16056                        fidl::encoding::DefaultFuchsiaResourceDialect
16057                    )
16058                });
16059                fidl::decode!(
16060                    fidl::encoding::UnboundedVector<fidl::encoding::UnboundedVector<u8>>,
16061                    fidl::encoding::DefaultFuchsiaResourceDialect,
16062                    val_ref,
16063                    decoder,
16064                    inner_offset,
16065                    inner_depth
16066                )?;
16067                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16068                {
16069                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16070                }
16071                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16072                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16073                }
16074            }
16075
16076            next_offset += envelope_size;
16077            _next_ordinal_to_read += 1;
16078            if next_offset >= end_offset {
16079                return Ok(());
16080            }
16081
16082            // Decode unknown envelopes for gaps in ordinals.
16083            while _next_ordinal_to_read < 11 {
16084                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16085                _next_ordinal_to_read += 1;
16086                next_offset += envelope_size;
16087            }
16088
16089            let next_out_of_line = decoder.next_out_of_line();
16090            let handles_before = decoder.remaining_handles();
16091            if let Some((inlined, num_bytes, num_handles)) =
16092                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16093            {
16094                let member_inline_size = <fidl::encoding::Endpoint<
16095                    fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16096                > as fidl::encoding::TypeMarker>::inline_size(
16097                    decoder.context
16098                );
16099                if inlined != (member_inline_size <= 4) {
16100                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16101                }
16102                let inner_offset;
16103                let mut inner_depth = depth.clone();
16104                if inlined {
16105                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16106                    inner_offset = next_offset;
16107                } else {
16108                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16109                    inner_depth.increment()?;
16110                }
16111                let val_ref = self.cdm_data_directory.get_or_insert_with(|| {
16112                    fidl::new_empty!(
16113                        fidl::encoding::Endpoint<
16114                            fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16115                        >,
16116                        fidl::encoding::DefaultFuchsiaResourceDialect
16117                    )
16118                });
16119                fidl::decode!(
16120                    fidl::encoding::Endpoint<
16121                        fidl::endpoints::ClientEnd<fidl_fuchsia_io::DirectoryMarker>,
16122                    >,
16123                    fidl::encoding::DefaultFuchsiaResourceDialect,
16124                    val_ref,
16125                    decoder,
16126                    inner_offset,
16127                    inner_depth
16128                )?;
16129                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16130                {
16131                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16132                }
16133                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16134                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16135                }
16136            }
16137
16138            next_offset += envelope_size;
16139            _next_ordinal_to_read += 1;
16140            if next_offset >= end_offset {
16141                return Ok(());
16142            }
16143
16144            // Decode unknown envelopes for gaps in ordinals.
16145            while _next_ordinal_to_read < 12 {
16146                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16147                _next_ordinal_to_read += 1;
16148                next_offset += envelope_size;
16149            }
16150
16151            let next_out_of_line = decoder.next_out_of_line();
16152            let handles_before = decoder.remaining_handles();
16153            if let Some((inlined, num_bytes, num_handles)) =
16154                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16155            {
16156                let member_inline_size =
16157                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16158                if inlined != (member_inline_size <= 4) {
16159                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16160                }
16161                let inner_offset;
16162                let mut inner_depth = depth.clone();
16163                if inlined {
16164                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16165                    inner_offset = next_offset;
16166                } else {
16167                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16168                    inner_depth.increment()?;
16169                }
16170                let val_ref = self.cdm_data_quota_bytes.get_or_insert_with(|| {
16171                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16172                });
16173                fidl::decode!(
16174                    u64,
16175                    fidl::encoding::DefaultFuchsiaResourceDialect,
16176                    val_ref,
16177                    decoder,
16178                    inner_offset,
16179                    inner_depth
16180                )?;
16181                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16182                {
16183                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16184                }
16185                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16186                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16187                }
16188            }
16189
16190            next_offset += envelope_size;
16191            _next_ordinal_to_read += 1;
16192            if next_offset >= end_offset {
16193                return Ok(());
16194            }
16195
16196            // Decode unknown envelopes for gaps in ordinals.
16197            while _next_ordinal_to_read < 13 {
16198                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16199                _next_ordinal_to_read += 1;
16200                next_offset += envelope_size;
16201            }
16202
16203            let next_out_of_line = decoder.next_out_of_line();
16204            let handles_before = decoder.remaining_handles();
16205            if let Some((inlined, num_bytes, num_handles)) =
16206                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16207            {
16208                let member_inline_size =
16209                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16210                if inlined != (member_inline_size <= 4) {
16211                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16212                }
16213                let inner_offset;
16214                let mut inner_depth = depth.clone();
16215                if inlined {
16216                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16217                    inner_offset = next_offset;
16218                } else {
16219                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16220                    inner_depth.increment()?;
16221                }
16222                let val_ref = self.data_quota_bytes.get_or_insert_with(|| {
16223                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
16224                });
16225                fidl::decode!(
16226                    u64,
16227                    fidl::encoding::DefaultFuchsiaResourceDialect,
16228                    val_ref,
16229                    decoder,
16230                    inner_offset,
16231                    inner_depth
16232                )?;
16233                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16234                {
16235                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16236                }
16237                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16238                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16239                }
16240            }
16241
16242            next_offset += envelope_size;
16243
16244            // Decode the remaining unknown envelopes.
16245            while next_offset < end_offset {
16246                _next_ordinal_to_read += 1;
16247                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16248                next_offset += envelope_size;
16249            }
16250
16251            Ok(())
16252        }
16253    }
16254
16255    impl CreateFrameParams {
16256        #[inline(always)]
16257        fn max_ordinal_present(&self) -> u64 {
16258            if let Some(_) = self.explicit_sites_filter_error_page {
16259                return 4;
16260            }
16261            if let Some(_) = self.debug_name {
16262                return 2;
16263            }
16264            if let Some(_) = self.enable_remote_debugging {
16265                return 1;
16266            }
16267            0
16268        }
16269    }
16270
16271    impl fidl::encoding::ResourceTypeMarker for CreateFrameParams {
16272        type Borrowed<'a> = &'a mut Self;
16273        fn take_or_borrow<'a>(
16274            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16275        ) -> Self::Borrowed<'a> {
16276            value
16277        }
16278    }
16279
16280    unsafe impl fidl::encoding::TypeMarker for CreateFrameParams {
16281        type Owned = Self;
16282
16283        #[inline(always)]
16284        fn inline_align(_context: fidl::encoding::Context) -> usize {
16285            8
16286        }
16287
16288        #[inline(always)]
16289        fn inline_size(_context: fidl::encoding::Context) -> usize {
16290            16
16291        }
16292    }
16293
16294    unsafe impl
16295        fidl::encoding::Encode<CreateFrameParams, fidl::encoding::DefaultFuchsiaResourceDialect>
16296        for &mut CreateFrameParams
16297    {
16298        unsafe fn encode(
16299            self,
16300            encoder: &mut fidl::encoding::Encoder<
16301                '_,
16302                fidl::encoding::DefaultFuchsiaResourceDialect,
16303            >,
16304            offset: usize,
16305            mut depth: fidl::encoding::Depth,
16306        ) -> fidl::Result<()> {
16307            encoder.debug_check_bounds::<CreateFrameParams>(offset);
16308            // Vector header
16309            let max_ordinal: u64 = self.max_ordinal_present();
16310            encoder.write_num(max_ordinal, offset);
16311            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16312            // Calling encoder.out_of_line_offset(0) is not allowed.
16313            if max_ordinal == 0 {
16314                return Ok(());
16315            }
16316            depth.increment()?;
16317            let envelope_size = 8;
16318            let bytes_len = max_ordinal as usize * envelope_size;
16319            #[allow(unused_variables)]
16320            let offset = encoder.out_of_line_offset(bytes_len);
16321            let mut _prev_end_offset: usize = 0;
16322            if 1 > max_ordinal {
16323                return Ok(());
16324            }
16325
16326            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16327            // are envelope_size bytes.
16328            let cur_offset: usize = (1 - 1) * envelope_size;
16329
16330            // Zero reserved fields.
16331            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16332
16333            // Safety:
16334            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16335            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16336            //   envelope_size bytes, there is always sufficient room.
16337            fidl::encoding::encode_in_envelope_optional::<
16338                bool,
16339                fidl::encoding::DefaultFuchsiaResourceDialect,
16340            >(
16341                self.enable_remote_debugging
16342                    .as_ref()
16343                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
16344                encoder,
16345                offset + cur_offset,
16346                depth,
16347            )?;
16348
16349            _prev_end_offset = cur_offset + envelope_size;
16350            if 2 > max_ordinal {
16351                return Ok(());
16352            }
16353
16354            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16355            // are envelope_size bytes.
16356            let cur_offset: usize = (2 - 1) * envelope_size;
16357
16358            // Zero reserved fields.
16359            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16360
16361            // Safety:
16362            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16363            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16364            //   envelope_size bytes, there is always sufficient room.
16365            fidl::encoding::encode_in_envelope_optional::<
16366                fidl::encoding::UnboundedString,
16367                fidl::encoding::DefaultFuchsiaResourceDialect,
16368            >(
16369                self.debug_name.as_ref().map(
16370                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
16371                ),
16372                encoder,
16373                offset + cur_offset,
16374                depth,
16375            )?;
16376
16377            _prev_end_offset = cur_offset + envelope_size;
16378            if 4 > max_ordinal {
16379                return Ok(());
16380            }
16381
16382            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16383            // are envelope_size bytes.
16384            let cur_offset: usize = (4 - 1) * envelope_size;
16385
16386            // Zero reserved fields.
16387            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16388
16389            // Safety:
16390            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16391            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16392            //   envelope_size bytes, there is always sufficient room.
16393            fidl::encoding::encode_in_envelope_optional::<
16394                fidl_fuchsia_mem::Data,
16395                fidl::encoding::DefaultFuchsiaResourceDialect,
16396            >(
16397                self.explicit_sites_filter_error_page.as_mut().map(
16398                    <fidl_fuchsia_mem::Data as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
16399                ),
16400                encoder,
16401                offset + cur_offset,
16402                depth,
16403            )?;
16404
16405            _prev_end_offset = cur_offset + envelope_size;
16406
16407            Ok(())
16408        }
16409    }
16410
16411    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16412        for CreateFrameParams
16413    {
16414        #[inline(always)]
16415        fn new_empty() -> Self {
16416            Self::default()
16417        }
16418
16419        unsafe fn decode(
16420            &mut self,
16421            decoder: &mut fidl::encoding::Decoder<
16422                '_,
16423                fidl::encoding::DefaultFuchsiaResourceDialect,
16424            >,
16425            offset: usize,
16426            mut depth: fidl::encoding::Depth,
16427        ) -> fidl::Result<()> {
16428            decoder.debug_check_bounds::<Self>(offset);
16429            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16430                None => return Err(fidl::Error::NotNullable),
16431                Some(len) => len,
16432            };
16433            // Calling decoder.out_of_line_offset(0) is not allowed.
16434            if len == 0 {
16435                return Ok(());
16436            };
16437            depth.increment()?;
16438            let envelope_size = 8;
16439            let bytes_len = len * envelope_size;
16440            let offset = decoder.out_of_line_offset(bytes_len)?;
16441            // Decode the envelope for each type.
16442            let mut _next_ordinal_to_read = 0;
16443            let mut next_offset = offset;
16444            let end_offset = offset + bytes_len;
16445            _next_ordinal_to_read += 1;
16446            if next_offset >= end_offset {
16447                return Ok(());
16448            }
16449
16450            // Decode unknown envelopes for gaps in ordinals.
16451            while _next_ordinal_to_read < 1 {
16452                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16453                _next_ordinal_to_read += 1;
16454                next_offset += envelope_size;
16455            }
16456
16457            let next_out_of_line = decoder.next_out_of_line();
16458            let handles_before = decoder.remaining_handles();
16459            if let Some((inlined, num_bytes, num_handles)) =
16460                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16461            {
16462                let member_inline_size =
16463                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16464                if inlined != (member_inline_size <= 4) {
16465                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16466                }
16467                let inner_offset;
16468                let mut inner_depth = depth.clone();
16469                if inlined {
16470                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16471                    inner_offset = next_offset;
16472                } else {
16473                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16474                    inner_depth.increment()?;
16475                }
16476                let val_ref = self.enable_remote_debugging.get_or_insert_with(|| {
16477                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
16478                });
16479                fidl::decode!(
16480                    bool,
16481                    fidl::encoding::DefaultFuchsiaResourceDialect,
16482                    val_ref,
16483                    decoder,
16484                    inner_offset,
16485                    inner_depth
16486                )?;
16487                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16488                {
16489                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16490                }
16491                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16492                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16493                }
16494            }
16495
16496            next_offset += envelope_size;
16497            _next_ordinal_to_read += 1;
16498            if next_offset >= end_offset {
16499                return Ok(());
16500            }
16501
16502            // Decode unknown envelopes for gaps in ordinals.
16503            while _next_ordinal_to_read < 2 {
16504                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16505                _next_ordinal_to_read += 1;
16506                next_offset += envelope_size;
16507            }
16508
16509            let next_out_of_line = decoder.next_out_of_line();
16510            let handles_before = decoder.remaining_handles();
16511            if let Some((inlined, num_bytes, num_handles)) =
16512                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16513            {
16514                let member_inline_size =
16515                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
16516                        decoder.context,
16517                    );
16518                if inlined != (member_inline_size <= 4) {
16519                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16520                }
16521                let inner_offset;
16522                let mut inner_depth = depth.clone();
16523                if inlined {
16524                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16525                    inner_offset = next_offset;
16526                } else {
16527                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16528                    inner_depth.increment()?;
16529                }
16530                let val_ref = self.debug_name.get_or_insert_with(|| {
16531                    fidl::new_empty!(
16532                        fidl::encoding::UnboundedString,
16533                        fidl::encoding::DefaultFuchsiaResourceDialect
16534                    )
16535                });
16536                fidl::decode!(
16537                    fidl::encoding::UnboundedString,
16538                    fidl::encoding::DefaultFuchsiaResourceDialect,
16539                    val_ref,
16540                    decoder,
16541                    inner_offset,
16542                    inner_depth
16543                )?;
16544                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16545                {
16546                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16547                }
16548                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16549                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16550                }
16551            }
16552
16553            next_offset += envelope_size;
16554            _next_ordinal_to_read += 1;
16555            if next_offset >= end_offset {
16556                return Ok(());
16557            }
16558
16559            // Decode unknown envelopes for gaps in ordinals.
16560            while _next_ordinal_to_read < 4 {
16561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16562                _next_ordinal_to_read += 1;
16563                next_offset += envelope_size;
16564            }
16565
16566            let next_out_of_line = decoder.next_out_of_line();
16567            let handles_before = decoder.remaining_handles();
16568            if let Some((inlined, num_bytes, num_handles)) =
16569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16570            {
16571                let member_inline_size =
16572                    <fidl_fuchsia_mem::Data as fidl::encoding::TypeMarker>::inline_size(
16573                        decoder.context,
16574                    );
16575                if inlined != (member_inline_size <= 4) {
16576                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16577                }
16578                let inner_offset;
16579                let mut inner_depth = depth.clone();
16580                if inlined {
16581                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16582                    inner_offset = next_offset;
16583                } else {
16584                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16585                    inner_depth.increment()?;
16586                }
16587                let val_ref = self.explicit_sites_filter_error_page.get_or_insert_with(|| {
16588                    fidl::new_empty!(
16589                        fidl_fuchsia_mem::Data,
16590                        fidl::encoding::DefaultFuchsiaResourceDialect
16591                    )
16592                });
16593                fidl::decode!(
16594                    fidl_fuchsia_mem::Data,
16595                    fidl::encoding::DefaultFuchsiaResourceDialect,
16596                    val_ref,
16597                    decoder,
16598                    inner_offset,
16599                    inner_depth
16600                )?;
16601                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16602                {
16603                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16604                }
16605                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16606                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16607                }
16608            }
16609
16610            next_offset += envelope_size;
16611
16612            // Decode the remaining unknown envelopes.
16613            while next_offset < end_offset {
16614                _next_ordinal_to_read += 1;
16615                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16616                next_offset += envelope_size;
16617            }
16618
16619            Ok(())
16620        }
16621    }
16622
16623    impl CreateView2Args {
16624        #[inline(always)]
16625        fn max_ordinal_present(&self) -> u64 {
16626            if let Some(_) = self.view_creation_token {
16627                return 1;
16628            }
16629            0
16630        }
16631    }
16632
16633    impl fidl::encoding::ResourceTypeMarker for CreateView2Args {
16634        type Borrowed<'a> = &'a mut Self;
16635        fn take_or_borrow<'a>(
16636            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16637        ) -> Self::Borrowed<'a> {
16638            value
16639        }
16640    }
16641
16642    unsafe impl fidl::encoding::TypeMarker for CreateView2Args {
16643        type Owned = Self;
16644
16645        #[inline(always)]
16646        fn inline_align(_context: fidl::encoding::Context) -> usize {
16647            8
16648        }
16649
16650        #[inline(always)]
16651        fn inline_size(_context: fidl::encoding::Context) -> usize {
16652            16
16653        }
16654    }
16655
16656    unsafe impl
16657        fidl::encoding::Encode<CreateView2Args, fidl::encoding::DefaultFuchsiaResourceDialect>
16658        for &mut CreateView2Args
16659    {
16660        unsafe fn encode(
16661            self,
16662            encoder: &mut fidl::encoding::Encoder<
16663                '_,
16664                fidl::encoding::DefaultFuchsiaResourceDialect,
16665            >,
16666            offset: usize,
16667            mut depth: fidl::encoding::Depth,
16668        ) -> fidl::Result<()> {
16669            encoder.debug_check_bounds::<CreateView2Args>(offset);
16670            // Vector header
16671            let max_ordinal: u64 = self.max_ordinal_present();
16672            encoder.write_num(max_ordinal, offset);
16673            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16674            // Calling encoder.out_of_line_offset(0) is not allowed.
16675            if max_ordinal == 0 {
16676                return Ok(());
16677            }
16678            depth.increment()?;
16679            let envelope_size = 8;
16680            let bytes_len = max_ordinal as usize * envelope_size;
16681            #[allow(unused_variables)]
16682            let offset = encoder.out_of_line_offset(bytes_len);
16683            let mut _prev_end_offset: usize = 0;
16684            if 1 > max_ordinal {
16685                return Ok(());
16686            }
16687
16688            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16689            // are envelope_size bytes.
16690            let cur_offset: usize = (1 - 1) * envelope_size;
16691
16692            // Zero reserved fields.
16693            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16694
16695            // Safety:
16696            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16697            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16698            //   envelope_size bytes, there is always sufficient room.
16699            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_views::ViewCreationToken, fidl::encoding::DefaultFuchsiaResourceDialect>(
16700            self.view_creation_token.as_mut().map(<fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16701            encoder, offset + cur_offset, depth
16702        )?;
16703
16704            _prev_end_offset = cur_offset + envelope_size;
16705
16706            Ok(())
16707        }
16708    }
16709
16710    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
16711        for CreateView2Args
16712    {
16713        #[inline(always)]
16714        fn new_empty() -> Self {
16715            Self::default()
16716        }
16717
16718        unsafe fn decode(
16719            &mut self,
16720            decoder: &mut fidl::encoding::Decoder<
16721                '_,
16722                fidl::encoding::DefaultFuchsiaResourceDialect,
16723            >,
16724            offset: usize,
16725            mut depth: fidl::encoding::Depth,
16726        ) -> fidl::Result<()> {
16727            decoder.debug_check_bounds::<Self>(offset);
16728            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16729                None => return Err(fidl::Error::NotNullable),
16730                Some(len) => len,
16731            };
16732            // Calling decoder.out_of_line_offset(0) is not allowed.
16733            if len == 0 {
16734                return Ok(());
16735            };
16736            depth.increment()?;
16737            let envelope_size = 8;
16738            let bytes_len = len * envelope_size;
16739            let offset = decoder.out_of_line_offset(bytes_len)?;
16740            // Decode the envelope for each type.
16741            let mut _next_ordinal_to_read = 0;
16742            let mut next_offset = offset;
16743            let end_offset = offset + bytes_len;
16744            _next_ordinal_to_read += 1;
16745            if next_offset >= end_offset {
16746                return Ok(());
16747            }
16748
16749            // Decode unknown envelopes for gaps in ordinals.
16750            while _next_ordinal_to_read < 1 {
16751                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16752                _next_ordinal_to_read += 1;
16753                next_offset += envelope_size;
16754            }
16755
16756            let next_out_of_line = decoder.next_out_of_line();
16757            let handles_before = decoder.remaining_handles();
16758            if let Some((inlined, num_bytes, num_handles)) =
16759                fidl::encoding::decode_envelope_header(decoder, next_offset)?
16760            {
16761                let member_inline_size = <fidl_fuchsia_ui_views::ViewCreationToken as fidl::encoding::TypeMarker>::inline_size(decoder.context);
16762                if inlined != (member_inline_size <= 4) {
16763                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
16764                }
16765                let inner_offset;
16766                let mut inner_depth = depth.clone();
16767                if inlined {
16768                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
16769                    inner_offset = next_offset;
16770                } else {
16771                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
16772                    inner_depth.increment()?;
16773                }
16774                let val_ref = self.view_creation_token.get_or_insert_with(|| {
16775                    fidl::new_empty!(
16776                        fidl_fuchsia_ui_views::ViewCreationToken,
16777                        fidl::encoding::DefaultFuchsiaResourceDialect
16778                    )
16779                });
16780                fidl::decode!(
16781                    fidl_fuchsia_ui_views::ViewCreationToken,
16782                    fidl::encoding::DefaultFuchsiaResourceDialect,
16783                    val_ref,
16784                    decoder,
16785                    inner_offset,
16786                    inner_depth
16787                )?;
16788                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
16789                {
16790                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
16791                }
16792                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
16793                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
16794                }
16795            }
16796
16797            next_offset += envelope_size;
16798
16799            // Decode the remaining unknown envelopes.
16800            while next_offset < end_offset {
16801                _next_ordinal_to_read += 1;
16802                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16803                next_offset += envelope_size;
16804            }
16805
16806            Ok(())
16807        }
16808    }
16809
16810    impl Favicon {
16811        #[inline(always)]
16812        fn max_ordinal_present(&self) -> u64 {
16813            if let Some(_) = self.height {
16814                return 3;
16815            }
16816            if let Some(_) = self.width {
16817                return 2;
16818            }
16819            if let Some(_) = self.data {
16820                return 1;
16821            }
16822            0
16823        }
16824    }
16825
16826    impl fidl::encoding::ResourceTypeMarker for Favicon {
16827        type Borrowed<'a> = &'a mut Self;
16828        fn take_or_borrow<'a>(
16829            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
16830        ) -> Self::Borrowed<'a> {
16831            value
16832        }
16833    }
16834
16835    unsafe impl fidl::encoding::TypeMarker for Favicon {
16836        type Owned = Self;
16837
16838        #[inline(always)]
16839        fn inline_align(_context: fidl::encoding::Context) -> usize {
16840            8
16841        }
16842
16843        #[inline(always)]
16844        fn inline_size(_context: fidl::encoding::Context) -> usize {
16845            16
16846        }
16847    }
16848
16849    unsafe impl fidl::encoding::Encode<Favicon, fidl::encoding::DefaultFuchsiaResourceDialect>
16850        for &mut Favicon
16851    {
16852        unsafe fn encode(
16853            self,
16854            encoder: &mut fidl::encoding::Encoder<
16855                '_,
16856                fidl::encoding::DefaultFuchsiaResourceDialect,
16857            >,
16858            offset: usize,
16859            mut depth: fidl::encoding::Depth,
16860        ) -> fidl::Result<()> {
16861            encoder.debug_check_bounds::<Favicon>(offset);
16862            // Vector header
16863            let max_ordinal: u64 = self.max_ordinal_present();
16864            encoder.write_num(max_ordinal, offset);
16865            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
16866            // Calling encoder.out_of_line_offset(0) is not allowed.
16867            if max_ordinal == 0 {
16868                return Ok(());
16869            }
16870            depth.increment()?;
16871            let envelope_size = 8;
16872            let bytes_len = max_ordinal as usize * envelope_size;
16873            #[allow(unused_variables)]
16874            let offset = encoder.out_of_line_offset(bytes_len);
16875            let mut _prev_end_offset: usize = 0;
16876            if 1 > max_ordinal {
16877                return Ok(());
16878            }
16879
16880            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16881            // are envelope_size bytes.
16882            let cur_offset: usize = (1 - 1) * envelope_size;
16883
16884            // Zero reserved fields.
16885            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16886
16887            // Safety:
16888            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16889            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16890            //   envelope_size bytes, there is always sufficient room.
16891            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
16892            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
16893            encoder, offset + cur_offset, depth
16894        )?;
16895
16896            _prev_end_offset = cur_offset + envelope_size;
16897            if 2 > max_ordinal {
16898                return Ok(());
16899            }
16900
16901            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16902            // are envelope_size bytes.
16903            let cur_offset: usize = (2 - 1) * envelope_size;
16904
16905            // Zero reserved fields.
16906            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16907
16908            // Safety:
16909            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16910            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16911            //   envelope_size bytes, there is always sufficient room.
16912            fidl::encoding::encode_in_envelope_optional::<
16913                u32,
16914                fidl::encoding::DefaultFuchsiaResourceDialect,
16915            >(
16916                self.width.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16917                encoder,
16918                offset + cur_offset,
16919                depth,
16920            )?;
16921
16922            _prev_end_offset = cur_offset + envelope_size;
16923            if 3 > max_ordinal {
16924                return Ok(());
16925            }
16926
16927            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
16928            // are envelope_size bytes.
16929            let cur_offset: usize = (3 - 1) * envelope_size;
16930
16931            // Zero reserved fields.
16932            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
16933
16934            // Safety:
16935            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
16936            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
16937            //   envelope_size bytes, there is always sufficient room.
16938            fidl::encoding::encode_in_envelope_optional::<
16939                u32,
16940                fidl::encoding::DefaultFuchsiaResourceDialect,
16941            >(
16942                self.height.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
16943                encoder,
16944                offset + cur_offset,
16945                depth,
16946            )?;
16947
16948            _prev_end_offset = cur_offset + envelope_size;
16949
16950            Ok(())
16951        }
16952    }
16953
16954    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Favicon {
16955        #[inline(always)]
16956        fn new_empty() -> Self {
16957            Self::default()
16958        }
16959
16960        unsafe fn decode(
16961            &mut self,
16962            decoder: &mut fidl::encoding::Decoder<
16963                '_,
16964                fidl::encoding::DefaultFuchsiaResourceDialect,
16965            >,
16966            offset: usize,
16967            mut depth: fidl::encoding::Depth,
16968        ) -> fidl::Result<()> {
16969            decoder.debug_check_bounds::<Self>(offset);
16970            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
16971                None => return Err(fidl::Error::NotNullable),
16972                Some(len) => len,
16973            };
16974            // Calling decoder.out_of_line_offset(0) is not allowed.
16975            if len == 0 {
16976                return Ok(());
16977            };
16978            depth.increment()?;
16979            let envelope_size = 8;
16980            let bytes_len = len * envelope_size;
16981            let offset = decoder.out_of_line_offset(bytes_len)?;
16982            // Decode the envelope for each type.
16983            let mut _next_ordinal_to_read = 0;
16984            let mut next_offset = offset;
16985            let end_offset = offset + bytes_len;
16986            _next_ordinal_to_read += 1;
16987            if next_offset >= end_offset {
16988                return Ok(());
16989            }
16990
16991            // Decode unknown envelopes for gaps in ordinals.
16992            while _next_ordinal_to_read < 1 {
16993                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
16994                _next_ordinal_to_read += 1;
16995                next_offset += envelope_size;
16996            }
16997
16998            let next_out_of_line = decoder.next_out_of_line();
16999            let handles_before = decoder.remaining_handles();
17000            if let Some((inlined, num_bytes, num_handles)) =
17001                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17002            {
17003                let member_inline_size =
17004                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
17005                        decoder.context,
17006                    );
17007                if inlined != (member_inline_size <= 4) {
17008                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17009                }
17010                let inner_offset;
17011                let mut inner_depth = depth.clone();
17012                if inlined {
17013                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17014                    inner_offset = next_offset;
17015                } else {
17016                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17017                    inner_depth.increment()?;
17018                }
17019                let val_ref = self.data.get_or_insert_with(|| {
17020                    fidl::new_empty!(
17021                        fidl_fuchsia_mem::Buffer,
17022                        fidl::encoding::DefaultFuchsiaResourceDialect
17023                    )
17024                });
17025                fidl::decode!(
17026                    fidl_fuchsia_mem::Buffer,
17027                    fidl::encoding::DefaultFuchsiaResourceDialect,
17028                    val_ref,
17029                    decoder,
17030                    inner_offset,
17031                    inner_depth
17032                )?;
17033                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17034                {
17035                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17036                }
17037                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17038                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17039                }
17040            }
17041
17042            next_offset += envelope_size;
17043            _next_ordinal_to_read += 1;
17044            if next_offset >= end_offset {
17045                return Ok(());
17046            }
17047
17048            // Decode unknown envelopes for gaps in ordinals.
17049            while _next_ordinal_to_read < 2 {
17050                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17051                _next_ordinal_to_read += 1;
17052                next_offset += envelope_size;
17053            }
17054
17055            let next_out_of_line = decoder.next_out_of_line();
17056            let handles_before = decoder.remaining_handles();
17057            if let Some((inlined, num_bytes, num_handles)) =
17058                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17059            {
17060                let member_inline_size =
17061                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17062                if inlined != (member_inline_size <= 4) {
17063                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17064                }
17065                let inner_offset;
17066                let mut inner_depth = depth.clone();
17067                if inlined {
17068                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17069                    inner_offset = next_offset;
17070                } else {
17071                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17072                    inner_depth.increment()?;
17073                }
17074                let val_ref = self.width.get_or_insert_with(|| {
17075                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17076                });
17077                fidl::decode!(
17078                    u32,
17079                    fidl::encoding::DefaultFuchsiaResourceDialect,
17080                    val_ref,
17081                    decoder,
17082                    inner_offset,
17083                    inner_depth
17084                )?;
17085                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17086                {
17087                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17088                }
17089                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17090                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17091                }
17092            }
17093
17094            next_offset += envelope_size;
17095            _next_ordinal_to_read += 1;
17096            if next_offset >= end_offset {
17097                return Ok(());
17098            }
17099
17100            // Decode unknown envelopes for gaps in ordinals.
17101            while _next_ordinal_to_read < 3 {
17102                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17103                _next_ordinal_to_read += 1;
17104                next_offset += envelope_size;
17105            }
17106
17107            let next_out_of_line = decoder.next_out_of_line();
17108            let handles_before = decoder.remaining_handles();
17109            if let Some((inlined, num_bytes, num_handles)) =
17110                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17111            {
17112                let member_inline_size =
17113                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17114                if inlined != (member_inline_size <= 4) {
17115                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17116                }
17117                let inner_offset;
17118                let mut inner_depth = depth.clone();
17119                if inlined {
17120                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17121                    inner_offset = next_offset;
17122                } else {
17123                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17124                    inner_depth.increment()?;
17125                }
17126                let val_ref = self.height.get_or_insert_with(|| {
17127                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
17128                });
17129                fidl::decode!(
17130                    u32,
17131                    fidl::encoding::DefaultFuchsiaResourceDialect,
17132                    val_ref,
17133                    decoder,
17134                    inner_offset,
17135                    inner_depth
17136                )?;
17137                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17138                {
17139                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17140                }
17141                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17142                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17143                }
17144            }
17145
17146            next_offset += envelope_size;
17147
17148            // Decode the remaining unknown envelopes.
17149            while next_offset < end_offset {
17150                _next_ordinal_to_read += 1;
17151                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17152                next_offset += envelope_size;
17153            }
17154
17155            Ok(())
17156        }
17157    }
17158
17159    impl LoadUrlParams {
17160        #[inline(always)]
17161        fn max_ordinal_present(&self) -> u64 {
17162            if let Some(_) = self.headers {
17163                return 4;
17164            }
17165            if let Some(_) = self.was_user_activated {
17166                return 3;
17167            }
17168            if let Some(_) = self.referrer_url {
17169                return 2;
17170            }
17171            if let Some(_) = self.type_ {
17172                return 1;
17173            }
17174            0
17175        }
17176    }
17177
17178    impl fidl::encoding::ResourceTypeMarker for LoadUrlParams {
17179        type Borrowed<'a> = &'a mut Self;
17180        fn take_or_borrow<'a>(
17181            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17182        ) -> Self::Borrowed<'a> {
17183            value
17184        }
17185    }
17186
17187    unsafe impl fidl::encoding::TypeMarker for LoadUrlParams {
17188        type Owned = Self;
17189
17190        #[inline(always)]
17191        fn inline_align(_context: fidl::encoding::Context) -> usize {
17192            8
17193        }
17194
17195        #[inline(always)]
17196        fn inline_size(_context: fidl::encoding::Context) -> usize {
17197            16
17198        }
17199    }
17200
17201    unsafe impl fidl::encoding::Encode<LoadUrlParams, fidl::encoding::DefaultFuchsiaResourceDialect>
17202        for &mut LoadUrlParams
17203    {
17204        unsafe fn encode(
17205            self,
17206            encoder: &mut fidl::encoding::Encoder<
17207                '_,
17208                fidl::encoding::DefaultFuchsiaResourceDialect,
17209            >,
17210            offset: usize,
17211            mut depth: fidl::encoding::Depth,
17212        ) -> fidl::Result<()> {
17213            encoder.debug_check_bounds::<LoadUrlParams>(offset);
17214            // Vector header
17215            let max_ordinal: u64 = self.max_ordinal_present();
17216            encoder.write_num(max_ordinal, offset);
17217            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17218            // Calling encoder.out_of_line_offset(0) is not allowed.
17219            if max_ordinal == 0 {
17220                return Ok(());
17221            }
17222            depth.increment()?;
17223            let envelope_size = 8;
17224            let bytes_len = max_ordinal as usize * envelope_size;
17225            #[allow(unused_variables)]
17226            let offset = encoder.out_of_line_offset(bytes_len);
17227            let mut _prev_end_offset: usize = 0;
17228            if 1 > max_ordinal {
17229                return Ok(());
17230            }
17231
17232            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17233            // are envelope_size bytes.
17234            let cur_offset: usize = (1 - 1) * envelope_size;
17235
17236            // Zero reserved fields.
17237            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17238
17239            // Safety:
17240            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17241            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17242            //   envelope_size bytes, there is always sufficient room.
17243            fidl::encoding::encode_in_envelope_optional::<
17244                LoadUrlReason,
17245                fidl::encoding::DefaultFuchsiaResourceDialect,
17246            >(
17247                self.type_.as_ref().map(<LoadUrlReason as fidl::encoding::ValueTypeMarker>::borrow),
17248                encoder,
17249                offset + cur_offset,
17250                depth,
17251            )?;
17252
17253            _prev_end_offset = cur_offset + envelope_size;
17254            if 2 > max_ordinal {
17255                return Ok(());
17256            }
17257
17258            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17259            // are envelope_size bytes.
17260            let cur_offset: usize = (2 - 1) * envelope_size;
17261
17262            // Zero reserved fields.
17263            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17264
17265            // Safety:
17266            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17267            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17268            //   envelope_size bytes, there is always sufficient room.
17269            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17270            self.referrer_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17271            encoder, offset + cur_offset, depth
17272        )?;
17273
17274            _prev_end_offset = cur_offset + envelope_size;
17275            if 3 > max_ordinal {
17276                return Ok(());
17277            }
17278
17279            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17280            // are envelope_size bytes.
17281            let cur_offset: usize = (3 - 1) * envelope_size;
17282
17283            // Zero reserved fields.
17284            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17285
17286            // Safety:
17287            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17288            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17289            //   envelope_size bytes, there is always sufficient room.
17290            fidl::encoding::encode_in_envelope_optional::<
17291                bool,
17292                fidl::encoding::DefaultFuchsiaResourceDialect,
17293            >(
17294                self.was_user_activated
17295                    .as_ref()
17296                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17297                encoder,
17298                offset + cur_offset,
17299                depth,
17300            )?;
17301
17302            _prev_end_offset = cur_offset + envelope_size;
17303            if 4 > max_ordinal {
17304                return Ok(());
17305            }
17306
17307            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17308            // are envelope_size bytes.
17309            let cur_offset: usize = (4 - 1) * envelope_size;
17310
17311            // Zero reserved fields.
17312            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17313
17314            // Safety:
17315            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17316            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17317            //   envelope_size bytes, there is always sufficient room.
17318            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17319            self.headers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header> as fidl::encoding::ValueTypeMarker>::borrow),
17320            encoder, offset + cur_offset, depth
17321        )?;
17322
17323            _prev_end_offset = cur_offset + envelope_size;
17324
17325            Ok(())
17326        }
17327    }
17328
17329    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for LoadUrlParams {
17330        #[inline(always)]
17331        fn new_empty() -> Self {
17332            Self::default()
17333        }
17334
17335        unsafe fn decode(
17336            &mut self,
17337            decoder: &mut fidl::encoding::Decoder<
17338                '_,
17339                fidl::encoding::DefaultFuchsiaResourceDialect,
17340            >,
17341            offset: usize,
17342            mut depth: fidl::encoding::Depth,
17343        ) -> fidl::Result<()> {
17344            decoder.debug_check_bounds::<Self>(offset);
17345            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17346                None => return Err(fidl::Error::NotNullable),
17347                Some(len) => len,
17348            };
17349            // Calling decoder.out_of_line_offset(0) is not allowed.
17350            if len == 0 {
17351                return Ok(());
17352            };
17353            depth.increment()?;
17354            let envelope_size = 8;
17355            let bytes_len = len * envelope_size;
17356            let offset = decoder.out_of_line_offset(bytes_len)?;
17357            // Decode the envelope for each type.
17358            let mut _next_ordinal_to_read = 0;
17359            let mut next_offset = offset;
17360            let end_offset = offset + bytes_len;
17361            _next_ordinal_to_read += 1;
17362            if next_offset >= end_offset {
17363                return Ok(());
17364            }
17365
17366            // Decode unknown envelopes for gaps in ordinals.
17367            while _next_ordinal_to_read < 1 {
17368                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17369                _next_ordinal_to_read += 1;
17370                next_offset += envelope_size;
17371            }
17372
17373            let next_out_of_line = decoder.next_out_of_line();
17374            let handles_before = decoder.remaining_handles();
17375            if let Some((inlined, num_bytes, num_handles)) =
17376                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17377            {
17378                let member_inline_size =
17379                    <LoadUrlReason as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17380                if inlined != (member_inline_size <= 4) {
17381                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17382                }
17383                let inner_offset;
17384                let mut inner_depth = depth.clone();
17385                if inlined {
17386                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17387                    inner_offset = next_offset;
17388                } else {
17389                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17390                    inner_depth.increment()?;
17391                }
17392                let val_ref = self.type_.get_or_insert_with(|| {
17393                    fidl::new_empty!(LoadUrlReason, fidl::encoding::DefaultFuchsiaResourceDialect)
17394                });
17395                fidl::decode!(
17396                    LoadUrlReason,
17397                    fidl::encoding::DefaultFuchsiaResourceDialect,
17398                    val_ref,
17399                    decoder,
17400                    inner_offset,
17401                    inner_depth
17402                )?;
17403                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17404                {
17405                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17406                }
17407                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17408                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17409                }
17410            }
17411
17412            next_offset += envelope_size;
17413            _next_ordinal_to_read += 1;
17414            if next_offset >= end_offset {
17415                return Ok(());
17416            }
17417
17418            // Decode unknown envelopes for gaps in ordinals.
17419            while _next_ordinal_to_read < 2 {
17420                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17421                _next_ordinal_to_read += 1;
17422                next_offset += envelope_size;
17423            }
17424
17425            let next_out_of_line = decoder.next_out_of_line();
17426            let handles_before = decoder.remaining_handles();
17427            if let Some((inlined, num_bytes, num_handles)) =
17428                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17429            {
17430                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17431                if inlined != (member_inline_size <= 4) {
17432                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17433                }
17434                let inner_offset;
17435                let mut inner_depth = depth.clone();
17436                if inlined {
17437                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17438                    inner_offset = next_offset;
17439                } else {
17440                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17441                    inner_depth.increment()?;
17442                }
17443                let val_ref = self.referrer_url.get_or_insert_with(|| {
17444                    fidl::new_empty!(
17445                        fidl::encoding::BoundedString<65536>,
17446                        fidl::encoding::DefaultFuchsiaResourceDialect
17447                    )
17448                });
17449                fidl::decode!(
17450                    fidl::encoding::BoundedString<65536>,
17451                    fidl::encoding::DefaultFuchsiaResourceDialect,
17452                    val_ref,
17453                    decoder,
17454                    inner_offset,
17455                    inner_depth
17456                )?;
17457                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17458                {
17459                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17460                }
17461                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17462                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17463                }
17464            }
17465
17466            next_offset += envelope_size;
17467            _next_ordinal_to_read += 1;
17468            if next_offset >= end_offset {
17469                return Ok(());
17470            }
17471
17472            // Decode unknown envelopes for gaps in ordinals.
17473            while _next_ordinal_to_read < 3 {
17474                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17475                _next_ordinal_to_read += 1;
17476                next_offset += envelope_size;
17477            }
17478
17479            let next_out_of_line = decoder.next_out_of_line();
17480            let handles_before = decoder.remaining_handles();
17481            if let Some((inlined, num_bytes, num_handles)) =
17482                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17483            {
17484                let member_inline_size =
17485                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17486                if inlined != (member_inline_size <= 4) {
17487                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17488                }
17489                let inner_offset;
17490                let mut inner_depth = depth.clone();
17491                if inlined {
17492                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17493                    inner_offset = next_offset;
17494                } else {
17495                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17496                    inner_depth.increment()?;
17497                }
17498                let val_ref = self.was_user_activated.get_or_insert_with(|| {
17499                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
17500                });
17501                fidl::decode!(
17502                    bool,
17503                    fidl::encoding::DefaultFuchsiaResourceDialect,
17504                    val_ref,
17505                    decoder,
17506                    inner_offset,
17507                    inner_depth
17508                )?;
17509                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17510                {
17511                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17512                }
17513                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17514                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17515                }
17516            }
17517
17518            next_offset += envelope_size;
17519            _next_ordinal_to_read += 1;
17520            if next_offset >= end_offset {
17521                return Ok(());
17522            }
17523
17524            // Decode unknown envelopes for gaps in ordinals.
17525            while _next_ordinal_to_read < 4 {
17526                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17527                _next_ordinal_to_read += 1;
17528                next_offset += envelope_size;
17529            }
17530
17531            let next_out_of_line = decoder.next_out_of_line();
17532            let handles_before = decoder.remaining_handles();
17533            if let Some((inlined, num_bytes, num_handles)) =
17534                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17535            {
17536                let member_inline_size = <fidl::encoding::UnboundedVector<
17537                    fidl_fuchsia_net_http::Header,
17538                > as fidl::encoding::TypeMarker>::inline_size(
17539                    decoder.context
17540                );
17541                if inlined != (member_inline_size <= 4) {
17542                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17543                }
17544                let inner_offset;
17545                let mut inner_depth = depth.clone();
17546                if inlined {
17547                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17548                    inner_offset = next_offset;
17549                } else {
17550                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17551                    inner_depth.increment()?;
17552                }
17553                let val_ref = self.headers.get_or_insert_with(|| {
17554                    fidl::new_empty!(
17555                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17556                        fidl::encoding::DefaultFuchsiaResourceDialect
17557                    )
17558                });
17559                fidl::decode!(
17560                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_http::Header>,
17561                    fidl::encoding::DefaultFuchsiaResourceDialect,
17562                    val_ref,
17563                    decoder,
17564                    inner_offset,
17565                    inner_depth
17566                )?;
17567                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17568                {
17569                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17570                }
17571                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17572                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17573                }
17574            }
17575
17576            next_offset += envelope_size;
17577
17578            // Decode the remaining unknown envelopes.
17579            while next_offset < end_offset {
17580                _next_ordinal_to_read += 1;
17581                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17582                next_offset += envelope_size;
17583            }
17584
17585            Ok(())
17586        }
17587    }
17588
17589    impl NavigationState {
17590        #[inline(always)]
17591        fn max_ordinal_present(&self) -> u64 {
17592            if let Some(_) = self.error_detail {
17593                return 8;
17594            }
17595            if let Some(_) = self.favicon {
17596                return 7;
17597            }
17598            if let Some(_) = self.is_main_document_loaded {
17599                return 6;
17600            }
17601            if let Some(_) = self.can_go_back {
17602                return 5;
17603            }
17604            if let Some(_) = self.can_go_forward {
17605                return 4;
17606            }
17607            if let Some(_) = self.page_type {
17608                return 3;
17609            }
17610            if let Some(_) = self.title {
17611                return 2;
17612            }
17613            if let Some(_) = self.url {
17614                return 1;
17615            }
17616            0
17617        }
17618    }
17619
17620    impl fidl::encoding::ResourceTypeMarker for NavigationState {
17621        type Borrowed<'a> = &'a mut Self;
17622        fn take_or_borrow<'a>(
17623            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
17624        ) -> Self::Borrowed<'a> {
17625            value
17626        }
17627    }
17628
17629    unsafe impl fidl::encoding::TypeMarker for NavigationState {
17630        type Owned = Self;
17631
17632        #[inline(always)]
17633        fn inline_align(_context: fidl::encoding::Context) -> usize {
17634            8
17635        }
17636
17637        #[inline(always)]
17638        fn inline_size(_context: fidl::encoding::Context) -> usize {
17639            16
17640        }
17641    }
17642
17643    unsafe impl
17644        fidl::encoding::Encode<NavigationState, fidl::encoding::DefaultFuchsiaResourceDialect>
17645        for &mut NavigationState
17646    {
17647        unsafe fn encode(
17648            self,
17649            encoder: &mut fidl::encoding::Encoder<
17650                '_,
17651                fidl::encoding::DefaultFuchsiaResourceDialect,
17652            >,
17653            offset: usize,
17654            mut depth: fidl::encoding::Depth,
17655        ) -> fidl::Result<()> {
17656            encoder.debug_check_bounds::<NavigationState>(offset);
17657            // Vector header
17658            let max_ordinal: u64 = self.max_ordinal_present();
17659            encoder.write_num(max_ordinal, offset);
17660            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
17661            // Calling encoder.out_of_line_offset(0) is not allowed.
17662            if max_ordinal == 0 {
17663                return Ok(());
17664            }
17665            depth.increment()?;
17666            let envelope_size = 8;
17667            let bytes_len = max_ordinal as usize * envelope_size;
17668            #[allow(unused_variables)]
17669            let offset = encoder.out_of_line_offset(bytes_len);
17670            let mut _prev_end_offset: usize = 0;
17671            if 1 > max_ordinal {
17672                return Ok(());
17673            }
17674
17675            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17676            // are envelope_size bytes.
17677            let cur_offset: usize = (1 - 1) * envelope_size;
17678
17679            // Zero reserved fields.
17680            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17681
17682            // Safety:
17683            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17684            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17685            //   envelope_size bytes, there is always sufficient room.
17686            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
17687            self.url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
17688            encoder, offset + cur_offset, depth
17689        )?;
17690
17691            _prev_end_offset = cur_offset + envelope_size;
17692            if 2 > max_ordinal {
17693                return Ok(());
17694            }
17695
17696            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17697            // are envelope_size bytes.
17698            let cur_offset: usize = (2 - 1) * envelope_size;
17699
17700            // Zero reserved fields.
17701            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17702
17703            // Safety:
17704            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17705            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17706            //   envelope_size bytes, there is always sufficient room.
17707            fidl::encoding::encode_in_envelope_optional::<
17708                fidl::encoding::UnboundedString,
17709                fidl::encoding::DefaultFuchsiaResourceDialect,
17710            >(
17711                self.title.as_ref().map(
17712                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
17713                ),
17714                encoder,
17715                offset + cur_offset,
17716                depth,
17717            )?;
17718
17719            _prev_end_offset = cur_offset + envelope_size;
17720            if 3 > max_ordinal {
17721                return Ok(());
17722            }
17723
17724            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17725            // are envelope_size bytes.
17726            let cur_offset: usize = (3 - 1) * envelope_size;
17727
17728            // Zero reserved fields.
17729            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17730
17731            // Safety:
17732            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17733            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17734            //   envelope_size bytes, there is always sufficient room.
17735            fidl::encoding::encode_in_envelope_optional::<
17736                PageType,
17737                fidl::encoding::DefaultFuchsiaResourceDialect,
17738            >(
17739                self.page_type.as_ref().map(<PageType as fidl::encoding::ValueTypeMarker>::borrow),
17740                encoder,
17741                offset + cur_offset,
17742                depth,
17743            )?;
17744
17745            _prev_end_offset = cur_offset + envelope_size;
17746            if 4 > max_ordinal {
17747                return Ok(());
17748            }
17749
17750            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17751            // are envelope_size bytes.
17752            let cur_offset: usize = (4 - 1) * envelope_size;
17753
17754            // Zero reserved fields.
17755            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17756
17757            // Safety:
17758            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17759            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17760            //   envelope_size bytes, there is always sufficient room.
17761            fidl::encoding::encode_in_envelope_optional::<
17762                bool,
17763                fidl::encoding::DefaultFuchsiaResourceDialect,
17764            >(
17765                self.can_go_forward.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17766                encoder,
17767                offset + cur_offset,
17768                depth,
17769            )?;
17770
17771            _prev_end_offset = cur_offset + envelope_size;
17772            if 5 > max_ordinal {
17773                return Ok(());
17774            }
17775
17776            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17777            // are envelope_size bytes.
17778            let cur_offset: usize = (5 - 1) * envelope_size;
17779
17780            // Zero reserved fields.
17781            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17782
17783            // Safety:
17784            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17785            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17786            //   envelope_size bytes, there is always sufficient room.
17787            fidl::encoding::encode_in_envelope_optional::<
17788                bool,
17789                fidl::encoding::DefaultFuchsiaResourceDialect,
17790            >(
17791                self.can_go_back.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17792                encoder,
17793                offset + cur_offset,
17794                depth,
17795            )?;
17796
17797            _prev_end_offset = cur_offset + envelope_size;
17798            if 6 > max_ordinal {
17799                return Ok(());
17800            }
17801
17802            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17803            // are envelope_size bytes.
17804            let cur_offset: usize = (6 - 1) * envelope_size;
17805
17806            // Zero reserved fields.
17807            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17808
17809            // Safety:
17810            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17811            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17812            //   envelope_size bytes, there is always sufficient room.
17813            fidl::encoding::encode_in_envelope_optional::<
17814                bool,
17815                fidl::encoding::DefaultFuchsiaResourceDialect,
17816            >(
17817                self.is_main_document_loaded
17818                    .as_ref()
17819                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
17820                encoder,
17821                offset + cur_offset,
17822                depth,
17823            )?;
17824
17825            _prev_end_offset = cur_offset + envelope_size;
17826            if 7 > max_ordinal {
17827                return Ok(());
17828            }
17829
17830            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17831            // are envelope_size bytes.
17832            let cur_offset: usize = (7 - 1) * envelope_size;
17833
17834            // Zero reserved fields.
17835            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17836
17837            // Safety:
17838            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17839            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17840            //   envelope_size bytes, there is always sufficient room.
17841            fidl::encoding::encode_in_envelope_optional::<
17842                Favicon,
17843                fidl::encoding::DefaultFuchsiaResourceDialect,
17844            >(
17845                self.favicon
17846                    .as_mut()
17847                    .map(<Favicon as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
17848                encoder,
17849                offset + cur_offset,
17850                depth,
17851            )?;
17852
17853            _prev_end_offset = cur_offset + envelope_size;
17854            if 8 > max_ordinal {
17855                return Ok(());
17856            }
17857
17858            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
17859            // are envelope_size bytes.
17860            let cur_offset: usize = (8 - 1) * envelope_size;
17861
17862            // Zero reserved fields.
17863            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
17864
17865            // Safety:
17866            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
17867            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
17868            //   envelope_size bytes, there is always sufficient room.
17869            fidl::encoding::encode_in_envelope_optional::<
17870                ErrorDetail,
17871                fidl::encoding::DefaultFuchsiaResourceDialect,
17872            >(
17873                self.error_detail
17874                    .as_ref()
17875                    .map(<ErrorDetail as fidl::encoding::ValueTypeMarker>::borrow),
17876                encoder,
17877                offset + cur_offset,
17878                depth,
17879            )?;
17880
17881            _prev_end_offset = cur_offset + envelope_size;
17882
17883            Ok(())
17884        }
17885    }
17886
17887    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
17888        for NavigationState
17889    {
17890        #[inline(always)]
17891        fn new_empty() -> Self {
17892            Self::default()
17893        }
17894
17895        unsafe fn decode(
17896            &mut self,
17897            decoder: &mut fidl::encoding::Decoder<
17898                '_,
17899                fidl::encoding::DefaultFuchsiaResourceDialect,
17900            >,
17901            offset: usize,
17902            mut depth: fidl::encoding::Depth,
17903        ) -> fidl::Result<()> {
17904            decoder.debug_check_bounds::<Self>(offset);
17905            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
17906                None => return Err(fidl::Error::NotNullable),
17907                Some(len) => len,
17908            };
17909            // Calling decoder.out_of_line_offset(0) is not allowed.
17910            if len == 0 {
17911                return Ok(());
17912            };
17913            depth.increment()?;
17914            let envelope_size = 8;
17915            let bytes_len = len * envelope_size;
17916            let offset = decoder.out_of_line_offset(bytes_len)?;
17917            // Decode the envelope for each type.
17918            let mut _next_ordinal_to_read = 0;
17919            let mut next_offset = offset;
17920            let end_offset = offset + bytes_len;
17921            _next_ordinal_to_read += 1;
17922            if next_offset >= end_offset {
17923                return Ok(());
17924            }
17925
17926            // Decode unknown envelopes for gaps in ordinals.
17927            while _next_ordinal_to_read < 1 {
17928                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17929                _next_ordinal_to_read += 1;
17930                next_offset += envelope_size;
17931            }
17932
17933            let next_out_of_line = decoder.next_out_of_line();
17934            let handles_before = decoder.remaining_handles();
17935            if let Some((inlined, num_bytes, num_handles)) =
17936                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17937            {
17938                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
17939                if inlined != (member_inline_size <= 4) {
17940                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17941                }
17942                let inner_offset;
17943                let mut inner_depth = depth.clone();
17944                if inlined {
17945                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
17946                    inner_offset = next_offset;
17947                } else {
17948                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
17949                    inner_depth.increment()?;
17950                }
17951                let val_ref = self.url.get_or_insert_with(|| {
17952                    fidl::new_empty!(
17953                        fidl::encoding::BoundedString<65536>,
17954                        fidl::encoding::DefaultFuchsiaResourceDialect
17955                    )
17956                });
17957                fidl::decode!(
17958                    fidl::encoding::BoundedString<65536>,
17959                    fidl::encoding::DefaultFuchsiaResourceDialect,
17960                    val_ref,
17961                    decoder,
17962                    inner_offset,
17963                    inner_depth
17964                )?;
17965                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
17966                {
17967                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
17968                }
17969                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
17970                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
17971                }
17972            }
17973
17974            next_offset += envelope_size;
17975            _next_ordinal_to_read += 1;
17976            if next_offset >= end_offset {
17977                return Ok(());
17978            }
17979
17980            // Decode unknown envelopes for gaps in ordinals.
17981            while _next_ordinal_to_read < 2 {
17982                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
17983                _next_ordinal_to_read += 1;
17984                next_offset += envelope_size;
17985            }
17986
17987            let next_out_of_line = decoder.next_out_of_line();
17988            let handles_before = decoder.remaining_handles();
17989            if let Some((inlined, num_bytes, num_handles)) =
17990                fidl::encoding::decode_envelope_header(decoder, next_offset)?
17991            {
17992                let member_inline_size =
17993                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
17994                        decoder.context,
17995                    );
17996                if inlined != (member_inline_size <= 4) {
17997                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
17998                }
17999                let inner_offset;
18000                let mut inner_depth = depth.clone();
18001                if inlined {
18002                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18003                    inner_offset = next_offset;
18004                } else {
18005                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18006                    inner_depth.increment()?;
18007                }
18008                let val_ref = self.title.get_or_insert_with(|| {
18009                    fidl::new_empty!(
18010                        fidl::encoding::UnboundedString,
18011                        fidl::encoding::DefaultFuchsiaResourceDialect
18012                    )
18013                });
18014                fidl::decode!(
18015                    fidl::encoding::UnboundedString,
18016                    fidl::encoding::DefaultFuchsiaResourceDialect,
18017                    val_ref,
18018                    decoder,
18019                    inner_offset,
18020                    inner_depth
18021                )?;
18022                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18023                {
18024                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18025                }
18026                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18027                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18028                }
18029            }
18030
18031            next_offset += envelope_size;
18032            _next_ordinal_to_read += 1;
18033            if next_offset >= end_offset {
18034                return Ok(());
18035            }
18036
18037            // Decode unknown envelopes for gaps in ordinals.
18038            while _next_ordinal_to_read < 3 {
18039                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18040                _next_ordinal_to_read += 1;
18041                next_offset += envelope_size;
18042            }
18043
18044            let next_out_of_line = decoder.next_out_of_line();
18045            let handles_before = decoder.remaining_handles();
18046            if let Some((inlined, num_bytes, num_handles)) =
18047                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18048            {
18049                let member_inline_size =
18050                    <PageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18051                if inlined != (member_inline_size <= 4) {
18052                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18053                }
18054                let inner_offset;
18055                let mut inner_depth = depth.clone();
18056                if inlined {
18057                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18058                    inner_offset = next_offset;
18059                } else {
18060                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18061                    inner_depth.increment()?;
18062                }
18063                let val_ref = self.page_type.get_or_insert_with(|| {
18064                    fidl::new_empty!(PageType, fidl::encoding::DefaultFuchsiaResourceDialect)
18065                });
18066                fidl::decode!(
18067                    PageType,
18068                    fidl::encoding::DefaultFuchsiaResourceDialect,
18069                    val_ref,
18070                    decoder,
18071                    inner_offset,
18072                    inner_depth
18073                )?;
18074                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18075                {
18076                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18077                }
18078                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18079                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18080                }
18081            }
18082
18083            next_offset += envelope_size;
18084            _next_ordinal_to_read += 1;
18085            if next_offset >= end_offset {
18086                return Ok(());
18087            }
18088
18089            // Decode unknown envelopes for gaps in ordinals.
18090            while _next_ordinal_to_read < 4 {
18091                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18092                _next_ordinal_to_read += 1;
18093                next_offset += envelope_size;
18094            }
18095
18096            let next_out_of_line = decoder.next_out_of_line();
18097            let handles_before = decoder.remaining_handles();
18098            if let Some((inlined, num_bytes, num_handles)) =
18099                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18100            {
18101                let member_inline_size =
18102                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18103                if inlined != (member_inline_size <= 4) {
18104                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18105                }
18106                let inner_offset;
18107                let mut inner_depth = depth.clone();
18108                if inlined {
18109                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18110                    inner_offset = next_offset;
18111                } else {
18112                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18113                    inner_depth.increment()?;
18114                }
18115                let val_ref = self.can_go_forward.get_or_insert_with(|| {
18116                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18117                });
18118                fidl::decode!(
18119                    bool,
18120                    fidl::encoding::DefaultFuchsiaResourceDialect,
18121                    val_ref,
18122                    decoder,
18123                    inner_offset,
18124                    inner_depth
18125                )?;
18126                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18127                {
18128                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18129                }
18130                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18131                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18132                }
18133            }
18134
18135            next_offset += envelope_size;
18136            _next_ordinal_to_read += 1;
18137            if next_offset >= end_offset {
18138                return Ok(());
18139            }
18140
18141            // Decode unknown envelopes for gaps in ordinals.
18142            while _next_ordinal_to_read < 5 {
18143                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18144                _next_ordinal_to_read += 1;
18145                next_offset += envelope_size;
18146            }
18147
18148            let next_out_of_line = decoder.next_out_of_line();
18149            let handles_before = decoder.remaining_handles();
18150            if let Some((inlined, num_bytes, num_handles)) =
18151                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18152            {
18153                let member_inline_size =
18154                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18155                if inlined != (member_inline_size <= 4) {
18156                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18157                }
18158                let inner_offset;
18159                let mut inner_depth = depth.clone();
18160                if inlined {
18161                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18162                    inner_offset = next_offset;
18163                } else {
18164                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18165                    inner_depth.increment()?;
18166                }
18167                let val_ref = self.can_go_back.get_or_insert_with(|| {
18168                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18169                });
18170                fidl::decode!(
18171                    bool,
18172                    fidl::encoding::DefaultFuchsiaResourceDialect,
18173                    val_ref,
18174                    decoder,
18175                    inner_offset,
18176                    inner_depth
18177                )?;
18178                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18179                {
18180                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18181                }
18182                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18183                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18184                }
18185            }
18186
18187            next_offset += envelope_size;
18188            _next_ordinal_to_read += 1;
18189            if next_offset >= end_offset {
18190                return Ok(());
18191            }
18192
18193            // Decode unknown envelopes for gaps in ordinals.
18194            while _next_ordinal_to_read < 6 {
18195                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18196                _next_ordinal_to_read += 1;
18197                next_offset += envelope_size;
18198            }
18199
18200            let next_out_of_line = decoder.next_out_of_line();
18201            let handles_before = decoder.remaining_handles();
18202            if let Some((inlined, num_bytes, num_handles)) =
18203                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18204            {
18205                let member_inline_size =
18206                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18207                if inlined != (member_inline_size <= 4) {
18208                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18209                }
18210                let inner_offset;
18211                let mut inner_depth = depth.clone();
18212                if inlined {
18213                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18214                    inner_offset = next_offset;
18215                } else {
18216                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18217                    inner_depth.increment()?;
18218                }
18219                let val_ref = self.is_main_document_loaded.get_or_insert_with(|| {
18220                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18221                });
18222                fidl::decode!(
18223                    bool,
18224                    fidl::encoding::DefaultFuchsiaResourceDialect,
18225                    val_ref,
18226                    decoder,
18227                    inner_offset,
18228                    inner_depth
18229                )?;
18230                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18231                {
18232                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18233                }
18234                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18235                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18236                }
18237            }
18238
18239            next_offset += envelope_size;
18240            _next_ordinal_to_read += 1;
18241            if next_offset >= end_offset {
18242                return Ok(());
18243            }
18244
18245            // Decode unknown envelopes for gaps in ordinals.
18246            while _next_ordinal_to_read < 7 {
18247                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18248                _next_ordinal_to_read += 1;
18249                next_offset += envelope_size;
18250            }
18251
18252            let next_out_of_line = decoder.next_out_of_line();
18253            let handles_before = decoder.remaining_handles();
18254            if let Some((inlined, num_bytes, num_handles)) =
18255                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18256            {
18257                let member_inline_size =
18258                    <Favicon as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18259                if inlined != (member_inline_size <= 4) {
18260                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18261                }
18262                let inner_offset;
18263                let mut inner_depth = depth.clone();
18264                if inlined {
18265                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18266                    inner_offset = next_offset;
18267                } else {
18268                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18269                    inner_depth.increment()?;
18270                }
18271                let val_ref = self.favicon.get_or_insert_with(|| {
18272                    fidl::new_empty!(Favicon, fidl::encoding::DefaultFuchsiaResourceDialect)
18273                });
18274                fidl::decode!(
18275                    Favicon,
18276                    fidl::encoding::DefaultFuchsiaResourceDialect,
18277                    val_ref,
18278                    decoder,
18279                    inner_offset,
18280                    inner_depth
18281                )?;
18282                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18283                {
18284                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18285                }
18286                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18287                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18288                }
18289            }
18290
18291            next_offset += envelope_size;
18292            _next_ordinal_to_read += 1;
18293            if next_offset >= end_offset {
18294                return Ok(());
18295            }
18296
18297            // Decode unknown envelopes for gaps in ordinals.
18298            while _next_ordinal_to_read < 8 {
18299                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18300                _next_ordinal_to_read += 1;
18301                next_offset += envelope_size;
18302            }
18303
18304            let next_out_of_line = decoder.next_out_of_line();
18305            let handles_before = decoder.remaining_handles();
18306            if let Some((inlined, num_bytes, num_handles)) =
18307                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18308            {
18309                let member_inline_size =
18310                    <ErrorDetail as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18311                if inlined != (member_inline_size <= 4) {
18312                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18313                }
18314                let inner_offset;
18315                let mut inner_depth = depth.clone();
18316                if inlined {
18317                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18318                    inner_offset = next_offset;
18319                } else {
18320                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18321                    inner_depth.increment()?;
18322                }
18323                let val_ref = self.error_detail.get_or_insert_with(|| {
18324                    fidl::new_empty!(ErrorDetail, fidl::encoding::DefaultFuchsiaResourceDialect)
18325                });
18326                fidl::decode!(
18327                    ErrorDetail,
18328                    fidl::encoding::DefaultFuchsiaResourceDialect,
18329                    val_ref,
18330                    decoder,
18331                    inner_offset,
18332                    inner_depth
18333                )?;
18334                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18335                {
18336                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18337                }
18338                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18339                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18340                }
18341            }
18342
18343            next_offset += envelope_size;
18344
18345            // Decode the remaining unknown envelopes.
18346            while next_offset < end_offset {
18347                _next_ordinal_to_read += 1;
18348                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18349                next_offset += envelope_size;
18350            }
18351
18352            Ok(())
18353        }
18354    }
18355
18356    impl PopupFrameCreationInfo {
18357        #[inline(always)]
18358        fn max_ordinal_present(&self) -> u64 {
18359            if let Some(_) = self.initiated_by_user {
18360                return 2;
18361            }
18362            if let Some(_) = self.initial_url {
18363                return 1;
18364            }
18365            0
18366        }
18367    }
18368
18369    impl fidl::encoding::ResourceTypeMarker for PopupFrameCreationInfo {
18370        type Borrowed<'a> = &'a mut Self;
18371        fn take_or_borrow<'a>(
18372            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18373        ) -> Self::Borrowed<'a> {
18374            value
18375        }
18376    }
18377
18378    unsafe impl fidl::encoding::TypeMarker for PopupFrameCreationInfo {
18379        type Owned = Self;
18380
18381        #[inline(always)]
18382        fn inline_align(_context: fidl::encoding::Context) -> usize {
18383            8
18384        }
18385
18386        #[inline(always)]
18387        fn inline_size(_context: fidl::encoding::Context) -> usize {
18388            16
18389        }
18390    }
18391
18392    unsafe impl
18393        fidl::encoding::Encode<
18394            PopupFrameCreationInfo,
18395            fidl::encoding::DefaultFuchsiaResourceDialect,
18396        > for &mut PopupFrameCreationInfo
18397    {
18398        unsafe fn encode(
18399            self,
18400            encoder: &mut fidl::encoding::Encoder<
18401                '_,
18402                fidl::encoding::DefaultFuchsiaResourceDialect,
18403            >,
18404            offset: usize,
18405            mut depth: fidl::encoding::Depth,
18406        ) -> fidl::Result<()> {
18407            encoder.debug_check_bounds::<PopupFrameCreationInfo>(offset);
18408            // Vector header
18409            let max_ordinal: u64 = self.max_ordinal_present();
18410            encoder.write_num(max_ordinal, offset);
18411            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18412            // Calling encoder.out_of_line_offset(0) is not allowed.
18413            if max_ordinal == 0 {
18414                return Ok(());
18415            }
18416            depth.increment()?;
18417            let envelope_size = 8;
18418            let bytes_len = max_ordinal as usize * envelope_size;
18419            #[allow(unused_variables)]
18420            let offset = encoder.out_of_line_offset(bytes_len);
18421            let mut _prev_end_offset: usize = 0;
18422            if 1 > max_ordinal {
18423                return Ok(());
18424            }
18425
18426            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18427            // are envelope_size bytes.
18428            let cur_offset: usize = (1 - 1) * envelope_size;
18429
18430            // Zero reserved fields.
18431            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18432
18433            // Safety:
18434            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18435            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18436            //   envelope_size bytes, there is always sufficient room.
18437            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<65536>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18438            self.initial_url.as_ref().map(<fidl::encoding::BoundedString<65536> as fidl::encoding::ValueTypeMarker>::borrow),
18439            encoder, offset + cur_offset, depth
18440        )?;
18441
18442            _prev_end_offset = cur_offset + envelope_size;
18443            if 2 > max_ordinal {
18444                return Ok(());
18445            }
18446
18447            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18448            // are envelope_size bytes.
18449            let cur_offset: usize = (2 - 1) * envelope_size;
18450
18451            // Zero reserved fields.
18452            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18453
18454            // Safety:
18455            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18456            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18457            //   envelope_size bytes, there is always sufficient room.
18458            fidl::encoding::encode_in_envelope_optional::<
18459                bool,
18460                fidl::encoding::DefaultFuchsiaResourceDialect,
18461            >(
18462                self.initiated_by_user
18463                    .as_ref()
18464                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
18465                encoder,
18466                offset + cur_offset,
18467                depth,
18468            )?;
18469
18470            _prev_end_offset = cur_offset + envelope_size;
18471
18472            Ok(())
18473        }
18474    }
18475
18476    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
18477        for PopupFrameCreationInfo
18478    {
18479        #[inline(always)]
18480        fn new_empty() -> Self {
18481            Self::default()
18482        }
18483
18484        unsafe fn decode(
18485            &mut self,
18486            decoder: &mut fidl::encoding::Decoder<
18487                '_,
18488                fidl::encoding::DefaultFuchsiaResourceDialect,
18489            >,
18490            offset: usize,
18491            mut depth: fidl::encoding::Depth,
18492        ) -> fidl::Result<()> {
18493            decoder.debug_check_bounds::<Self>(offset);
18494            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18495                None => return Err(fidl::Error::NotNullable),
18496                Some(len) => len,
18497            };
18498            // Calling decoder.out_of_line_offset(0) is not allowed.
18499            if len == 0 {
18500                return Ok(());
18501            };
18502            depth.increment()?;
18503            let envelope_size = 8;
18504            let bytes_len = len * envelope_size;
18505            let offset = decoder.out_of_line_offset(bytes_len)?;
18506            // Decode the envelope for each type.
18507            let mut _next_ordinal_to_read = 0;
18508            let mut next_offset = offset;
18509            let end_offset = offset + bytes_len;
18510            _next_ordinal_to_read += 1;
18511            if next_offset >= end_offset {
18512                return Ok(());
18513            }
18514
18515            // Decode unknown envelopes for gaps in ordinals.
18516            while _next_ordinal_to_read < 1 {
18517                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18518                _next_ordinal_to_read += 1;
18519                next_offset += envelope_size;
18520            }
18521
18522            let next_out_of_line = decoder.next_out_of_line();
18523            let handles_before = decoder.remaining_handles();
18524            if let Some((inlined, num_bytes, num_handles)) =
18525                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18526            {
18527                let member_inline_size = <fidl::encoding::BoundedString<65536> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18528                if inlined != (member_inline_size <= 4) {
18529                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18530                }
18531                let inner_offset;
18532                let mut inner_depth = depth.clone();
18533                if inlined {
18534                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18535                    inner_offset = next_offset;
18536                } else {
18537                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18538                    inner_depth.increment()?;
18539                }
18540                let val_ref = self.initial_url.get_or_insert_with(|| {
18541                    fidl::new_empty!(
18542                        fidl::encoding::BoundedString<65536>,
18543                        fidl::encoding::DefaultFuchsiaResourceDialect
18544                    )
18545                });
18546                fidl::decode!(
18547                    fidl::encoding::BoundedString<65536>,
18548                    fidl::encoding::DefaultFuchsiaResourceDialect,
18549                    val_ref,
18550                    decoder,
18551                    inner_offset,
18552                    inner_depth
18553                )?;
18554                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18555                {
18556                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18557                }
18558                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18559                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18560                }
18561            }
18562
18563            next_offset += envelope_size;
18564            _next_ordinal_to_read += 1;
18565            if next_offset >= end_offset {
18566                return Ok(());
18567            }
18568
18569            // Decode unknown envelopes for gaps in ordinals.
18570            while _next_ordinal_to_read < 2 {
18571                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18572                _next_ordinal_to_read += 1;
18573                next_offset += envelope_size;
18574            }
18575
18576            let next_out_of_line = decoder.next_out_of_line();
18577            let handles_before = decoder.remaining_handles();
18578            if let Some((inlined, num_bytes, num_handles)) =
18579                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18580            {
18581                let member_inline_size =
18582                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18583                if inlined != (member_inline_size <= 4) {
18584                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18585                }
18586                let inner_offset;
18587                let mut inner_depth = depth.clone();
18588                if inlined {
18589                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18590                    inner_offset = next_offset;
18591                } else {
18592                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18593                    inner_depth.increment()?;
18594                }
18595                let val_ref = self.initiated_by_user.get_or_insert_with(|| {
18596                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
18597                });
18598                fidl::decode!(
18599                    bool,
18600                    fidl::encoding::DefaultFuchsiaResourceDialect,
18601                    val_ref,
18602                    decoder,
18603                    inner_offset,
18604                    inner_depth
18605                )?;
18606                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18607                {
18608                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18609                }
18610                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18611                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18612                }
18613            }
18614
18615            next_offset += envelope_size;
18616
18617            // Decode the remaining unknown envelopes.
18618            while next_offset < end_offset {
18619                _next_ordinal_to_read += 1;
18620                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18621                next_offset += envelope_size;
18622            }
18623
18624            Ok(())
18625        }
18626    }
18627
18628    impl WebMessage {
18629        #[inline(always)]
18630        fn max_ordinal_present(&self) -> u64 {
18631            if let Some(_) = self.outgoing_transfer {
18632                return 3;
18633            }
18634            if let Some(_) = self.incoming_transfer {
18635                return 2;
18636            }
18637            if let Some(_) = self.data {
18638                return 1;
18639            }
18640            0
18641        }
18642    }
18643
18644    impl fidl::encoding::ResourceTypeMarker for WebMessage {
18645        type Borrowed<'a> = &'a mut Self;
18646        fn take_or_borrow<'a>(
18647            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18648        ) -> Self::Borrowed<'a> {
18649            value
18650        }
18651    }
18652
18653    unsafe impl fidl::encoding::TypeMarker for WebMessage {
18654        type Owned = Self;
18655
18656        #[inline(always)]
18657        fn inline_align(_context: fidl::encoding::Context) -> usize {
18658            8
18659        }
18660
18661        #[inline(always)]
18662        fn inline_size(_context: fidl::encoding::Context) -> usize {
18663            16
18664        }
18665    }
18666
18667    unsafe impl fidl::encoding::Encode<WebMessage, fidl::encoding::DefaultFuchsiaResourceDialect>
18668        for &mut WebMessage
18669    {
18670        unsafe fn encode(
18671            self,
18672            encoder: &mut fidl::encoding::Encoder<
18673                '_,
18674                fidl::encoding::DefaultFuchsiaResourceDialect,
18675            >,
18676            offset: usize,
18677            mut depth: fidl::encoding::Depth,
18678        ) -> fidl::Result<()> {
18679            encoder.debug_check_bounds::<WebMessage>(offset);
18680            // Vector header
18681            let max_ordinal: u64 = self.max_ordinal_present();
18682            encoder.write_num(max_ordinal, offset);
18683            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
18684            // Calling encoder.out_of_line_offset(0) is not allowed.
18685            if max_ordinal == 0 {
18686                return Ok(());
18687            }
18688            depth.increment()?;
18689            let envelope_size = 8;
18690            let bytes_len = max_ordinal as usize * envelope_size;
18691            #[allow(unused_variables)]
18692            let offset = encoder.out_of_line_offset(bytes_len);
18693            let mut _prev_end_offset: usize = 0;
18694            if 1 > max_ordinal {
18695                return Ok(());
18696            }
18697
18698            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18699            // are envelope_size bytes.
18700            let cur_offset: usize = (1 - 1) * envelope_size;
18701
18702            // Zero reserved fields.
18703            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18704
18705            // Safety:
18706            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18707            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18708            //   envelope_size bytes, there is always sufficient room.
18709            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_mem::Buffer, fidl::encoding::DefaultFuchsiaResourceDialect>(
18710            self.data.as_mut().map(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18711            encoder, offset + cur_offset, depth
18712        )?;
18713
18714            _prev_end_offset = cur_offset + envelope_size;
18715            if 2 > max_ordinal {
18716                return Ok(());
18717            }
18718
18719            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18720            // are envelope_size bytes.
18721            let cur_offset: usize = (2 - 1) * envelope_size;
18722
18723            // Zero reserved fields.
18724            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18725
18726            // Safety:
18727            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18728            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18729            //   envelope_size bytes, there is always sufficient room.
18730            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<IncomingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18731            self.incoming_transfer.as_mut().map(<fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18732            encoder, offset + cur_offset, depth
18733        )?;
18734
18735            _prev_end_offset = cur_offset + envelope_size;
18736            if 3 > max_ordinal {
18737                return Ok(());
18738            }
18739
18740            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
18741            // are envelope_size bytes.
18742            let cur_offset: usize = (3 - 1) * envelope_size;
18743
18744            // Zero reserved fields.
18745            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
18746
18747            // Safety:
18748            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
18749            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
18750            //   envelope_size bytes, there is always sufficient room.
18751            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<OutgoingTransferable>, fidl::encoding::DefaultFuchsiaResourceDialect>(
18752            self.outgoing_transfer.as_mut().map(<fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
18753            encoder, offset + cur_offset, depth
18754        )?;
18755
18756            _prev_end_offset = cur_offset + envelope_size;
18757
18758            Ok(())
18759        }
18760    }
18761
18762    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for WebMessage {
18763        #[inline(always)]
18764        fn new_empty() -> Self {
18765            Self::default()
18766        }
18767
18768        unsafe fn decode(
18769            &mut self,
18770            decoder: &mut fidl::encoding::Decoder<
18771                '_,
18772                fidl::encoding::DefaultFuchsiaResourceDialect,
18773            >,
18774            offset: usize,
18775            mut depth: fidl::encoding::Depth,
18776        ) -> fidl::Result<()> {
18777            decoder.debug_check_bounds::<Self>(offset);
18778            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
18779                None => return Err(fidl::Error::NotNullable),
18780                Some(len) => len,
18781            };
18782            // Calling decoder.out_of_line_offset(0) is not allowed.
18783            if len == 0 {
18784                return Ok(());
18785            };
18786            depth.increment()?;
18787            let envelope_size = 8;
18788            let bytes_len = len * envelope_size;
18789            let offset = decoder.out_of_line_offset(bytes_len)?;
18790            // Decode the envelope for each type.
18791            let mut _next_ordinal_to_read = 0;
18792            let mut next_offset = offset;
18793            let end_offset = offset + bytes_len;
18794            _next_ordinal_to_read += 1;
18795            if next_offset >= end_offset {
18796                return Ok(());
18797            }
18798
18799            // Decode unknown envelopes for gaps in ordinals.
18800            while _next_ordinal_to_read < 1 {
18801                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18802                _next_ordinal_to_read += 1;
18803                next_offset += envelope_size;
18804            }
18805
18806            let next_out_of_line = decoder.next_out_of_line();
18807            let handles_before = decoder.remaining_handles();
18808            if let Some((inlined, num_bytes, num_handles)) =
18809                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18810            {
18811                let member_inline_size =
18812                    <fidl_fuchsia_mem::Buffer as fidl::encoding::TypeMarker>::inline_size(
18813                        decoder.context,
18814                    );
18815                if inlined != (member_inline_size <= 4) {
18816                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18817                }
18818                let inner_offset;
18819                let mut inner_depth = depth.clone();
18820                if inlined {
18821                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18822                    inner_offset = next_offset;
18823                } else {
18824                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18825                    inner_depth.increment()?;
18826                }
18827                let val_ref = self.data.get_or_insert_with(|| {
18828                    fidl::new_empty!(
18829                        fidl_fuchsia_mem::Buffer,
18830                        fidl::encoding::DefaultFuchsiaResourceDialect
18831                    )
18832                });
18833                fidl::decode!(
18834                    fidl_fuchsia_mem::Buffer,
18835                    fidl::encoding::DefaultFuchsiaResourceDialect,
18836                    val_ref,
18837                    decoder,
18838                    inner_offset,
18839                    inner_depth
18840                )?;
18841                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18842                {
18843                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18844                }
18845                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18846                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18847                }
18848            }
18849
18850            next_offset += envelope_size;
18851            _next_ordinal_to_read += 1;
18852            if next_offset >= end_offset {
18853                return Ok(());
18854            }
18855
18856            // Decode unknown envelopes for gaps in ordinals.
18857            while _next_ordinal_to_read < 2 {
18858                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18859                _next_ordinal_to_read += 1;
18860                next_offset += envelope_size;
18861            }
18862
18863            let next_out_of_line = decoder.next_out_of_line();
18864            let handles_before = decoder.remaining_handles();
18865            if let Some((inlined, num_bytes, num_handles)) =
18866                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18867            {
18868                let member_inline_size = <fidl::encoding::UnboundedVector<IncomingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18869                if inlined != (member_inline_size <= 4) {
18870                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18871                }
18872                let inner_offset;
18873                let mut inner_depth = depth.clone();
18874                if inlined {
18875                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18876                    inner_offset = next_offset;
18877                } else {
18878                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18879                    inner_depth.increment()?;
18880                }
18881                let val_ref = self.incoming_transfer.get_or_insert_with(|| {
18882                    fidl::new_empty!(
18883                        fidl::encoding::UnboundedVector<IncomingTransferable>,
18884                        fidl::encoding::DefaultFuchsiaResourceDialect
18885                    )
18886                });
18887                fidl::decode!(
18888                    fidl::encoding::UnboundedVector<IncomingTransferable>,
18889                    fidl::encoding::DefaultFuchsiaResourceDialect,
18890                    val_ref,
18891                    decoder,
18892                    inner_offset,
18893                    inner_depth
18894                )?;
18895                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18896                {
18897                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18898                }
18899                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18900                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18901                }
18902            }
18903
18904            next_offset += envelope_size;
18905            _next_ordinal_to_read += 1;
18906            if next_offset >= end_offset {
18907                return Ok(());
18908            }
18909
18910            // Decode unknown envelopes for gaps in ordinals.
18911            while _next_ordinal_to_read < 3 {
18912                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18913                _next_ordinal_to_read += 1;
18914                next_offset += envelope_size;
18915            }
18916
18917            let next_out_of_line = decoder.next_out_of_line();
18918            let handles_before = decoder.remaining_handles();
18919            if let Some((inlined, num_bytes, num_handles)) =
18920                fidl::encoding::decode_envelope_header(decoder, next_offset)?
18921            {
18922                let member_inline_size = <fidl::encoding::UnboundedVector<OutgoingTransferable> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
18923                if inlined != (member_inline_size <= 4) {
18924                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
18925                }
18926                let inner_offset;
18927                let mut inner_depth = depth.clone();
18928                if inlined {
18929                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
18930                    inner_offset = next_offset;
18931                } else {
18932                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
18933                    inner_depth.increment()?;
18934                }
18935                let val_ref = self.outgoing_transfer.get_or_insert_with(|| {
18936                    fidl::new_empty!(
18937                        fidl::encoding::UnboundedVector<OutgoingTransferable>,
18938                        fidl::encoding::DefaultFuchsiaResourceDialect
18939                    )
18940                });
18941                fidl::decode!(
18942                    fidl::encoding::UnboundedVector<OutgoingTransferable>,
18943                    fidl::encoding::DefaultFuchsiaResourceDialect,
18944                    val_ref,
18945                    decoder,
18946                    inner_offset,
18947                    inner_depth
18948                )?;
18949                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
18950                {
18951                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
18952                }
18953                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
18954                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
18955                }
18956            }
18957
18958            next_offset += envelope_size;
18959
18960            // Decode the remaining unknown envelopes.
18961            while next_offset < end_offset {
18962                _next_ordinal_to_read += 1;
18963                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
18964                next_offset += envelope_size;
18965            }
18966
18967            Ok(())
18968        }
18969    }
18970
18971    impl fidl::encoding::ResourceTypeMarker for IncomingTransferable {
18972        type Borrowed<'a> = &'a mut Self;
18973        fn take_or_borrow<'a>(
18974            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
18975        ) -> Self::Borrowed<'a> {
18976            value
18977        }
18978    }
18979
18980    unsafe impl fidl::encoding::TypeMarker for IncomingTransferable {
18981        type Owned = Self;
18982
18983        #[inline(always)]
18984        fn inline_align(_context: fidl::encoding::Context) -> usize {
18985            8
18986        }
18987
18988        #[inline(always)]
18989        fn inline_size(_context: fidl::encoding::Context) -> usize {
18990            16
18991        }
18992    }
18993
18994    unsafe impl
18995        fidl::encoding::Encode<IncomingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
18996        for &mut IncomingTransferable
18997    {
18998        #[inline]
18999        unsafe fn encode(
19000            self,
19001            encoder: &mut fidl::encoding::Encoder<
19002                '_,
19003                fidl::encoding::DefaultFuchsiaResourceDialect,
19004            >,
19005            offset: usize,
19006            _depth: fidl::encoding::Depth,
19007        ) -> fidl::Result<()> {
19008            encoder.debug_check_bounds::<IncomingTransferable>(offset);
19009            encoder.write_num::<u64>(self.ordinal(), offset);
19010            match self {
19011            IncomingTransferable::MessagePort(ref mut val) => {
19012                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
19013                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19014                    encoder, offset + 8, _depth
19015                )
19016            }
19017            IncomingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19018        }
19019        }
19020    }
19021
19022    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19023        for IncomingTransferable
19024    {
19025        #[inline(always)]
19026        fn new_empty() -> Self {
19027            Self::__SourceBreaking { unknown_ordinal: 0 }
19028        }
19029
19030        #[inline]
19031        unsafe fn decode(
19032            &mut self,
19033            decoder: &mut fidl::encoding::Decoder<
19034                '_,
19035                fidl::encoding::DefaultFuchsiaResourceDialect,
19036            >,
19037            offset: usize,
19038            mut depth: fidl::encoding::Depth,
19039        ) -> fidl::Result<()> {
19040            decoder.debug_check_bounds::<Self>(offset);
19041            #[allow(unused_variables)]
19042            let next_out_of_line = decoder.next_out_of_line();
19043            let handles_before = decoder.remaining_handles();
19044            let (ordinal, inlined, num_bytes, num_handles) =
19045                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19046
19047            let member_inline_size = match ordinal {
19048            1 => <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19049            0 => return Err(fidl::Error::UnknownUnionTag),
19050            _ => num_bytes as usize,
19051        };
19052
19053            if inlined != (member_inline_size <= 4) {
19054                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19055            }
19056            let _inner_offset;
19057            if inlined {
19058                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19059                _inner_offset = offset + 8;
19060            } else {
19061                depth.increment()?;
19062                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19063            }
19064            match ordinal {
19065                1 => {
19066                    #[allow(irrefutable_let_patterns)]
19067                    if let IncomingTransferable::MessagePort(_) = self {
19068                        // Do nothing, read the value into the object
19069                    } else {
19070                        // Initialize `self` to the right variant
19071                        *self = IncomingTransferable::MessagePort(fidl::new_empty!(
19072                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
19073                            fidl::encoding::DefaultFuchsiaResourceDialect
19074                        ));
19075                    }
19076                    #[allow(irrefutable_let_patterns)]
19077                    if let IncomingTransferable::MessagePort(ref mut val) = self {
19078                        fidl::decode!(
19079                            fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MessagePortMarker>>,
19080                            fidl::encoding::DefaultFuchsiaResourceDialect,
19081                            val,
19082                            decoder,
19083                            _inner_offset,
19084                            depth
19085                        )?;
19086                    } else {
19087                        unreachable!()
19088                    }
19089                }
19090                #[allow(deprecated)]
19091                ordinal => {
19092                    for _ in 0..num_handles {
19093                        decoder.drop_next_handle()?;
19094                    }
19095                    *self = IncomingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19096                }
19097            }
19098            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19099                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19100            }
19101            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19102                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19103            }
19104            Ok(())
19105        }
19106    }
19107
19108    impl fidl::encoding::ResourceTypeMarker for NavigationDecision {
19109        type Borrowed<'a> = &'a mut Self;
19110        fn take_or_borrow<'a>(
19111            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19112        ) -> Self::Borrowed<'a> {
19113            value
19114        }
19115    }
19116
19117    unsafe impl fidl::encoding::TypeMarker for NavigationDecision {
19118        type Owned = Self;
19119
19120        #[inline(always)]
19121        fn inline_align(_context: fidl::encoding::Context) -> usize {
19122            8
19123        }
19124
19125        #[inline(always)]
19126        fn inline_size(_context: fidl::encoding::Context) -> usize {
19127            16
19128        }
19129    }
19130
19131    unsafe impl
19132        fidl::encoding::Encode<NavigationDecision, fidl::encoding::DefaultFuchsiaResourceDialect>
19133        for &mut NavigationDecision
19134    {
19135        #[inline]
19136        unsafe fn encode(
19137            self,
19138            encoder: &mut fidl::encoding::Encoder<
19139                '_,
19140                fidl::encoding::DefaultFuchsiaResourceDialect,
19141            >,
19142            offset: usize,
19143            _depth: fidl::encoding::Depth,
19144        ) -> fidl::Result<()> {
19145            encoder.debug_check_bounds::<NavigationDecision>(offset);
19146            encoder.write_num::<u64>(self.ordinal(), offset);
19147            match self {
19148                NavigationDecision::Proceed(ref val) => fidl::encoding::encode_in_envelope::<
19149                    NoArgumentsAction,
19150                    fidl::encoding::DefaultFuchsiaResourceDialect,
19151                >(
19152                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19153                    encoder,
19154                    offset + 8,
19155                    _depth,
19156                ),
19157                NavigationDecision::Abort(ref val) => fidl::encoding::encode_in_envelope::<
19158                    NoArgumentsAction,
19159                    fidl::encoding::DefaultFuchsiaResourceDialect,
19160                >(
19161                    <NoArgumentsAction as fidl::encoding::ValueTypeMarker>::borrow(val),
19162                    encoder,
19163                    offset + 8,
19164                    _depth,
19165                ),
19166            }
19167        }
19168    }
19169
19170    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19171        for NavigationDecision
19172    {
19173        #[inline(always)]
19174        fn new_empty() -> Self {
19175            Self::Proceed(fidl::new_empty!(
19176                NoArgumentsAction,
19177                fidl::encoding::DefaultFuchsiaResourceDialect
19178            ))
19179        }
19180
19181        #[inline]
19182        unsafe fn decode(
19183            &mut self,
19184            decoder: &mut fidl::encoding::Decoder<
19185                '_,
19186                fidl::encoding::DefaultFuchsiaResourceDialect,
19187            >,
19188            offset: usize,
19189            mut depth: fidl::encoding::Depth,
19190        ) -> fidl::Result<()> {
19191            decoder.debug_check_bounds::<Self>(offset);
19192            #[allow(unused_variables)]
19193            let next_out_of_line = decoder.next_out_of_line();
19194            let handles_before = decoder.remaining_handles();
19195            let (ordinal, inlined, num_bytes, num_handles) =
19196                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19197
19198            let member_inline_size = match ordinal {
19199                1 => {
19200                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19201                }
19202                2 => {
19203                    <NoArgumentsAction as fidl::encoding::TypeMarker>::inline_size(decoder.context)
19204                }
19205                _ => return Err(fidl::Error::UnknownUnionTag),
19206            };
19207
19208            if inlined != (member_inline_size <= 4) {
19209                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19210            }
19211            let _inner_offset;
19212            if inlined {
19213                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19214                _inner_offset = offset + 8;
19215            } else {
19216                depth.increment()?;
19217                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19218            }
19219            match ordinal {
19220                1 => {
19221                    #[allow(irrefutable_let_patterns)]
19222                    if let NavigationDecision::Proceed(_) = self {
19223                        // Do nothing, read the value into the object
19224                    } else {
19225                        // Initialize `self` to the right variant
19226                        *self = NavigationDecision::Proceed(fidl::new_empty!(
19227                            NoArgumentsAction,
19228                            fidl::encoding::DefaultFuchsiaResourceDialect
19229                        ));
19230                    }
19231                    #[allow(irrefutable_let_patterns)]
19232                    if let NavigationDecision::Proceed(ref mut val) = self {
19233                        fidl::decode!(
19234                            NoArgumentsAction,
19235                            fidl::encoding::DefaultFuchsiaResourceDialect,
19236                            val,
19237                            decoder,
19238                            _inner_offset,
19239                            depth
19240                        )?;
19241                    } else {
19242                        unreachable!()
19243                    }
19244                }
19245                2 => {
19246                    #[allow(irrefutable_let_patterns)]
19247                    if let NavigationDecision::Abort(_) = self {
19248                        // Do nothing, read the value into the object
19249                    } else {
19250                        // Initialize `self` to the right variant
19251                        *self = NavigationDecision::Abort(fidl::new_empty!(
19252                            NoArgumentsAction,
19253                            fidl::encoding::DefaultFuchsiaResourceDialect
19254                        ));
19255                    }
19256                    #[allow(irrefutable_let_patterns)]
19257                    if let NavigationDecision::Abort(ref mut val) = self {
19258                        fidl::decode!(
19259                            NoArgumentsAction,
19260                            fidl::encoding::DefaultFuchsiaResourceDialect,
19261                            val,
19262                            decoder,
19263                            _inner_offset,
19264                            depth
19265                        )?;
19266                    } else {
19267                        unreachable!()
19268                    }
19269                }
19270                ordinal => panic!("unexpected ordinal {:?}", ordinal),
19271            }
19272            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19273                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19274            }
19275            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19276                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19277            }
19278            Ok(())
19279        }
19280    }
19281
19282    impl fidl::encoding::ResourceTypeMarker for OutgoingTransferable {
19283        type Borrowed<'a> = &'a mut Self;
19284        fn take_or_borrow<'a>(
19285            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
19286        ) -> Self::Borrowed<'a> {
19287            value
19288        }
19289    }
19290
19291    unsafe impl fidl::encoding::TypeMarker for OutgoingTransferable {
19292        type Owned = Self;
19293
19294        #[inline(always)]
19295        fn inline_align(_context: fidl::encoding::Context) -> usize {
19296            8
19297        }
19298
19299        #[inline(always)]
19300        fn inline_size(_context: fidl::encoding::Context) -> usize {
19301            16
19302        }
19303    }
19304
19305    unsafe impl
19306        fidl::encoding::Encode<OutgoingTransferable, fidl::encoding::DefaultFuchsiaResourceDialect>
19307        for &mut OutgoingTransferable
19308    {
19309        #[inline]
19310        unsafe fn encode(
19311            self,
19312            encoder: &mut fidl::encoding::Encoder<
19313                '_,
19314                fidl::encoding::DefaultFuchsiaResourceDialect,
19315            >,
19316            offset: usize,
19317            _depth: fidl::encoding::Depth,
19318        ) -> fidl::Result<()> {
19319            encoder.debug_check_bounds::<OutgoingTransferable>(offset);
19320            encoder.write_num::<u64>(self.ordinal(), offset);
19321            match self {
19322            OutgoingTransferable::MessagePort(ref mut val) => {
19323                fidl::encoding::encode_in_envelope::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
19324                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
19325                    encoder, offset + 8, _depth
19326                )
19327            }
19328            OutgoingTransferable::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
19329        }
19330        }
19331    }
19332
19333    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
19334        for OutgoingTransferable
19335    {
19336        #[inline(always)]
19337        fn new_empty() -> Self {
19338            Self::__SourceBreaking { unknown_ordinal: 0 }
19339        }
19340
19341        #[inline]
19342        unsafe fn decode(
19343            &mut self,
19344            decoder: &mut fidl::encoding::Decoder<
19345                '_,
19346                fidl::encoding::DefaultFuchsiaResourceDialect,
19347            >,
19348            offset: usize,
19349            mut depth: fidl::encoding::Depth,
19350        ) -> fidl::Result<()> {
19351            decoder.debug_check_bounds::<Self>(offset);
19352            #[allow(unused_variables)]
19353            let next_out_of_line = decoder.next_out_of_line();
19354            let handles_before = decoder.remaining_handles();
19355            let (ordinal, inlined, num_bytes, num_handles) =
19356                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
19357
19358            let member_inline_size = match ordinal {
19359            1 => <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
19360            0 => return Err(fidl::Error::UnknownUnionTag),
19361            _ => num_bytes as usize,
19362        };
19363
19364            if inlined != (member_inline_size <= 4) {
19365                return Err(fidl::Error::InvalidInlineBitInEnvelope);
19366            }
19367            let _inner_offset;
19368            if inlined {
19369                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
19370                _inner_offset = offset + 8;
19371            } else {
19372                depth.increment()?;
19373                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
19374            }
19375            match ordinal {
19376                1 => {
19377                    #[allow(irrefutable_let_patterns)]
19378                    if let OutgoingTransferable::MessagePort(_) = self {
19379                        // Do nothing, read the value into the object
19380                    } else {
19381                        // Initialize `self` to the right variant
19382                        *self = OutgoingTransferable::MessagePort(fidl::new_empty!(
19383                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19384                            fidl::encoding::DefaultFuchsiaResourceDialect
19385                        ));
19386                    }
19387                    #[allow(irrefutable_let_patterns)]
19388                    if let OutgoingTransferable::MessagePort(ref mut val) = self {
19389                        fidl::decode!(
19390                            fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MessagePortMarker>>,
19391                            fidl::encoding::DefaultFuchsiaResourceDialect,
19392                            val,
19393                            decoder,
19394                            _inner_offset,
19395                            depth
19396                        )?;
19397                    } else {
19398                        unreachable!()
19399                    }
19400                }
19401                #[allow(deprecated)]
19402                ordinal => {
19403                    for _ in 0..num_handles {
19404                        decoder.drop_next_handle()?;
19405                    }
19406                    *self = OutgoingTransferable::__SourceBreaking { unknown_ordinal: ordinal };
19407                }
19408            }
19409            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
19410                return Err(fidl::Error::InvalidNumBytesInEnvelope);
19411            }
19412            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
19413                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
19414            }
19415            Ok(())
19416        }
19417    }
19418}