fidl_fuchsia_examples_intl_wisdom/
fidl_fuchsia_examples_intl_wisdom.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, PartialEq)]
14pub struct IntlWisdomServerAskForWisdomRequest {
15    pub intl_profile: fidl_fuchsia_intl::Profile,
16    pub timestamp_ms: i64,
17}
18
19impl fidl::Persistable for IntlWisdomServerAskForWisdomRequest {}
20
21#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct IntlWisdomServerAskForWisdomResponse {
23    pub response: Option<String>,
24}
25
26impl fidl::Persistable for IntlWisdomServerAskForWisdomResponse {}
27
28#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
29pub struct IntlWisdomServer_Marker;
30
31impl fidl::endpoints::ProtocolMarker for IntlWisdomServer_Marker {
32    type Proxy = IntlWisdomServer_Proxy;
33    type RequestStream = IntlWisdomServer_RequestStream;
34    #[cfg(target_os = "fuchsia")]
35    type SynchronousProxy = IntlWisdomServer_SynchronousProxy;
36
37    const DEBUG_NAME: &'static str = "fuchsia.examples.intl.wisdom.IntlWisdomServer";
38}
39impl fidl::endpoints::DiscoverableProtocolMarker for IntlWisdomServer_Marker {}
40
41pub trait IntlWisdomServer_ProxyInterface: Send + Sync {
42    type AskForWisdomResponseFut: std::future::Future<Output = Result<Option<String>, fidl::Error>>
43        + Send;
44    fn r#ask_for_wisdom(
45        &self,
46        intl_profile: &fidl_fuchsia_intl::Profile,
47        timestamp_ms: i64,
48    ) -> Self::AskForWisdomResponseFut;
49}
50#[derive(Debug)]
51#[cfg(target_os = "fuchsia")]
52pub struct IntlWisdomServer_SynchronousProxy {
53    client: fidl::client::sync::Client,
54}
55
56#[cfg(target_os = "fuchsia")]
57impl fidl::endpoints::SynchronousProxy for IntlWisdomServer_SynchronousProxy {
58    type Proxy = IntlWisdomServer_Proxy;
59    type Protocol = IntlWisdomServer_Marker;
60
61    fn from_channel(inner: fidl::Channel) -> Self {
62        Self::new(inner)
63    }
64
65    fn into_channel(self) -> fidl::Channel {
66        self.client.into_channel()
67    }
68
69    fn as_channel(&self) -> &fidl::Channel {
70        self.client.as_channel()
71    }
72}
73
74#[cfg(target_os = "fuchsia")]
75impl IntlWisdomServer_SynchronousProxy {
76    pub fn new(channel: fidl::Channel) -> Self {
77        let protocol_name =
78            <IntlWisdomServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
79        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
80    }
81
82    pub fn into_channel(self) -> fidl::Channel {
83        self.client.into_channel()
84    }
85
86    /// Waits until an event arrives and returns it. It is safe for other
87    /// threads to make concurrent requests while waiting for an event.
88    pub fn wait_for_event(
89        &self,
90        deadline: zx::MonotonicInstant,
91    ) -> Result<IntlWisdomServer_Event, fidl::Error> {
92        IntlWisdomServer_Event::decode(self.client.wait_for_event(deadline)?)
93    }
94
95    /// Asks for a wisdom string.
96    ///
97    /// Params:
98    ///   intl_profile: Provides the i18n context for the request
99    ///   timestamp_ms: Timestamp in milliseconds since the epoch. Used as an input for the wisdom
100    ///   text.
101    pub fn r#ask_for_wisdom(
102        &self,
103        mut intl_profile: &fidl_fuchsia_intl::Profile,
104        mut timestamp_ms: i64,
105        ___deadline: zx::MonotonicInstant,
106    ) -> Result<Option<String>, fidl::Error> {
107        let _response = self.client.send_query::<
108            IntlWisdomServerAskForWisdomRequest,
109            IntlWisdomServerAskForWisdomResponse,
110        >(
111            (intl_profile, timestamp_ms,),
112            0x5cf6236faa84a3cf,
113            fidl::encoding::DynamicFlags::empty(),
114            ___deadline,
115        )?;
116        Ok(_response.response)
117    }
118}
119
120#[derive(Debug, Clone)]
121pub struct IntlWisdomServer_Proxy {
122    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
123}
124
125impl fidl::endpoints::Proxy for IntlWisdomServer_Proxy {
126    type Protocol = IntlWisdomServer_Marker;
127
128    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
129        Self::new(inner)
130    }
131
132    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
133        self.client.into_channel().map_err(|client| Self { client })
134    }
135
136    fn as_channel(&self) -> &::fidl::AsyncChannel {
137        self.client.as_channel()
138    }
139}
140
141impl IntlWisdomServer_Proxy {
142    /// Create a new Proxy for fuchsia.examples.intl.wisdom/IntlWisdomServer.
143    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
144        let protocol_name =
145            <IntlWisdomServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
146        Self { client: fidl::client::Client::new(channel, protocol_name) }
147    }
148
149    /// Get a Stream of events from the remote end of the protocol.
150    ///
151    /// # Panics
152    ///
153    /// Panics if the event stream was already taken.
154    pub fn take_event_stream(&self) -> IntlWisdomServer_EventStream {
155        IntlWisdomServer_EventStream { event_receiver: self.client.take_event_receiver() }
156    }
157
158    /// Asks for a wisdom string.
159    ///
160    /// Params:
161    ///   intl_profile: Provides the i18n context for the request
162    ///   timestamp_ms: Timestamp in milliseconds since the epoch. Used as an input for the wisdom
163    ///   text.
164    pub fn r#ask_for_wisdom(
165        &self,
166        mut intl_profile: &fidl_fuchsia_intl::Profile,
167        mut timestamp_ms: i64,
168    ) -> fidl::client::QueryResponseFut<Option<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
169    {
170        IntlWisdomServer_ProxyInterface::r#ask_for_wisdom(self, intl_profile, timestamp_ms)
171    }
172}
173
174impl IntlWisdomServer_ProxyInterface for IntlWisdomServer_Proxy {
175    type AskForWisdomResponseFut = fidl::client::QueryResponseFut<
176        Option<String>,
177        fidl::encoding::DefaultFuchsiaResourceDialect,
178    >;
179    fn r#ask_for_wisdom(
180        &self,
181        mut intl_profile: &fidl_fuchsia_intl::Profile,
182        mut timestamp_ms: i64,
183    ) -> Self::AskForWisdomResponseFut {
184        fn _decode(
185            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
186        ) -> Result<Option<String>, fidl::Error> {
187            let _response = fidl::client::decode_transaction_body::<
188                IntlWisdomServerAskForWisdomResponse,
189                fidl::encoding::DefaultFuchsiaResourceDialect,
190                0x5cf6236faa84a3cf,
191            >(_buf?)?;
192            Ok(_response.response)
193        }
194        self.client.send_query_and_decode::<IntlWisdomServerAskForWisdomRequest, Option<String>>(
195            (intl_profile, timestamp_ms),
196            0x5cf6236faa84a3cf,
197            fidl::encoding::DynamicFlags::empty(),
198            _decode,
199        )
200    }
201}
202
203pub struct IntlWisdomServer_EventStream {
204    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
205}
206
207impl std::marker::Unpin for IntlWisdomServer_EventStream {}
208
209impl futures::stream::FusedStream for IntlWisdomServer_EventStream {
210    fn is_terminated(&self) -> bool {
211        self.event_receiver.is_terminated()
212    }
213}
214
215impl futures::Stream for IntlWisdomServer_EventStream {
216    type Item = Result<IntlWisdomServer_Event, fidl::Error>;
217
218    fn poll_next(
219        mut self: std::pin::Pin<&mut Self>,
220        cx: &mut std::task::Context<'_>,
221    ) -> std::task::Poll<Option<Self::Item>> {
222        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
223            &mut self.event_receiver,
224            cx
225        )?) {
226            Some(buf) => std::task::Poll::Ready(Some(IntlWisdomServer_Event::decode(buf))),
227            None => std::task::Poll::Ready(None),
228        }
229    }
230}
231
232#[derive(Debug)]
233pub enum IntlWisdomServer_Event {}
234
235impl IntlWisdomServer_Event {
236    /// Decodes a message buffer as a [`IntlWisdomServer_Event`].
237    fn decode(
238        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
239    ) -> Result<IntlWisdomServer_Event, fidl::Error> {
240        let (bytes, _handles) = buf.split_mut();
241        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
242        debug_assert_eq!(tx_header.tx_id, 0);
243        match tx_header.ordinal {
244            _ => Err(fidl::Error::UnknownOrdinal {
245                ordinal: tx_header.ordinal,
246                protocol_name:
247                    <IntlWisdomServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
248            }),
249        }
250    }
251}
252
253/// A Stream of incoming requests for fuchsia.examples.intl.wisdom/IntlWisdomServer.
254pub struct IntlWisdomServer_RequestStream {
255    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
256    is_terminated: bool,
257}
258
259impl std::marker::Unpin for IntlWisdomServer_RequestStream {}
260
261impl futures::stream::FusedStream for IntlWisdomServer_RequestStream {
262    fn is_terminated(&self) -> bool {
263        self.is_terminated
264    }
265}
266
267impl fidl::endpoints::RequestStream for IntlWisdomServer_RequestStream {
268    type Protocol = IntlWisdomServer_Marker;
269    type ControlHandle = IntlWisdomServer_ControlHandle;
270
271    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
272        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
273    }
274
275    fn control_handle(&self) -> Self::ControlHandle {
276        IntlWisdomServer_ControlHandle { inner: self.inner.clone() }
277    }
278
279    fn into_inner(
280        self,
281    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
282    {
283        (self.inner, self.is_terminated)
284    }
285
286    fn from_inner(
287        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
288        is_terminated: bool,
289    ) -> Self {
290        Self { inner, is_terminated }
291    }
292}
293
294impl futures::Stream for IntlWisdomServer_RequestStream {
295    type Item = Result<IntlWisdomServer_Request, fidl::Error>;
296
297    fn poll_next(
298        mut self: std::pin::Pin<&mut Self>,
299        cx: &mut std::task::Context<'_>,
300    ) -> std::task::Poll<Option<Self::Item>> {
301        let this = &mut *self;
302        if this.inner.check_shutdown(cx) {
303            this.is_terminated = true;
304            return std::task::Poll::Ready(None);
305        }
306        if this.is_terminated {
307            panic!("polled IntlWisdomServer_RequestStream after completion");
308        }
309        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
310            |bytes, handles| {
311                match this.inner.channel().read_etc(cx, bytes, handles) {
312                    std::task::Poll::Ready(Ok(())) => {}
313                    std::task::Poll::Pending => return std::task::Poll::Pending,
314                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
315                        this.is_terminated = true;
316                        return std::task::Poll::Ready(None);
317                    }
318                    std::task::Poll::Ready(Err(e)) => {
319                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
320                            e.into(),
321                        ))))
322                    }
323                }
324
325                // A message has been received from the channel
326                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
327
328                std::task::Poll::Ready(Some(match header.ordinal {
329                    0x5cf6236faa84a3cf => {
330                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
331                        let mut req = fidl::new_empty!(
332                            IntlWisdomServerAskForWisdomRequest,
333                            fidl::encoding::DefaultFuchsiaResourceDialect
334                        );
335                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<IntlWisdomServerAskForWisdomRequest>(&header, _body_bytes, handles, &mut req)?;
336                        let control_handle =
337                            IntlWisdomServer_ControlHandle { inner: this.inner.clone() };
338                        Ok(IntlWisdomServer_Request::AskForWisdom {
339                            intl_profile: req.intl_profile,
340                            timestamp_ms: req.timestamp_ms,
341
342                            responder: IntlWisdomServer_AskForWisdomResponder {
343                                control_handle: std::mem::ManuallyDrop::new(control_handle),
344                                tx_id: header.tx_id,
345                            },
346                        })
347                    }
348                    _ => Err(fidl::Error::UnknownOrdinal {
349                        ordinal: header.ordinal,
350                        protocol_name:
351                            <IntlWisdomServer_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
352                    }),
353                }))
354            },
355        )
356    }
357}
358
359/// Interface for a service that, given a `fuchsia.intl.Profile` and some basic parameters, can
360/// provide pithy strings of wisdom to demonstrate the use of `Profile`.
361#[derive(Debug)]
362pub enum IntlWisdomServer_Request {
363    /// Asks for a wisdom string.
364    ///
365    /// Params:
366    ///   intl_profile: Provides the i18n context for the request
367    ///   timestamp_ms: Timestamp in milliseconds since the epoch. Used as an input for the wisdom
368    ///   text.
369    AskForWisdom {
370        intl_profile: fidl_fuchsia_intl::Profile,
371        timestamp_ms: i64,
372        responder: IntlWisdomServer_AskForWisdomResponder,
373    },
374}
375
376impl IntlWisdomServer_Request {
377    #[allow(irrefutable_let_patterns)]
378    pub fn into_ask_for_wisdom(
379        self,
380    ) -> Option<(fidl_fuchsia_intl::Profile, i64, IntlWisdomServer_AskForWisdomResponder)> {
381        if let IntlWisdomServer_Request::AskForWisdom { intl_profile, timestamp_ms, responder } =
382            self
383        {
384            Some((intl_profile, timestamp_ms, responder))
385        } else {
386            None
387        }
388    }
389
390    /// Name of the method defined in FIDL
391    pub fn method_name(&self) -> &'static str {
392        match *self {
393            IntlWisdomServer_Request::AskForWisdom { .. } => "ask_for_wisdom",
394        }
395    }
396}
397
398#[derive(Debug, Clone)]
399pub struct IntlWisdomServer_ControlHandle {
400    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
401}
402
403impl fidl::endpoints::ControlHandle for IntlWisdomServer_ControlHandle {
404    fn shutdown(&self) {
405        self.inner.shutdown()
406    }
407    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
408        self.inner.shutdown_with_epitaph(status)
409    }
410
411    fn is_closed(&self) -> bool {
412        self.inner.channel().is_closed()
413    }
414    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
415        self.inner.channel().on_closed()
416    }
417
418    #[cfg(target_os = "fuchsia")]
419    fn signal_peer(
420        &self,
421        clear_mask: zx::Signals,
422        set_mask: zx::Signals,
423    ) -> Result<(), zx_status::Status> {
424        use fidl::Peered;
425        self.inner.channel().signal_peer(clear_mask, set_mask)
426    }
427}
428
429impl IntlWisdomServer_ControlHandle {}
430
431#[must_use = "FIDL methods require a response to be sent"]
432#[derive(Debug)]
433pub struct IntlWisdomServer_AskForWisdomResponder {
434    control_handle: std::mem::ManuallyDrop<IntlWisdomServer_ControlHandle>,
435    tx_id: u32,
436}
437
438/// Set the the channel to be shutdown (see [`IntlWisdomServer_ControlHandle::shutdown`])
439/// if the responder is dropped without sending a response, so that the client
440/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
441impl std::ops::Drop for IntlWisdomServer_AskForWisdomResponder {
442    fn drop(&mut self) {
443        self.control_handle.shutdown();
444        // Safety: drops once, never accessed again
445        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
446    }
447}
448
449impl fidl::endpoints::Responder for IntlWisdomServer_AskForWisdomResponder {
450    type ControlHandle = IntlWisdomServer_ControlHandle;
451
452    fn control_handle(&self) -> &IntlWisdomServer_ControlHandle {
453        &self.control_handle
454    }
455
456    fn drop_without_shutdown(mut self) {
457        // Safety: drops once, never accessed again due to mem::forget
458        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
459        // Prevent Drop from running (which would shut down the channel)
460        std::mem::forget(self);
461    }
462}
463
464impl IntlWisdomServer_AskForWisdomResponder {
465    /// Sends a response to the FIDL transaction.
466    ///
467    /// Sets the channel to shutdown if an error occurs.
468    pub fn send(self, mut response: Option<&str>) -> Result<(), fidl::Error> {
469        let _result = self.send_raw(response);
470        if _result.is_err() {
471            self.control_handle.shutdown();
472        }
473        self.drop_without_shutdown();
474        _result
475    }
476
477    /// Similar to "send" but does not shutdown the channel if an error occurs.
478    pub fn send_no_shutdown_on_err(self, mut response: Option<&str>) -> Result<(), fidl::Error> {
479        let _result = self.send_raw(response);
480        self.drop_without_shutdown();
481        _result
482    }
483
484    fn send_raw(&self, mut response: Option<&str>) -> Result<(), fidl::Error> {
485        self.control_handle.inner.send::<IntlWisdomServerAskForWisdomResponse>(
486            (response,),
487            self.tx_id,
488            0x5cf6236faa84a3cf,
489            fidl::encoding::DynamicFlags::empty(),
490        )
491    }
492}
493
494mod internal {
495    use super::*;
496
497    impl fidl::encoding::ValueTypeMarker for IntlWisdomServerAskForWisdomRequest {
498        type Borrowed<'a> = &'a Self;
499        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
500            value
501        }
502    }
503
504    unsafe impl fidl::encoding::TypeMarker for IntlWisdomServerAskForWisdomRequest {
505        type Owned = Self;
506
507        #[inline(always)]
508        fn inline_align(_context: fidl::encoding::Context) -> usize {
509            8
510        }
511
512        #[inline(always)]
513        fn inline_size(_context: fidl::encoding::Context) -> usize {
514            24
515        }
516    }
517
518    unsafe impl<D: fidl::encoding::ResourceDialect>
519        fidl::encoding::Encode<IntlWisdomServerAskForWisdomRequest, D>
520        for &IntlWisdomServerAskForWisdomRequest
521    {
522        #[inline]
523        unsafe fn encode(
524            self,
525            encoder: &mut fidl::encoding::Encoder<'_, D>,
526            offset: usize,
527            _depth: fidl::encoding::Depth,
528        ) -> fidl::Result<()> {
529            encoder.debug_check_bounds::<IntlWisdomServerAskForWisdomRequest>(offset);
530            // Delegate to tuple encoding.
531            fidl::encoding::Encode::<IntlWisdomServerAskForWisdomRequest, D>::encode(
532                (
533                    <fidl_fuchsia_intl::Profile as fidl::encoding::ValueTypeMarker>::borrow(
534                        &self.intl_profile,
535                    ),
536                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timestamp_ms),
537                ),
538                encoder,
539                offset,
540                _depth,
541            )
542        }
543    }
544    unsafe impl<
545            D: fidl::encoding::ResourceDialect,
546            T0: fidl::encoding::Encode<fidl_fuchsia_intl::Profile, D>,
547            T1: fidl::encoding::Encode<i64, D>,
548        > fidl::encoding::Encode<IntlWisdomServerAskForWisdomRequest, D> for (T0, T1)
549    {
550        #[inline]
551        unsafe fn encode(
552            self,
553            encoder: &mut fidl::encoding::Encoder<'_, D>,
554            offset: usize,
555            depth: fidl::encoding::Depth,
556        ) -> fidl::Result<()> {
557            encoder.debug_check_bounds::<IntlWisdomServerAskForWisdomRequest>(offset);
558            // Zero out padding regions. There's no need to apply masks
559            // because the unmasked parts will be overwritten by fields.
560            // Write the fields.
561            self.0.encode(encoder, offset + 0, depth)?;
562            self.1.encode(encoder, offset + 16, depth)?;
563            Ok(())
564        }
565    }
566
567    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
568        for IntlWisdomServerAskForWisdomRequest
569    {
570        #[inline(always)]
571        fn new_empty() -> Self {
572            Self {
573                intl_profile: fidl::new_empty!(fidl_fuchsia_intl::Profile, D),
574                timestamp_ms: fidl::new_empty!(i64, D),
575            }
576        }
577
578        #[inline]
579        unsafe fn decode(
580            &mut self,
581            decoder: &mut fidl::encoding::Decoder<'_, D>,
582            offset: usize,
583            _depth: fidl::encoding::Depth,
584        ) -> fidl::Result<()> {
585            decoder.debug_check_bounds::<Self>(offset);
586            // Verify that padding bytes are zero.
587            fidl::decode!(
588                fidl_fuchsia_intl::Profile,
589                D,
590                &mut self.intl_profile,
591                decoder,
592                offset + 0,
593                _depth
594            )?;
595            fidl::decode!(i64, D, &mut self.timestamp_ms, decoder, offset + 16, _depth)?;
596            Ok(())
597        }
598    }
599
600    impl fidl::encoding::ValueTypeMarker for IntlWisdomServerAskForWisdomResponse {
601        type Borrowed<'a> = &'a Self;
602        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
603            value
604        }
605    }
606
607    unsafe impl fidl::encoding::TypeMarker for IntlWisdomServerAskForWisdomResponse {
608        type Owned = Self;
609
610        #[inline(always)]
611        fn inline_align(_context: fidl::encoding::Context) -> usize {
612            8
613        }
614
615        #[inline(always)]
616        fn inline_size(_context: fidl::encoding::Context) -> usize {
617            16
618        }
619    }
620
621    unsafe impl<D: fidl::encoding::ResourceDialect>
622        fidl::encoding::Encode<IntlWisdomServerAskForWisdomResponse, D>
623        for &IntlWisdomServerAskForWisdomResponse
624    {
625        #[inline]
626        unsafe fn encode(
627            self,
628            encoder: &mut fidl::encoding::Encoder<'_, D>,
629            offset: usize,
630            _depth: fidl::encoding::Depth,
631        ) -> fidl::Result<()> {
632            encoder.debug_check_bounds::<IntlWisdomServerAskForWisdomResponse>(offset);
633            // Delegate to tuple encoding.
634            fidl::encoding::Encode::<IntlWisdomServerAskForWisdomResponse, D>::encode(
635                (
636                    <fidl::encoding::Optional<fidl::encoding::UnboundedString> as fidl::encoding::ValueTypeMarker>::borrow(&self.response),
637                ),
638                encoder, offset, _depth
639            )
640        }
641    }
642    unsafe impl<
643            D: fidl::encoding::ResourceDialect,
644            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::UnboundedString>, D>,
645        > fidl::encoding::Encode<IntlWisdomServerAskForWisdomResponse, D> for (T0,)
646    {
647        #[inline]
648        unsafe fn encode(
649            self,
650            encoder: &mut fidl::encoding::Encoder<'_, D>,
651            offset: usize,
652            depth: fidl::encoding::Depth,
653        ) -> fidl::Result<()> {
654            encoder.debug_check_bounds::<IntlWisdomServerAskForWisdomResponse>(offset);
655            // Zero out padding regions. There's no need to apply masks
656            // because the unmasked parts will be overwritten by fields.
657            // Write the fields.
658            self.0.encode(encoder, offset + 0, depth)?;
659            Ok(())
660        }
661    }
662
663    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
664        for IntlWisdomServerAskForWisdomResponse
665    {
666        #[inline(always)]
667        fn new_empty() -> Self {
668            Self {
669                response: fidl::new_empty!(
670                    fidl::encoding::Optional<fidl::encoding::UnboundedString>,
671                    D
672                ),
673            }
674        }
675
676        #[inline]
677        unsafe fn decode(
678            &mut self,
679            decoder: &mut fidl::encoding::Decoder<'_, D>,
680            offset: usize,
681            _depth: fidl::encoding::Depth,
682        ) -> fidl::Result<()> {
683            decoder.debug_check_bounds::<Self>(offset);
684            // Verify that padding bytes are zero.
685            fidl::decode!(
686                fidl::encoding::Optional<fidl::encoding::UnboundedString>,
687                D,
688                &mut self.response,
689                decoder,
690                offset + 0,
691                _depth
692            )?;
693            Ok(())
694        }
695    }
696}