Skip to main content

fidl_next_common_fuchsia_ui_views/
fidl_next_common_fuchsia_ui_views.rs

1// DO NOT EDIT: This file is machine-generated by fidlgen
2#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
8    #[repr(u32)]
9    pub enum AutoFocusError {
10        UnknownOrdinal_(u32) = 0,
11    }
12    impl ::std::convert::From<u32> for AutoFocusError {
13        fn from(value: u32) -> Self {
14            match value {
15                _ => Self::UnknownOrdinal_(value),
16            }
17        }
18    }
19
20    impl ::std::convert::From<AutoFocusError> for u32 {
21        fn from(value: AutoFocusError) -> Self {
22            match value {
23                AutoFocusError::UnknownOrdinal_(value) => value,
24            }
25        }
26    }
27
28    unsafe impl<___E> ::fidl_next::Encode<crate::wire::AutoFocusError, ___E> for AutoFocusError
29    where
30        ___E: ?Sized,
31    {
32        #[inline]
33        fn encode(
34            self,
35            encoder: &mut ___E,
36            out: &mut ::core::mem::MaybeUninit<crate::wire::AutoFocusError>,
37            _: (),
38        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
39            ::fidl_next::Encode::encode(&self, encoder, out, ())
40        }
41    }
42
43    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::AutoFocusError, ___E> for &'a AutoFocusError
44    where
45        ___E: ?Sized,
46    {
47        #[inline]
48        fn encode(
49            self,
50            encoder: &mut ___E,
51            out: &mut ::core::mem::MaybeUninit<crate::wire::AutoFocusError>,
52            _: (),
53        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
54            ::fidl_next::munge!(let crate::wire::AutoFocusError { value } = out);
55            let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
56                AutoFocusError::UnknownOrdinal_(value) => value,
57            }));
58
59            Ok(())
60        }
61    }
62
63    impl ::core::convert::From<crate::wire::AutoFocusError> for AutoFocusError {
64        fn from(wire: crate::wire::AutoFocusError) -> Self {
65            match u32::from(wire.value) {
66                value => Self::UnknownOrdinal_(value),
67            }
68        }
69    }
70
71    impl ::fidl_next::FromWire<crate::wire::AutoFocusError> for AutoFocusError {
72        #[inline]
73        fn from_wire(wire: crate::wire::AutoFocusError) -> Self {
74            Self::from(wire)
75        }
76    }
77
78    impl ::fidl_next::FromWireRef<crate::wire::AutoFocusError> for AutoFocusError {
79        #[inline]
80        fn from_wire_ref(wire: &crate::wire::AutoFocusError) -> Self {
81            Self::from(*wire)
82        }
83    }
84
85    #[doc = " DO NOT USE - Retained for ABI stability in fuchsia.ui.scenic.Command\n"]
86    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
87    pub enum Command {
88        Empty(i32),
89    }
90
91    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Command, ___E> for Command
92    where
93        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
94    {
95        #[inline]
96        fn encode(
97            self,
98            encoder: &mut ___E,
99            out: &mut ::core::mem::MaybeUninit<crate::wire::Command>,
100            _: (),
101        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
102            ::fidl_next::munge!(let crate::wire::Command { raw, _phantom: _ } = out);
103
104            match self {
105                Self::Empty(value) => ::fidl_next::wire::Union::encode_as_static::<
106                    ___E,
107                    ::fidl_next::wire::Int32,
108                >(value, 1, encoder, raw, ())?,
109            }
110
111            Ok(())
112        }
113    }
114
115    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Command, ___E> for &'a Command
116    where
117        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
118    {
119        #[inline]
120        fn encode(
121            self,
122            encoder: &mut ___E,
123            out: &mut ::core::mem::MaybeUninit<crate::wire::Command>,
124            _: (),
125        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
126            ::fidl_next::munge!(let crate::wire::Command { raw, _phantom: _ } = out);
127
128            match self {
129                Command::Empty(value) => ::fidl_next::wire::Union::encode_as_static::<
130                    ___E,
131                    ::fidl_next::wire::Int32,
132                >(value, 1, encoder, raw, ())?,
133            }
134
135            Ok(())
136        }
137    }
138
139    unsafe impl<___E> ::fidl_next::EncodeOption<crate::wire_optional::Command, ___E> for Command
140    where
141        ___E: ?Sized,
142        Command: ::fidl_next::Encode<crate::wire::Command, ___E>,
143    {
144        #[inline]
145        fn encode_option(
146            this: ::core::option::Option<Self>,
147            encoder: &mut ___E,
148            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::Command>,
149            _: (),
150        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
151            ::fidl_next::munge!(let crate::wire_optional::Command { raw, _phantom: _ } = &mut *out);
152
153            if let Some(inner) = this {
154                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
155                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
156            } else {
157                ::fidl_next::wire::Union::encode_absent(raw);
158            }
159
160            Ok(())
161        }
162    }
163
164    unsafe impl<'a, ___E> ::fidl_next::EncodeOption<crate::wire_optional::Command, ___E> for &'a Command
165    where
166        ___E: ?Sized,
167        &'a Command: ::fidl_next::Encode<crate::wire::Command, ___E>,
168    {
169        #[inline]
170        fn encode_option(
171            this: ::core::option::Option<Self>,
172            encoder: &mut ___E,
173            out: &mut ::core::mem::MaybeUninit<crate::wire_optional::Command>,
174            _: (),
175        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
176            ::fidl_next::munge!(let crate::wire_optional::Command { raw, _phantom: _ } = &mut *out);
177
178            if let Some(inner) = this {
179                let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
180                ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
181            } else {
182                ::fidl_next::wire::Union::encode_absent(raw);
183            }
184
185            Ok(())
186        }
187    }
188
189    impl ::fidl_next::FromWire<crate::wire::Command> for Command {
190        #[inline]
191        fn from_wire(wire: crate::wire::Command) -> Self {
192            let wire = ::core::mem::ManuallyDrop::new(wire);
193            match wire.raw.ordinal() {
194                1 => Self::Empty(::fidl_next::FromWire::from_wire(unsafe {
195                    wire.raw.get().read_unchecked::<::fidl_next::wire::Int32>()
196                })),
197
198                _ => unsafe { ::core::hint::unreachable_unchecked() },
199            }
200        }
201    }
202
203    impl ::fidl_next::FromWireRef<crate::wire::Command> for Command {
204        #[inline]
205        fn from_wire_ref(wire: &crate::wire::Command) -> Self {
206            match wire.raw.ordinal() {
207                1 => Self::Empty(::fidl_next::FromWireRef::from_wire_ref(unsafe {
208                    wire.raw.get().deref_unchecked::<::fidl_next::wire::Int32>()
209                })),
210
211                _ => unsafe { ::core::hint::unreachable_unchecked() },
212            }
213        }
214    }
215
216    impl ::fidl_next::FromWireOption<crate::wire_optional::Command> for Command {
217        #[inline]
218        fn from_wire_option(wire: crate::wire_optional::Command) -> ::core::option::Option<Self> {
219            if let Some(inner) = wire.into_option() {
220                Some(::fidl_next::FromWire::from_wire(inner))
221            } else {
222                None
223            }
224        }
225    }
226
227    impl ::fidl_next::FromWireOption<crate::wire_optional::Command> for Box<Command> {
228        #[inline]
229        fn from_wire_option(wire: crate::wire_optional::Command) -> ::core::option::Option<Self> {
230            <
231            Command as ::fidl_next::FromWireOption<crate::wire_optional::Command>
232        >::from_wire_option(wire).map(Box::new)
233        }
234    }
235
236    impl ::fidl_next::FromWireOptionRef<crate::wire_optional::Command> for Box<Command> {
237        #[inline]
238        fn from_wire_option_ref(
239            wire: &crate::wire_optional::Command,
240        ) -> ::core::option::Option<Self> {
241            if let Some(inner) = wire.as_ref() {
242                Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
243            } else {
244                None
245            }
246        }
247    }
248
249    #[doc = " Problematic situations that occur on Focuser.RequestFocus.\n"]
250    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
251    #[repr(u32)]
252    pub enum Error {
253        Denied = 1,
254    }
255    impl ::core::convert::TryFrom<u32> for Error {
256        type Error = ::fidl_next::UnknownStrictEnumMemberError;
257        fn try_from(
258            value: u32,
259        ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
260            match value {
261                1 => Ok(Self::Denied),
262
263                _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
264            }
265        }
266    }
267
268    impl ::std::convert::From<Error> for u32 {
269        fn from(value: Error) -> Self {
270            match value {
271                Error::Denied => 1,
272            }
273        }
274    }
275
276    unsafe impl<___E> ::fidl_next::Encode<crate::wire::Error, ___E> for Error
277    where
278        ___E: ?Sized,
279    {
280        #[inline]
281        fn encode(
282            self,
283            encoder: &mut ___E,
284            out: &mut ::core::mem::MaybeUninit<crate::wire::Error>,
285            _: (),
286        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
287            ::fidl_next::Encode::encode(&self, encoder, out, ())
288        }
289    }
290
291    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::Error, ___E> for &'a Error
292    where
293        ___E: ?Sized,
294    {
295        #[inline]
296        fn encode(
297            self,
298            encoder: &mut ___E,
299            out: &mut ::core::mem::MaybeUninit<crate::wire::Error>,
300            _: (),
301        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
302            ::fidl_next::munge!(let crate::wire::Error { value } = out);
303            let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
304                Error::Denied => 1,
305            }));
306
307            Ok(())
308        }
309    }
310
311    impl ::core::convert::From<crate::wire::Error> for Error {
312        fn from(wire: crate::wire::Error) -> Self {
313            match u32::from(wire.value) {
314                1 => Self::Denied,
315
316                _ => unsafe { ::core::hint::unreachable_unchecked() },
317            }
318        }
319    }
320
321    impl ::fidl_next::FromWire<crate::wire::Error> for Error {
322        #[inline]
323        fn from_wire(wire: crate::wire::Error) -> Self {
324            Self::from(wire)
325        }
326    }
327
328    impl ::fidl_next::FromWireRef<crate::wire::Error> for Error {
329        #[inline]
330        fn from_wire_ref(wire: &crate::wire::Error) -> Self {
331            Self::from(*wire)
332        }
333    }
334
335    #[doc = " A ViewRef\'s state of focus.\n"]
336    #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
337    pub struct FocusState {
338        pub focused: ::core::option::Option<bool>,
339    }
340
341    impl FocusState {
342        fn __max_ordinal(&self) -> usize {
343            if self.focused.is_some() {
344                return 1;
345            }
346
347            0
348        }
349    }
350
351    unsafe impl<___E> ::fidl_next::Encode<crate::wire::FocusState<'static>, ___E> for FocusState
352    where
353        ___E: ::fidl_next::Encoder + ?Sized,
354    {
355        #[inline]
356        fn encode(
357            mut self,
358            encoder: &mut ___E,
359            out: &mut ::core::mem::MaybeUninit<crate::wire::FocusState<'static>>,
360            _: (),
361        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
362            ::fidl_next::munge!(let crate::wire::FocusState { table } = out);
363
364            let max_ord = self.__max_ordinal();
365
366            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
367            ::fidl_next::Wire::zero_padding(&mut out);
368
369            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
370                ::fidl_next::wire::Envelope,
371            >(encoder, max_ord);
372
373            for i in 1..=max_ord {
374                match i {
375                    1 => {
376                        if let Some(value) = self.focused.take() {
377                            ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
378                                value,
379                                preallocated.encoder,
380                                &mut out,
381                                (),
382                            )?;
383                        } else {
384                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
385                        }
386                    }
387
388                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
389                }
390                unsafe {
391                    preallocated.write_next(out.assume_init_ref());
392                }
393            }
394
395            ::fidl_next::wire::Table::encode_len(table, max_ord);
396
397            Ok(())
398        }
399    }
400
401    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::FocusState<'static>, ___E> for &'a FocusState
402    where
403        ___E: ::fidl_next::Encoder + ?Sized,
404    {
405        #[inline]
406        fn encode(
407            self,
408            encoder: &mut ___E,
409            out: &mut ::core::mem::MaybeUninit<crate::wire::FocusState<'static>>,
410            _: (),
411        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
412            ::fidl_next::munge!(let crate::wire::FocusState { table } = out);
413
414            let max_ord = self.__max_ordinal();
415
416            let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
417            ::fidl_next::Wire::zero_padding(&mut out);
418
419            let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
420                ::fidl_next::wire::Envelope,
421            >(encoder, max_ord);
422
423            for i in 1..=max_ord {
424                match i {
425                    1 => {
426                        if let Some(value) = &self.focused {
427                            ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
428                                value,
429                                preallocated.encoder,
430                                &mut out,
431                                (),
432                            )?;
433                        } else {
434                            ::fidl_next::wire::Envelope::encode_zero(&mut out)
435                        }
436                    }
437
438                    _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
439                }
440                unsafe {
441                    preallocated.write_next(out.assume_init_ref());
442                }
443            }
444
445            ::fidl_next::wire::Table::encode_len(table, max_ord);
446
447            Ok(())
448        }
449    }
450
451    impl<'de> ::fidl_next::FromWire<crate::wire::FocusState<'de>> for FocusState {
452        #[inline]
453        fn from_wire(wire_: crate::wire::FocusState<'de>) -> Self {
454            let wire_ = ::core::mem::ManuallyDrop::new(wire_);
455
456            let focused = wire_.table.get(1);
457
458            Self {
459                focused: focused.map(|envelope| {
460                    ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
461                }),
462            }
463        }
464    }
465
466    impl<'de> ::fidl_next::FromWireRef<crate::wire::FocusState<'de>> for FocusState {
467        #[inline]
468        fn from_wire_ref(wire: &crate::wire::FocusState<'de>) -> Self {
469            Self {
470                focused: wire.table.get(1).map(|envelope| {
471                    ::fidl_next::FromWireRef::from_wire_ref(unsafe {
472                        envelope.deref_unchecked::<bool>()
473                    })
474                }),
475            }
476        }
477    }
478
479    pub type FocuserRequestFocusResponse = ();
480
481    pub type FocuserSetAutoFocusResponse = ();
482
483    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
484    pub struct ViewRefFocusedWatchResponse {
485        pub state: crate::natural::FocusState,
486    }
487
488    unsafe impl<___E> ::fidl_next::Encode<crate::wire::ViewRefFocusedWatchResponse<'static>, ___E>
489        for ViewRefFocusedWatchResponse
490    where
491        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
492        ___E: ::fidl_next::Encoder,
493    {
494        #[inline]
495        fn encode(
496            self,
497            encoder_: &mut ___E,
498            out_: &mut ::core::mem::MaybeUninit<crate::wire::ViewRefFocusedWatchResponse<'static>>,
499            _: (),
500        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
501            ::fidl_next::munge! {
502                let crate::wire::ViewRefFocusedWatchResponse {
503                    state,
504
505                } = out_;
506            }
507
508            ::fidl_next::Encode::encode(self.state, encoder_, state, ())?;
509
510            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(state.as_mut_ptr()) };
511
512            Ok(())
513        }
514    }
515
516    unsafe impl<'a, ___E>
517        ::fidl_next::Encode<crate::wire::ViewRefFocusedWatchResponse<'static>, ___E>
518        for &'a ViewRefFocusedWatchResponse
519    where
520        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
521        ___E: ::fidl_next::Encoder,
522    {
523        #[inline]
524        fn encode(
525            self,
526            encoder_: &mut ___E,
527            out_: &mut ::core::mem::MaybeUninit<crate::wire::ViewRefFocusedWatchResponse<'static>>,
528            _: (),
529        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
530            ::fidl_next::munge! {
531                let crate::wire::ViewRefFocusedWatchResponse {
532                    state,
533
534                } = out_;
535            }
536
537            ::fidl_next::Encode::encode(&self.state, encoder_, state, ())?;
538
539            let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(state.as_mut_ptr()) };
540
541            Ok(())
542        }
543    }
544
545    unsafe impl<___E>
546        ::fidl_next::EncodeOption<
547            ::fidl_next::wire::Box<'static, crate::wire::ViewRefFocusedWatchResponse<'static>>,
548            ___E,
549        > for ViewRefFocusedWatchResponse
550    where
551        ___E: ::fidl_next::Encoder + ?Sized,
552        ViewRefFocusedWatchResponse:
553            ::fidl_next::Encode<crate::wire::ViewRefFocusedWatchResponse<'static>, ___E>,
554    {
555        #[inline]
556        fn encode_option(
557            this: ::core::option::Option<Self>,
558            encoder: &mut ___E,
559            out: &mut ::core::mem::MaybeUninit<
560                ::fidl_next::wire::Box<'static, crate::wire::ViewRefFocusedWatchResponse<'static>>,
561            >,
562            _: (),
563        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
564            if let Some(inner) = this {
565                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
566                ::fidl_next::wire::Box::encode_present(out);
567            } else {
568                ::fidl_next::wire::Box::encode_absent(out);
569            }
570
571            Ok(())
572        }
573    }
574
575    unsafe impl<'a, ___E>
576        ::fidl_next::EncodeOption<
577            ::fidl_next::wire::Box<'static, crate::wire::ViewRefFocusedWatchResponse<'static>>,
578            ___E,
579        > for &'a ViewRefFocusedWatchResponse
580    where
581        ___E: ::fidl_next::Encoder + ?Sized,
582        &'a ViewRefFocusedWatchResponse:
583            ::fidl_next::Encode<crate::wire::ViewRefFocusedWatchResponse<'static>, ___E>,
584    {
585        #[inline]
586        fn encode_option(
587            this: ::core::option::Option<Self>,
588            encoder: &mut ___E,
589            out: &mut ::core::mem::MaybeUninit<
590                ::fidl_next::wire::Box<'static, crate::wire::ViewRefFocusedWatchResponse<'static>>,
591            >,
592            _: (),
593        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
594            if let Some(inner) = this {
595                ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
596                ::fidl_next::wire::Box::encode_present(out);
597            } else {
598                ::fidl_next::wire::Box::encode_absent(out);
599            }
600
601            Ok(())
602        }
603    }
604
605    impl<'de> ::fidl_next::FromWire<crate::wire::ViewRefFocusedWatchResponse<'de>>
606        for ViewRefFocusedWatchResponse
607    {
608        #[inline]
609        fn from_wire(wire: crate::wire::ViewRefFocusedWatchResponse<'de>) -> Self {
610            Self { state: ::fidl_next::FromWire::from_wire(wire.state) }
611        }
612    }
613
614    impl<'de> ::fidl_next::FromWireRef<crate::wire::ViewRefFocusedWatchResponse<'de>>
615        for ViewRefFocusedWatchResponse
616    {
617        #[inline]
618        fn from_wire_ref(wire: &crate::wire::ViewRefFocusedWatchResponse<'de>) -> Self {
619            Self { state: ::fidl_next::FromWireRef::from_wire_ref(&wire.state) }
620        }
621    }
622
623    pub type ViewRefInstalledWatchResponse = ();
624
625    #[doc = " A collection of error codes related to |ViewRefInstalled|.\n"]
626    #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
627    #[repr(u32)]
628    pub enum ViewRefInstalledError {
629        InvalidViewRef = 1,
630    }
631    impl ::core::convert::TryFrom<u32> for ViewRefInstalledError {
632        type Error = ::fidl_next::UnknownStrictEnumMemberError;
633        fn try_from(
634            value: u32,
635        ) -> ::core::result::Result<Self, ::fidl_next::UnknownStrictEnumMemberError> {
636            match value {
637                1 => Ok(Self::InvalidViewRef),
638
639                _ => Err(::fidl_next::UnknownStrictEnumMemberError::new(value.into())),
640            }
641        }
642    }
643
644    impl ::std::convert::From<ViewRefInstalledError> for u32 {
645        fn from(value: ViewRefInstalledError) -> Self {
646            match value {
647                ViewRefInstalledError::InvalidViewRef => 1,
648            }
649        }
650    }
651
652    unsafe impl<___E> ::fidl_next::Encode<crate::wire::ViewRefInstalledError, ___E>
653        for ViewRefInstalledError
654    where
655        ___E: ?Sized,
656    {
657        #[inline]
658        fn encode(
659            self,
660            encoder: &mut ___E,
661            out: &mut ::core::mem::MaybeUninit<crate::wire::ViewRefInstalledError>,
662            _: (),
663        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
664            ::fidl_next::Encode::encode(&self, encoder, out, ())
665        }
666    }
667
668    unsafe impl<'a, ___E> ::fidl_next::Encode<crate::wire::ViewRefInstalledError, ___E>
669        for &'a ViewRefInstalledError
670    where
671        ___E: ?Sized,
672    {
673        #[inline]
674        fn encode(
675            self,
676            encoder: &mut ___E,
677            out: &mut ::core::mem::MaybeUninit<crate::wire::ViewRefInstalledError>,
678            _: (),
679        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
680            ::fidl_next::munge!(let crate::wire::ViewRefInstalledError { value } = out);
681            let _ = value.write(::fidl_next::wire::Uint32::from(match *self {
682                ViewRefInstalledError::InvalidViewRef => 1,
683            }));
684
685            Ok(())
686        }
687    }
688
689    impl ::core::convert::From<crate::wire::ViewRefInstalledError> for ViewRefInstalledError {
690        fn from(wire: crate::wire::ViewRefInstalledError) -> Self {
691            match u32::from(wire.value) {
692                1 => Self::InvalidViewRef,
693
694                _ => unsafe { ::core::hint::unreachable_unchecked() },
695            }
696        }
697    }
698
699    impl ::fidl_next::FromWire<crate::wire::ViewRefInstalledError> for ViewRefInstalledError {
700        #[inline]
701        fn from_wire(wire: crate::wire::ViewRefInstalledError) -> Self {
702            Self::from(wire)
703        }
704    }
705
706    impl ::fidl_next::FromWireRef<crate::wire::ViewRefInstalledError> for ViewRefInstalledError {
707        #[inline]
708        fn from_wire_ref(wire: &crate::wire::ViewRefInstalledError) -> Self {
709            Self::from(*wire)
710        }
711    }
712}
713
714pub mod wire {
715
716    /// The wire type corresponding to [`AutoFocusError`].
717    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
718    #[repr(transparent)]
719    pub struct AutoFocusError {
720        pub(crate) value: ::fidl_next::wire::Uint32,
721    }
722
723    impl ::fidl_next::Constrained for AutoFocusError {
724        type Constraint = ();
725
726        fn validate(
727            _: ::fidl_next::Slot<'_, Self>,
728            _: Self::Constraint,
729        ) -> Result<(), ::fidl_next::ValidationError> {
730            Ok(())
731        }
732    }
733
734    unsafe impl ::fidl_next::Wire for AutoFocusError {
735        type Narrowed<'de> = Self;
736
737        #[inline]
738        fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
739            // Wire enums have no padding
740        }
741    }
742
743    impl AutoFocusError {}
744
745    unsafe impl<___D> ::fidl_next::Decode<___D> for AutoFocusError
746    where
747        ___D: ?Sized,
748    {
749        fn decode(
750            slot: ::fidl_next::Slot<'_, Self>,
751            _: &mut ___D,
752            _: (),
753        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
754            Ok(())
755        }
756    }
757
758    impl ::core::convert::From<crate::natural::AutoFocusError> for AutoFocusError {
759        fn from(natural: crate::natural::AutoFocusError) -> Self {
760            match natural {
761                crate::natural::AutoFocusError::UnknownOrdinal_(value) => {
762                    AutoFocusError { value: ::fidl_next::wire::Uint32::from(value) }
763                }
764            }
765        }
766    }
767
768    impl ::fidl_next::IntoNatural for AutoFocusError {
769        type Natural = crate::natural::AutoFocusError;
770    }
771
772    /// The wire type corresponding to [`Command`].
773    #[repr(transparent)]
774    pub struct Command {
775        pub(crate) raw: ::fidl_next::wire::Union,
776        pub(crate) _phantom: ::core::marker::PhantomData<()>,
777    }
778
779    impl Drop for Command {
780        fn drop(&mut self) {
781            match self.raw.ordinal() {
782                1 => {
783                    let _ = unsafe { self.raw.get().read_unchecked::<::fidl_next::wire::Int32>() };
784                }
785
786                _ => unsafe { ::core::hint::unreachable_unchecked() },
787            }
788        }
789    }
790
791    impl ::fidl_next::Constrained for Command {
792        type Constraint = ();
793
794        fn validate(
795            _: ::fidl_next::Slot<'_, Self>,
796            _: Self::Constraint,
797        ) -> Result<(), ::fidl_next::ValidationError> {
798            Ok(())
799        }
800    }
801
802    unsafe impl ::fidl_next::Wire for Command {
803        type Narrowed<'de> = Command;
804
805        #[inline]
806        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
807            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
808            ::fidl_next::wire::Union::zero_padding(raw);
809        }
810    }
811
812    pub mod command {
813        pub enum Ref<'de> {
814            Empty(&'de ::fidl_next::wire::Int32),
815        }
816
817        pub enum Value {
818            Empty(::fidl_next::wire::Int32),
819        }
820    }
821
822    impl Command {
823        pub fn as_ref(&self) -> crate::wire::command::Ref<'_> {
824            match self.raw.ordinal() {
825                1 => crate::wire::command::Ref::Empty(unsafe {
826                    self.raw.get().deref_unchecked::<::fidl_next::wire::Int32>()
827                }),
828
829                _ => unsafe { ::core::hint::unreachable_unchecked() },
830            }
831        }
832
833        pub fn into_inner(self) -> crate::wire::command::Value {
834            let this = ::core::mem::ManuallyDrop::new(self);
835
836            match this.raw.ordinal() {
837                1 => crate::wire::command::Value::Empty(unsafe {
838                    this.raw.get().read_unchecked::<::fidl_next::wire::Int32>()
839                }),
840
841                _ => unsafe { ::core::hint::unreachable_unchecked() },
842            }
843        }
844    }
845
846    impl Clone for Command {
847        fn clone(&self) -> Self {
848            match self.raw.ordinal() {
849                1 => Self {
850                    raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::wire::Int32>() },
851                    _phantom: ::core::marker::PhantomData,
852                },
853
854                _ => unsafe { ::core::hint::unreachable_unchecked() },
855            }
856        }
857    }
858
859    unsafe impl<___D> ::fidl_next::Decode<___D> for Command
860    where
861        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
862    {
863        fn decode(
864            mut slot: ::fidl_next::Slot<'_, Self>,
865            decoder: &mut ___D,
866            _: (),
867        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
868            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
869            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
870                1 => ::fidl_next::wire::Union::decode_as_static::<___D, ::fidl_next::wire::Int32>(
871                    raw,
872                    decoder,
873                    (),
874                )?,
875
876                ord => return Err(::fidl_next::DecodeError::InvalidUnionOrdinal(ord as usize)),
877            }
878
879            Ok(())
880        }
881    }
882
883    impl ::core::fmt::Debug for Command {
884        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
885            match self.raw.ordinal() {
886                1 => unsafe { self.raw.get().deref_unchecked::<::fidl_next::wire::Int32>().fmt(f) },
887                _ => unsafe { ::core::hint::unreachable_unchecked() },
888            }
889        }
890    }
891
892    impl ::fidl_next::IntoNatural for Command {
893        type Natural = crate::natural::Command;
894    }
895
896    /// The wire type corresponding to [`Error`].
897    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
898    #[repr(transparent)]
899    pub struct Error {
900        pub(crate) value: ::fidl_next::wire::Uint32,
901    }
902
903    impl ::fidl_next::Constrained for Error {
904        type Constraint = ();
905
906        fn validate(
907            _: ::fidl_next::Slot<'_, Self>,
908            _: Self::Constraint,
909        ) -> Result<(), ::fidl_next::ValidationError> {
910            Ok(())
911        }
912    }
913
914    unsafe impl ::fidl_next::Wire for Error {
915        type Narrowed<'de> = Self;
916
917        #[inline]
918        fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
919            // Wire enums have no padding
920        }
921    }
922
923    impl Error {
924        pub const DENIED: Error = Error { value: ::fidl_next::wire::Uint32(1) };
925    }
926
927    unsafe impl<___D> ::fidl_next::Decode<___D> for Error
928    where
929        ___D: ?Sized,
930    {
931        fn decode(
932            slot: ::fidl_next::Slot<'_, Self>,
933            _: &mut ___D,
934            _: (),
935        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
936            ::fidl_next::munge!(let Self { value } = slot);
937
938            match u32::from(*value) {
939                1 => (),
940                unknown => {
941                    return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
942                }
943            }
944
945            Ok(())
946        }
947    }
948
949    impl ::core::convert::From<crate::natural::Error> for Error {
950        fn from(natural: crate::natural::Error) -> Self {
951            match natural {
952                crate::natural::Error::Denied => Error::DENIED,
953            }
954        }
955    }
956
957    impl ::fidl_next::IntoNatural for Error {
958        type Natural = crate::natural::Error;
959    }
960
961    /// The wire type corresponding to [`FocusState`].
962    #[repr(C)]
963    pub struct FocusState<'de> {
964        pub(crate) table: ::fidl_next::wire::Table<'de>,
965    }
966
967    impl<'de> Drop for FocusState<'de> {
968        fn drop(&mut self) {
969            let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
970        }
971    }
972
973    impl ::fidl_next::Constrained for FocusState<'_> {
974        type Constraint = ();
975
976        fn validate(
977            _: ::fidl_next::Slot<'_, Self>,
978            _: Self::Constraint,
979        ) -> Result<(), ::fidl_next::ValidationError> {
980            Ok(())
981        }
982    }
983
984    unsafe impl ::fidl_next::Wire for FocusState<'static> {
985        type Narrowed<'de> = FocusState<'de>;
986
987        #[inline]
988        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
989            ::fidl_next::munge!(let Self { table } = out);
990            ::fidl_next::wire::Table::zero_padding(table);
991        }
992    }
993
994    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for FocusState<'de>
995    where
996        ___D: ::fidl_next::Decoder<'de> + ?Sized,
997    {
998        fn decode(
999            slot: ::fidl_next::Slot<'_, Self>,
1000            decoder: &mut ___D,
1001            _: (),
1002        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1003            ::fidl_next::munge!(let Self { table } = slot);
1004
1005            ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
1006                match ordinal {
1007                    0 => unsafe { ::core::hint::unreachable_unchecked() },
1008
1009                    1 => {
1010                        ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
1011                            slot.as_mut(),
1012                            decoder,
1013                            (),
1014                        )?;
1015
1016                        Ok(())
1017                    }
1018
1019                    _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
1020                }
1021            })
1022        }
1023    }
1024
1025    impl<'de> FocusState<'de> {
1026        pub fn focused(&self) -> ::core::option::Option<&bool> {
1027            unsafe { Some(self.table.get(1)?.deref_unchecked()) }
1028        }
1029
1030        pub fn take_focused(&mut self) -> ::core::option::Option<bool> {
1031            unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
1032        }
1033    }
1034
1035    impl<'de> ::core::fmt::Debug for FocusState<'de> {
1036        fn fmt(
1037            &self,
1038            f: &mut ::core::fmt::Formatter<'_>,
1039        ) -> ::core::result::Result<(), ::core::fmt::Error> {
1040            f.debug_struct("FocusState").field("focused", &self.focused()).finish()
1041        }
1042    }
1043
1044    impl<'de> ::fidl_next::IntoNatural for FocusState<'de> {
1045        type Natural = crate::natural::FocusState;
1046    }
1047
1048    /// The wire type corresponding to [`FocuserRequestFocusResponse`].
1049    pub type FocuserRequestFocusResponse = ::fidl_next::wire::Unit;
1050
1051    /// The wire type corresponding to [`FocuserSetAutoFocusResponse`].
1052    pub type FocuserSetAutoFocusResponse = ::fidl_next::wire::Unit;
1053
1054    /// The wire type corresponding to [`ViewRefFocusedWatchResponse`].
1055    #[derive(Debug)]
1056    #[repr(C)]
1057    pub struct ViewRefFocusedWatchResponse<'de> {
1058        pub state: crate::wire::FocusState<'de>,
1059    }
1060
1061    static_assertions::const_assert_eq!(std::mem::size_of::<ViewRefFocusedWatchResponse<'_>>(), 16);
1062    static_assertions::const_assert_eq!(std::mem::align_of::<ViewRefFocusedWatchResponse<'_>>(), 8);
1063
1064    static_assertions::const_assert_eq!(
1065        std::mem::offset_of!(ViewRefFocusedWatchResponse<'_>, state),
1066        0
1067    );
1068
1069    impl ::fidl_next::Constrained for ViewRefFocusedWatchResponse<'_> {
1070        type Constraint = ();
1071
1072        fn validate(
1073            _: ::fidl_next::Slot<'_, Self>,
1074            _: Self::Constraint,
1075        ) -> Result<(), ::fidl_next::ValidationError> {
1076            Ok(())
1077        }
1078    }
1079
1080    unsafe impl ::fidl_next::Wire for ViewRefFocusedWatchResponse<'static> {
1081        type Narrowed<'de> = ViewRefFocusedWatchResponse<'de>;
1082
1083        #[inline]
1084        fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1085            ::fidl_next::munge! {
1086                let Self {
1087                    state,
1088
1089                } = &mut *out_;
1090            }
1091
1092            ::fidl_next::Wire::zero_padding(state);
1093        }
1094    }
1095
1096    unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for ViewRefFocusedWatchResponse<'de>
1097    where
1098        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1099        ___D: ::fidl_next::Decoder<'de>,
1100    {
1101        fn decode(
1102            slot_: ::fidl_next::Slot<'_, Self>,
1103            decoder_: &mut ___D,
1104            _: (),
1105        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1106            ::fidl_next::munge! {
1107                let Self {
1108                    mut state,
1109
1110                } = slot_;
1111            }
1112
1113            let _field = state.as_mut();
1114
1115            ::fidl_next::Decode::decode(state.as_mut(), decoder_, ())?;
1116
1117            Ok(())
1118        }
1119    }
1120
1121    impl<'de> ::fidl_next::IntoNatural for ViewRefFocusedWatchResponse<'de> {
1122        type Natural = crate::natural::ViewRefFocusedWatchResponse;
1123    }
1124
1125    /// The wire type corresponding to [`ViewRefInstalledWatchResponse`].
1126    pub type ViewRefInstalledWatchResponse = ::fidl_next::wire::Unit;
1127
1128    /// The wire type corresponding to [`ViewRefInstalledError`].
1129    #[derive(Clone, Copy, Debug, PartialEq, Eq)]
1130    #[repr(transparent)]
1131    pub struct ViewRefInstalledError {
1132        pub(crate) value: ::fidl_next::wire::Uint32,
1133    }
1134
1135    impl ::fidl_next::Constrained for ViewRefInstalledError {
1136        type Constraint = ();
1137
1138        fn validate(
1139            _: ::fidl_next::Slot<'_, Self>,
1140            _: Self::Constraint,
1141        ) -> Result<(), ::fidl_next::ValidationError> {
1142            Ok(())
1143        }
1144    }
1145
1146    unsafe impl ::fidl_next::Wire for ViewRefInstalledError {
1147        type Narrowed<'de> = Self;
1148
1149        #[inline]
1150        fn zero_padding(_: &mut ::core::mem::MaybeUninit<Self>) {
1151            // Wire enums have no padding
1152        }
1153    }
1154
1155    impl ViewRefInstalledError {
1156        pub const INVALID_VIEW_REF: ViewRefInstalledError =
1157            ViewRefInstalledError { value: ::fidl_next::wire::Uint32(1) };
1158    }
1159
1160    unsafe impl<___D> ::fidl_next::Decode<___D> for ViewRefInstalledError
1161    where
1162        ___D: ?Sized,
1163    {
1164        fn decode(
1165            slot: ::fidl_next::Slot<'_, Self>,
1166            _: &mut ___D,
1167            _: (),
1168        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1169            ::fidl_next::munge!(let Self { value } = slot);
1170
1171            match u32::from(*value) {
1172                1 => (),
1173                unknown => {
1174                    return Err(::fidl_next::DecodeError::InvalidEnumOrdinal(unknown as i128));
1175                }
1176            }
1177
1178            Ok(())
1179        }
1180    }
1181
1182    impl ::core::convert::From<crate::natural::ViewRefInstalledError> for ViewRefInstalledError {
1183        fn from(natural: crate::natural::ViewRefInstalledError) -> Self {
1184            match natural {
1185                crate::natural::ViewRefInstalledError::InvalidViewRef => {
1186                    ViewRefInstalledError::INVALID_VIEW_REF
1187                }
1188            }
1189        }
1190    }
1191
1192    impl ::fidl_next::IntoNatural for ViewRefInstalledError {
1193        type Natural = crate::natural::ViewRefInstalledError;
1194    }
1195}
1196
1197pub mod wire_optional {
1198
1199    #[repr(transparent)]
1200    pub struct Command {
1201        pub(crate) raw: ::fidl_next::wire::Union,
1202        pub(crate) _phantom: ::core::marker::PhantomData<()>,
1203    }
1204
1205    impl ::fidl_next::Constrained for Command {
1206        type Constraint = ();
1207
1208        fn validate(
1209            _: ::fidl_next::Slot<'_, Self>,
1210            _: Self::Constraint,
1211        ) -> Result<(), ::fidl_next::ValidationError> {
1212            Ok(())
1213        }
1214    }
1215
1216    unsafe impl ::fidl_next::Wire for Command {
1217        type Narrowed<'de> = Command;
1218
1219        #[inline]
1220        fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
1221            ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
1222            ::fidl_next::wire::Union::zero_padding(raw);
1223        }
1224    }
1225
1226    impl Command {
1227        pub fn is_some(&self) -> bool {
1228            self.raw.is_some()
1229        }
1230
1231        pub fn is_none(&self) -> bool {
1232            self.raw.is_none()
1233        }
1234
1235        pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::Command> {
1236            if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
1237        }
1238
1239        pub fn into_option(self) -> ::core::option::Option<crate::wire::Command> {
1240            if self.is_some() {
1241                Some(crate::wire::Command { raw: self.raw, _phantom: ::core::marker::PhantomData })
1242            } else {
1243                None
1244            }
1245        }
1246    }
1247
1248    impl Clone for Command {
1249        fn clone(&self) -> Self {
1250            if self.is_none() {
1251                return Command {
1252                    raw: ::fidl_next::wire::Union::absent(),
1253                    _phantom: ::core::marker::PhantomData,
1254                };
1255            }
1256
1257            match self.raw.ordinal() {
1258                1 => Self {
1259                    raw: unsafe { self.raw.clone_inline_unchecked::<::fidl_next::wire::Int32>() },
1260                    _phantom: ::core::marker::PhantomData,
1261                },
1262
1263                _ => unsafe { ::core::hint::unreachable_unchecked() },
1264            }
1265        }
1266    }
1267
1268    unsafe impl<___D> ::fidl_next::Decode<___D> for Command
1269    where
1270        ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1271    {
1272        fn decode(
1273            mut slot: ::fidl_next::Slot<'_, Self>,
1274            decoder: &mut ___D,
1275            _: (),
1276        ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1277            ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
1278            match ::fidl_next::wire::Union::encoded_ordinal(raw.as_mut()) {
1279                1 => ::fidl_next::wire::Union::decode_as_static::<___D, ::fidl_next::wire::Int32>(
1280                    raw,
1281                    decoder,
1282                    (),
1283                )?,
1284
1285                0 => ::fidl_next::wire::Union::decode_absent(raw)?,
1286                _ => ::fidl_next::wire::Union::decode_unknown_static(raw, decoder)?,
1287            }
1288
1289            Ok(())
1290        }
1291    }
1292
1293    impl ::core::fmt::Debug for Command {
1294        fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1295            self.as_ref().fmt(f)
1296        }
1297    }
1298
1299    impl ::fidl_next::IntoNatural for Command {
1300        type Natural = ::core::option::Option<crate::natural::Command>;
1301    }
1302}
1303
1304pub mod generic {
1305
1306    /// The generic type corresponding to [`FocuserRequestFocusResponse`].
1307    pub type FocuserRequestFocusResponse = ();
1308
1309    /// The generic type corresponding to [`FocuserSetAutoFocusResponse`].
1310    pub type FocuserSetAutoFocusResponse = ();
1311
1312    /// The generic type corresponding to [`ViewRefFocusedWatchResponse`].
1313    pub struct ViewRefFocusedWatchResponse<T0> {
1314        pub state: T0,
1315    }
1316
1317    unsafe impl<___E, T0>
1318        ::fidl_next::Encode<crate::wire::ViewRefFocusedWatchResponse<'static>, ___E>
1319        for ViewRefFocusedWatchResponse<T0>
1320    where
1321        ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1322        ___E: ::fidl_next::Encoder,
1323        T0: ::fidl_next::Encode<crate::wire::FocusState<'static>, ___E>,
1324    {
1325        #[inline]
1326        fn encode(
1327            self,
1328            encoder_: &mut ___E,
1329            out_: &mut ::core::mem::MaybeUninit<crate::wire::ViewRefFocusedWatchResponse<'static>>,
1330            _: (),
1331        ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1332            ::fidl_next::munge! {
1333                let crate::wire::ViewRefFocusedWatchResponse {
1334                    state,
1335
1336                } = out_;
1337            }
1338
1339            ::fidl_next::Encode::encode(self.state, encoder_, state, ())?;
1340
1341            Ok(())
1342        }
1343    }
1344
1345    /// The generic type corresponding to [`ViewRefInstalledWatchResponse`].
1346    pub type ViewRefInstalledWatchResponse = ();
1347}
1348
1349pub use self::natural::*;
1350
1351/// The type corresponding to the ViewRefFocused protocol.
1352#[doc = " A method of enabling a ViewRef creator to determine if its ViewRef has\n gained or lost focus in the view tree.\n\n The protocol client has implicit access to the ViewRef it created; the\n protocol itself does not accept a ViewRef parameter. Clients, both trusted\n or otherwise, need access to view-focus state, so the protocol is\n deliberately minimal. Possession of a ViewRef (and this protocol) does not\n grant the power to learn about a ViewRef\'s focus state.\n"]
1353#[derive(PartialEq, Debug)]
1354pub struct ViewRefFocused;
1355
1356#[cfg(target_os = "fuchsia")]
1357impl ::fidl_next::HasTransport for ViewRefFocused {
1358    type Transport = ::fidl_next::fuchsia::zx::Channel;
1359}
1360
1361pub mod view_ref_focused {
1362    pub mod prelude {
1363        pub use crate::{
1364            ViewRefFocused, ViewRefFocusedClientHandler, ViewRefFocusedLocalClientHandler,
1365            ViewRefFocusedLocalServerHandler, ViewRefFocusedServerHandler, view_ref_focused,
1366        };
1367
1368        pub use crate::natural::ViewRefFocusedWatchResponse;
1369    }
1370
1371    pub struct Watch;
1372
1373    impl ::fidl_next::Method for Watch {
1374        const ORDINAL: u64 = 4350003391021357493;
1375        const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1376            ::fidl_next::protocol::Flexibility::Strict;
1377
1378        type Protocol = crate::ViewRefFocused;
1379
1380        type Request = ::fidl_next::wire::EmptyMessageBody;
1381    }
1382
1383    impl ::fidl_next::TwoWayMethod for Watch {
1384        type Response =
1385            ::fidl_next::wire::Strict<crate::wire::ViewRefFocusedWatchResponse<'static>>;
1386    }
1387
1388    impl<___R> ::fidl_next::Respond<___R> for Watch {
1389        type Output = ::fidl_next::Strict<crate::generic::ViewRefFocusedWatchResponse<___R>>;
1390
1391        fn respond(response: ___R) -> Self::Output {
1392            ::fidl_next::Strict(crate::generic::ViewRefFocusedWatchResponse { state: response })
1393        }
1394    }
1395
1396    mod ___detail {
1397        unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::ViewRefFocused
1398        where
1399            ___T: ::fidl_next::Transport,
1400        {
1401            type Client = ViewRefFocusedClient<___T>;
1402            type Server = ViewRefFocusedServer<___T>;
1403        }
1404
1405        /// The client for the `ViewRefFocused` protocol.
1406        #[repr(transparent)]
1407        pub struct ViewRefFocusedClient<___T: ::fidl_next::Transport> {
1408            #[allow(dead_code)]
1409            client: ::fidl_next::protocol::Client<___T>,
1410        }
1411
1412        impl<___T> ViewRefFocusedClient<___T>
1413        where
1414            ___T: ::fidl_next::Transport,
1415        {
1416            #[doc = " Sets up a callback to fire when the implicit ViewRef has gained or lost\n focus. Typically, focus changes happen at a slow pace, such that every\n transition is captured by the callback. However, focus changes can\n happen rapidly, so the callback may \"compress\" focus change history into\n just the latest known focus state.\n\n The callback reports the last focus change spanning the duration from\n its issuance to the previous callback\'s issuance. The client may observe\n any of the following four transitions:\n - true -> true: The ViewRef has lost focus at least once, and has gained\n   focus by the time of callback issuance.\n - true -> false: The ViewRef has lost focus at least once, and has lost\n   focus by the time of callback issuance.\n - false -> true: The ViewRef has gained focus at least once, and has\n   gained focus by the time of callback issuance.\n - false -> false: The ViewRef has gained focus at least once, and has\n   lost focus by the time of callback issuance.\n\n The client avoids \"focus flapping\" and always sees the latest state.\n Every callback issuance is meaningful, and the client should renegotiate\n focus-related services appropriately, such as IME.\n\n Flow control: The caller is allowed at most one in-flight |Watch| call\n at at time: subsequent |Watch| calls must wait until the acknowledgment\n returns. Non-compliance results in channel closure.\n"]
1417            pub fn watch(&self) -> ::fidl_next::TwoWayFuture<'_, super::Watch, ___T> {
1418                ::fidl_next::TwoWayFuture::from_untyped(
1419                    self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1420                        4350003391021357493,
1421                        <super::Watch as ::fidl_next::Method>::FLEXIBILITY,
1422                        (),
1423                    ),
1424                )
1425            }
1426        }
1427
1428        /// The server for the `ViewRefFocused` protocol.
1429        #[repr(transparent)]
1430        pub struct ViewRefFocusedServer<___T: ::fidl_next::Transport> {
1431            server: ::fidl_next::protocol::Server<___T>,
1432        }
1433
1434        impl<___T> ViewRefFocusedServer<___T> where ___T: ::fidl_next::Transport {}
1435    }
1436}
1437
1438#[diagnostic::on_unimplemented(
1439    note = "If {Self} implements the non-local ViewRefFocusedClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1440)]
1441
1442/// A client handler for the ViewRefFocused protocol.
1443///
1444/// See [`ViewRefFocused`] for more details.
1445pub trait ViewRefFocusedLocalClientHandler<
1446    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1447    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1448>
1449{
1450}
1451
1452impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for ViewRefFocused
1453where
1454    ___H: ViewRefFocusedLocalClientHandler<___T>,
1455    ___T: ::fidl_next::Transport,
1456{
1457    async fn on_event(
1458        handler: &mut ___H,
1459        mut message: ::fidl_next::Message<___T>,
1460    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1461        match *message.header().ordinal {
1462            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1463        }
1464    }
1465}
1466
1467#[diagnostic::on_unimplemented(
1468    note = "If {Self} implements the non-local ViewRefFocusedServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1469)]
1470
1471/// A server handler for the ViewRefFocused protocol.
1472///
1473/// See [`ViewRefFocused`] for more details.
1474pub trait ViewRefFocusedLocalServerHandler<
1475    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1476    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1477>
1478{
1479    #[doc = " Sets up a callback to fire when the implicit ViewRef has gained or lost\n focus. Typically, focus changes happen at a slow pace, such that every\n transition is captured by the callback. However, focus changes can\n happen rapidly, so the callback may \"compress\" focus change history into\n just the latest known focus state.\n\n The callback reports the last focus change spanning the duration from\n its issuance to the previous callback\'s issuance. The client may observe\n any of the following four transitions:\n - true -> true: The ViewRef has lost focus at least once, and has gained\n   focus by the time of callback issuance.\n - true -> false: The ViewRef has lost focus at least once, and has lost\n   focus by the time of callback issuance.\n - false -> true: The ViewRef has gained focus at least once, and has\n   gained focus by the time of callback issuance.\n - false -> false: The ViewRef has gained focus at least once, and has\n   lost focus by the time of callback issuance.\n\n The client avoids \"focus flapping\" and always sees the latest state.\n Every callback issuance is meaningful, and the client should renegotiate\n focus-related services appropriately, such as IME.\n\n Flow control: The caller is allowed at most one in-flight |Watch| call\n at at time: subsequent |Watch| calls must wait until the acknowledgment\n returns. Non-compliance results in channel closure.\n"]
1480    fn watch(
1481        &mut self,
1482
1483        responder: ::fidl_next::Responder<view_ref_focused::Watch, ___T>,
1484    ) -> impl ::core::future::Future<Output = ()>;
1485}
1486
1487impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for ViewRefFocused
1488where
1489    ___H: ViewRefFocusedLocalServerHandler<___T>,
1490    ___T: ::fidl_next::Transport,
1491{
1492    async fn on_one_way(
1493        handler: &mut ___H,
1494        mut message: ::fidl_next::Message<___T>,
1495    ) -> ::core::result::Result<
1496        (),
1497        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1498    > {
1499        match *message.header().ordinal {
1500            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1501        }
1502    }
1503
1504    async fn on_two_way(
1505        handler: &mut ___H,
1506        mut message: ::fidl_next::Message<___T>,
1507        responder: ::fidl_next::protocol::Responder<___T>,
1508    ) -> ::core::result::Result<
1509        (),
1510        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1511    > {
1512        match *message.header().ordinal {
1513            4350003391021357493 => {
1514                let responder = ::fidl_next::Responder::from_untyped(responder);
1515
1516                handler.watch(responder).await;
1517                Ok(())
1518            }
1519
1520            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1521        }
1522    }
1523}
1524
1525/// A client handler for the ViewRefFocused protocol.
1526///
1527/// See [`ViewRefFocused`] for more details.
1528pub trait ViewRefFocusedClientHandler<
1529    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1530    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1531>
1532{
1533}
1534
1535impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for ViewRefFocused
1536where
1537    ___H: ViewRefFocusedClientHandler<___T> + ::core::marker::Send,
1538    ___T: ::fidl_next::Transport,
1539{
1540    async fn on_event(
1541        handler: &mut ___H,
1542        mut message: ::fidl_next::Message<___T>,
1543    ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1544        match *message.header().ordinal {
1545            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1546        }
1547    }
1548}
1549
1550/// A server handler for the ViewRefFocused protocol.
1551///
1552/// See [`ViewRefFocused`] for more details.
1553pub trait ViewRefFocusedServerHandler<
1554    #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1555    #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1556>
1557{
1558    #[doc = " Sets up a callback to fire when the implicit ViewRef has gained or lost\n focus. Typically, focus changes happen at a slow pace, such that every\n transition is captured by the callback. However, focus changes can\n happen rapidly, so the callback may \"compress\" focus change history into\n just the latest known focus state.\n\n The callback reports the last focus change spanning the duration from\n its issuance to the previous callback\'s issuance. The client may observe\n any of the following four transitions:\n - true -> true: The ViewRef has lost focus at least once, and has gained\n   focus by the time of callback issuance.\n - true -> false: The ViewRef has lost focus at least once, and has lost\n   focus by the time of callback issuance.\n - false -> true: The ViewRef has gained focus at least once, and has\n   gained focus by the time of callback issuance.\n - false -> false: The ViewRef has gained focus at least once, and has\n   lost focus by the time of callback issuance.\n\n The client avoids \"focus flapping\" and always sees the latest state.\n Every callback issuance is meaningful, and the client should renegotiate\n focus-related services appropriately, such as IME.\n\n Flow control: The caller is allowed at most one in-flight |Watch| call\n at at time: subsequent |Watch| calls must wait until the acknowledgment\n returns. Non-compliance results in channel closure.\n"]
1559    fn watch(
1560        &mut self,
1561
1562        responder: ::fidl_next::Responder<view_ref_focused::Watch, ___T>,
1563    ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1564}
1565
1566impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for ViewRefFocused
1567where
1568    ___H: ViewRefFocusedServerHandler<___T> + ::core::marker::Send,
1569    ___T: ::fidl_next::Transport,
1570{
1571    async fn on_one_way(
1572        handler: &mut ___H,
1573        mut message: ::fidl_next::Message<___T>,
1574    ) -> ::core::result::Result<
1575        (),
1576        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1577    > {
1578        match *message.header().ordinal {
1579            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1580        }
1581    }
1582
1583    async fn on_two_way(
1584        handler: &mut ___H,
1585        mut message: ::fidl_next::Message<___T>,
1586        responder: ::fidl_next::protocol::Responder<___T>,
1587    ) -> ::core::result::Result<
1588        (),
1589        ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1590    > {
1591        match *message.header().ordinal {
1592            4350003391021357493 => {
1593                let responder = ::fidl_next::Responder::from_untyped(responder);
1594
1595                handler.watch(responder).await;
1596                Ok(())
1597            }
1598
1599            ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
1600        }
1601    }
1602}
1603
1604impl<___T> ViewRefFocusedClientHandler<___T> for ::fidl_next::IgnoreEvents where
1605    ___T: ::fidl_next::Transport
1606{
1607}
1608
1609impl<___H, ___T> ViewRefFocusedLocalClientHandler<___T> for ::fidl_next::Local<___H>
1610where
1611    ___H: ViewRefFocusedClientHandler<___T>,
1612    ___T: ::fidl_next::Transport,
1613{
1614}
1615
1616impl<___H, ___T> ViewRefFocusedLocalServerHandler<___T> for ::fidl_next::Local<___H>
1617where
1618    ___H: ViewRefFocusedServerHandler<___T>,
1619    ___T: ::fidl_next::Transport,
1620{
1621    async fn watch(&mut self, responder: ::fidl_next::Responder<view_ref_focused::Watch, ___T>) {
1622        ___H::watch(&mut self.0, responder).await
1623    }
1624}