Skip to main content

fidl_fuchsia_fuzzer/
fidl_fuchsia_fuzzer.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_fuzzer__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControllerAddMonitorRequest {
16    pub monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for ControllerAddMonitorRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct ControllerAddToCorpusRequest {
26    pub corpus: Corpus,
27    pub input: Input,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for ControllerAddToCorpusRequest
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct ControllerCleanseRequest {
37    pub test_input: Input,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerCleanseRequest {}
41
42#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub struct ControllerMinimizeRequest {
44    pub test_input: Input,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerMinimizeRequest {}
48
49#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct ControllerProviderConnectRequest {
51    pub controller: fidl::endpoints::ServerEnd<ControllerMarker>,
52}
53
54impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
55    for ControllerProviderConnectRequest
56{
57}
58
59#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
60pub struct ControllerReadCorpusRequest {
61    pub corpus: Corpus,
62    pub corpus_reader: fidl::endpoints::ClientEnd<CorpusReaderMarker>,
63}
64
65impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
66    for ControllerReadCorpusRequest
67{
68}
69
70#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
71pub struct ControllerReadDictionaryResponse {
72    pub dictionary: Input,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
76    for ControllerReadDictionaryResponse
77{
78}
79
80#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
81pub struct ControllerTryOneRequest {
82    pub test_input: Input,
83}
84
85impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControllerTryOneRequest {}
86
87#[derive(Debug, PartialEq)]
88pub struct ControllerWatchArtifactResponse {
89    pub artifact: Artifact,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
93    for ControllerWatchArtifactResponse
94{
95}
96
97#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct ControllerWriteDictionaryRequest {
99    pub dictionary: Input,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
103    for ControllerWriteDictionaryRequest
104{
105}
106
107#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
108pub struct CorpusReaderNextRequest {
109    pub test_input: Input,
110}
111
112impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CorpusReaderNextRequest {}
113
114/// Represents an instrumented target process or the code coverage it is sharing.
115#[derive(Debug, PartialEq)]
116pub struct CoverageData {
117    pub target_id: u64,
118    pub data: Data,
119}
120
121impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CoverageData {}
122
123#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
124pub struct CoverageDataCollectorAddInline8bitCountersRequest {
125    pub inline_8bit_counters: fidl::Vmo,
126}
127
128impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
129    for CoverageDataCollectorAddInline8bitCountersRequest
130{
131}
132
133#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
134pub struct CoverageDataCollectorInitializeRequest {
135    pub eventpair: fidl::EventPair,
136    pub process: fidl::Process,
137}
138
139impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
140    for CoverageDataCollectorInitializeRequest
141{
142}
143
144#[derive(Debug, PartialEq)]
145pub struct CoverageDataProviderWatchCoverageDataResponse {
146    pub coverage_data: Vec<CoverageData>,
147}
148
149impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
150    for CoverageDataProviderWatchCoverageDataResponse
151{
152}
153
154/// Encapsulation of a fuzzer input transferred over a socket, e.g. between a
155/// host and device via overnet.
156#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
157pub struct Input {
158    /// Socket that can be used to read the data.
159    pub socket: fidl::Socket,
160    /// The total amount of data to be transferred.
161    pub size: u64,
162}
163
164impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Input {}
165
166/// Represents an instrumented target process under test.
167///
168/// This struct wraps the eventpair and process provided to `CoverageDataCollector.Initialize` and
169/// associates it with a unique per-`CoverageDataCollector`-client target id.
170#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
171pub struct InstrumentedProcess {
172    pub eventpair: fidl::EventPair,
173    pub process: fidl::Process,
174}
175
176impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InstrumentedProcess {}
177
178#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
179pub struct ManagerConnectRequest {
180    pub fuzzer_url: String,
181    pub controller: fidl::endpoints::ServerEnd<ControllerMarker>,
182}
183
184impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ManagerConnectRequest {}
185
186#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
187pub struct ManagerGetOutputRequest {
188    pub fuzzer_url: String,
189    pub output: TestOutput,
190    pub socket: fidl::Socket,
191}
192
193impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ManagerGetOutputRequest {}
194
195#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
196pub struct RegistrarRegisterRequest {
197    pub fuzzer_url: String,
198    pub provider: fidl::endpoints::ClientEnd<ControllerProviderMarker>,
199}
200
201impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RegistrarRegisterRequest {}
202
203#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
204pub struct RegistryConnectRequest {
205    pub fuzzer_url: String,
206    pub controller: fidl::endpoints::ServerEnd<ControllerMarker>,
207    pub timeout: i64,
208}
209
210impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RegistryConnectRequest {}
211
212#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
213pub struct TargetAdapterConnectRequest {
214    pub eventpair: fidl::EventPair,
215    pub test_input: fidl::Vmo,
216}
217
218impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
219    for TargetAdapterConnectRequest
220{
221}
222
223/// Encapsulates the result of a long-running fuzzing workflow and optionally
224/// the input that caused it, depending on the workflow.
225#[derive(Debug, Default, PartialEq)]
226pub struct Artifact {
227    /// Result of executing the long-running workflow.
228    pub result: Option<Result_>,
229    /// Optional fuzzer input produced by a specific long-running workflow. This
230    /// may be:
231    ///
232    /// * A discovered input in the case of `Fuzz`
233    /// * A constructed input in the cases of `Cleanse` and `Minimize`.
234    /// * Omitted in the cases of `TryOne` and `Merge`.
235    pub input: Option<Input>,
236    /// An error generated during a long-running workflow. These errors are
237    /// distinct from those that result from validating workflow requests and
238    /// are documented for the workflow methods below. These errors result from
239    /// unexpected framework failure. For example, if libFuzzer fails due to an
240    /// internal error, the engine will report it via this field.
241    ///
242    /// The `result` and `input` fields are invalid if this field is present and
243    /// anything other than `ZX_OK`.
244    pub error: Option<i32>,
245    #[doc(hidden)]
246    pub __source_breaking: fidl::marker::SourceBreaking,
247}
248
249impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Artifact {}
250
251#[derive(Debug)]
252pub enum Data {
253    /// An instrumented target process under test.
254    Instrumented(InstrumentedProcess),
255    /// See https://clang.llvm.org/docs/SanitizerCoverage.html#inline-8bit-counters
256    Inline8bitCounters(fidl::Vmo),
257    #[doc(hidden)]
258    __SourceBreaking { unknown_ordinal: u64 },
259}
260
261/// Pattern that matches an unknown `Data` member.
262#[macro_export]
263macro_rules! DataUnknown {
264    () => {
265        _
266    };
267}
268
269// Custom PartialEq so that unknown variants are not equal to themselves.
270impl PartialEq for Data {
271    fn eq(&self, other: &Self) -> bool {
272        match (self, other) {
273            (Self::Instrumented(x), Self::Instrumented(y)) => *x == *y,
274            (Self::Inline8bitCounters(x), Self::Inline8bitCounters(y)) => *x == *y,
275            _ => false,
276        }
277    }
278}
279
280impl Data {
281    #[inline]
282    pub fn ordinal(&self) -> u64 {
283        match *self {
284            Self::Instrumented(_) => 1,
285            Self::Inline8bitCounters(_) => 2,
286            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
287        }
288    }
289
290    #[inline]
291    pub fn unknown_variant_for_testing() -> Self {
292        Self::__SourceBreaking { unknown_ordinal: 0 }
293    }
294
295    #[inline]
296    pub fn is_unknown(&self) -> bool {
297        match self {
298            Self::__SourceBreaking { .. } => true,
299            _ => false,
300        }
301    }
302}
303
304impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Data {}
305
306#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
307pub struct ControllerMarker;
308
309impl fidl::endpoints::ProtocolMarker for ControllerMarker {
310    type Proxy = ControllerProxy;
311    type RequestStream = ControllerRequestStream;
312    #[cfg(target_os = "fuchsia")]
313    type SynchronousProxy = ControllerSynchronousProxy;
314
315    const DEBUG_NAME: &'static str = "(anonymous) Controller";
316}
317pub type ControllerConfigureResult = Result<(), i32>;
318pub type ControllerAddToCorpusResult = Result<(), i32>;
319pub type ControllerWriteDictionaryResult = Result<(), i32>;
320pub type ControllerFuzzResult = Result<(), i32>;
321pub type ControllerTryOneResult = Result<(), i32>;
322pub type ControllerMinimizeResult = Result<(), i32>;
323pub type ControllerCleanseResult = Result<(), i32>;
324pub type ControllerMergeResult = Result<(), i32>;
325
326pub trait ControllerProxyInterface: Send + Sync {
327    type ConfigureResponseFut: std::future::Future<Output = Result<ControllerConfigureResult, fidl::Error>>
328        + Send;
329    fn r#configure(&self, options: &Options) -> Self::ConfigureResponseFut;
330    type GetOptionsResponseFut: std::future::Future<Output = Result<Options, fidl::Error>> + Send;
331    fn r#get_options(&self) -> Self::GetOptionsResponseFut;
332    type AddToCorpusResponseFut: std::future::Future<Output = Result<ControllerAddToCorpusResult, fidl::Error>>
333        + Send;
334    fn r#add_to_corpus(&self, corpus: Corpus, input: Input) -> Self::AddToCorpusResponseFut;
335    type ReadCorpusResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
336    fn r#read_corpus(
337        &self,
338        corpus: Corpus,
339        corpus_reader: fidl::endpoints::ClientEnd<CorpusReaderMarker>,
340    ) -> Self::ReadCorpusResponseFut;
341    type WriteDictionaryResponseFut: std::future::Future<Output = Result<ControllerWriteDictionaryResult, fidl::Error>>
342        + Send;
343    fn r#write_dictionary(&self, dictionary: Input) -> Self::WriteDictionaryResponseFut;
344    type ReadDictionaryResponseFut: std::future::Future<Output = Result<Input, fidl::Error>> + Send;
345    fn r#read_dictionary(&self) -> Self::ReadDictionaryResponseFut;
346    type AddMonitorResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
347    fn r#add_monitor(
348        &self,
349        monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
350    ) -> Self::AddMonitorResponseFut;
351    type FuzzResponseFut: std::future::Future<Output = Result<ControllerFuzzResult, fidl::Error>>
352        + Send;
353    fn r#fuzz(&self) -> Self::FuzzResponseFut;
354    type TryOneResponseFut: std::future::Future<Output = Result<ControllerTryOneResult, fidl::Error>>
355        + Send;
356    fn r#try_one(&self, test_input: Input) -> Self::TryOneResponseFut;
357    type MinimizeResponseFut: std::future::Future<Output = Result<ControllerMinimizeResult, fidl::Error>>
358        + Send;
359    fn r#minimize(&self, test_input: Input) -> Self::MinimizeResponseFut;
360    type CleanseResponseFut: std::future::Future<Output = Result<ControllerCleanseResult, fidl::Error>>
361        + Send;
362    fn r#cleanse(&self, test_input: Input) -> Self::CleanseResponseFut;
363    type MergeResponseFut: std::future::Future<Output = Result<ControllerMergeResult, fidl::Error>>
364        + Send;
365    fn r#merge(&self) -> Self::MergeResponseFut;
366    type GetStatusResponseFut: std::future::Future<Output = Result<Status, fidl::Error>> + Send;
367    fn r#get_status(&self) -> Self::GetStatusResponseFut;
368    type WatchArtifactResponseFut: std::future::Future<Output = Result<Artifact, fidl::Error>>
369        + Send;
370    fn r#watch_artifact(&self) -> Self::WatchArtifactResponseFut;
371}
372#[derive(Debug)]
373#[cfg(target_os = "fuchsia")]
374pub struct ControllerSynchronousProxy {
375    client: fidl::client::sync::Client,
376}
377
378#[cfg(target_os = "fuchsia")]
379impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
380    type Proxy = ControllerProxy;
381    type Protocol = ControllerMarker;
382
383    fn from_channel(inner: fidl::Channel) -> Self {
384        Self::new(inner)
385    }
386
387    fn into_channel(self) -> fidl::Channel {
388        self.client.into_channel()
389    }
390
391    fn as_channel(&self) -> &fidl::Channel {
392        self.client.as_channel()
393    }
394}
395
396#[cfg(target_os = "fuchsia")]
397impl ControllerSynchronousProxy {
398    pub fn new(channel: fidl::Channel) -> Self {
399        Self { client: fidl::client::sync::Client::new(channel) }
400    }
401
402    pub fn into_channel(self) -> fidl::Channel {
403        self.client.into_channel()
404    }
405
406    /// Waits until an event arrives and returns it. It is safe for other
407    /// threads to make concurrent requests while waiting for an event.
408    pub fn wait_for_event(
409        &self,
410        deadline: zx::MonotonicInstant,
411    ) -> Result<ControllerEvent, fidl::Error> {
412        ControllerEvent::decode(self.client.wait_for_event::<ControllerMarker>(deadline)?)
413    }
414
415    /// Sets various execution and error detection parameters. This may be
416    /// called multiple times; only the most recently received options are used.
417    /// If the `Options` parameter omits one or more fields, those parameters
418    /// are unchanged in the fuzzer. Until the initial call to this method, the
419    /// fuzzer should assume the default values for `Options`.
420    ///
421    /// + request `options` the execution and error detection parameters.
422    /// * error one of the following:
423    /// * error
424    ///     * `ZX_ERR_BAD_STATE` if a long-running call such as `Execute`,
425    ///       `Cleanse`, `Minimize`, `Fuzz`, or `Merge` is in progress.
426    ///     * `ZX_ERR_NOT_SUPPORTED` if a value provided for an option is not
427    ///       supported by the engine. Check the logs for additional details.
428    pub fn r#configure(
429        &self,
430        mut options: &Options,
431        ___deadline: zx::MonotonicInstant,
432    ) -> Result<ControllerConfigureResult, fidl::Error> {
433        let _response = self.client.send_query::<
434            ControllerConfigureRequest,
435            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
436            ControllerMarker,
437        >(
438            (options,),
439            0x35c8cba7fa3d32e4,
440            fidl::encoding::DynamicFlags::empty(),
441            ___deadline,
442        )?;
443        Ok(_response.map(|x| x))
444    }
445
446    /// Gets the current values for the various execution and error detection
447    /// parameters.
448    ///
449    /// - response `options` the execution and error detection parameters.
450    pub fn r#get_options(&self, ___deadline: zx::MonotonicInstant) -> Result<Options, fidl::Error> {
451        let _response = self.client.send_query::<
452            fidl::encoding::EmptyPayload,
453            ControllerGetOptionsResponse,
454            ControllerMarker,
455        >(
456            (),
457            0x683d93332504b9cd,
458            fidl::encoding::DynamicFlags::empty(),
459            ___deadline,
460        )?;
461        Ok(_response.options)
462    }
463
464    /// Writes the provided `input` to either the "seed" or "live" `corpus`.
465    /// Returns an error if transferring the input fails; see `Input` for
466    /// details.
467    ///
468    /// + request `corpus` the type of corpus to add to.
469    /// + request `input` the sequence of bytes to add as a test input.
470    /// * error one of the following:
471    ///     * `ZX_ERR_INVALID_ARGS` if corpus type is invalid.
472    ///     * A socket error if transferring the input fails.
473    pub fn r#add_to_corpus(
474        &self,
475        mut corpus: Corpus,
476        mut input: Input,
477        ___deadline: zx::MonotonicInstant,
478    ) -> Result<ControllerAddToCorpusResult, fidl::Error> {
479        let _response = self.client.send_query::<
480            ControllerAddToCorpusRequest,
481            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
482            ControllerMarker,
483        >(
484            (corpus, &mut input,),
485            0x7bdf8336ab534cee,
486            fidl::encoding::DynamicFlags::empty(),
487            ___deadline,
488        )?;
489        Ok(_response.map(|x| x))
490    }
491
492    /// Connects a `corpus_reader` for either the "seed" or "live" corpus.
493    ///
494    /// + request `corpus` the type of corpus to read from.
495    /// + request `corpus_reader` the client used to send test inputs.
496    pub fn r#read_corpus(
497        &self,
498        mut corpus: Corpus,
499        mut corpus_reader: fidl::endpoints::ClientEnd<CorpusReaderMarker>,
500        ___deadline: zx::MonotonicInstant,
501    ) -> Result<(), fidl::Error> {
502        let _response = self.client.send_query::<
503            ControllerReadCorpusRequest,
504            fidl::encoding::EmptyPayload,
505            ControllerMarker,
506        >(
507            (corpus, corpus_reader,),
508            0x501279b430b34514,
509            fidl::encoding::DynamicFlags::empty(),
510            ___deadline,
511        )?;
512        Ok(_response)
513    }
514
515    /// Parses and loads an AFL-style dictionary. Invalid entries are logged and
516    /// skipped.
517    ///
518    /// See also:
519    ///
520    /// * https://github.com/mirrorer/afl/blob/master/dictionaries/README.dictionaries
521    ///
522    /// + request `dictionary` the AFL-style dictionary
523    /// * error one of the following:
524    ///     * A socket error if transferring the input fails.
525    ///     *`ZX_ERR_INVALID_ARGS` if parsing the dictionary fails.
526    pub fn r#write_dictionary(
527        &self,
528        mut dictionary: Input,
529        ___deadline: zx::MonotonicInstant,
530    ) -> Result<ControllerWriteDictionaryResult, fidl::Error> {
531        let _response = self.client.send_query::<
532            ControllerWriteDictionaryRequest,
533            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
534            ControllerMarker,
535        >(
536            (&mut dictionary,),
537            0x4ecfc1274fe4a70b,
538            fidl::encoding::DynamicFlags::empty(),
539            ___deadline,
540        )?;
541        Ok(_response.map(|x| x))
542    }
543
544    /// Returns the current dictionary as an Input, which may be empty.
545    ///
546    /// - response `dictionary` the current AFL-style dictionary.
547    pub fn r#read_dictionary(
548        &self,
549        ___deadline: zx::MonotonicInstant,
550    ) -> Result<Input, fidl::Error> {
551        let _response = self.client.send_query::<
552            fidl::encoding::EmptyPayload,
553            ControllerReadDictionaryResponse,
554            ControllerMarker,
555        >(
556            (),
557            0x1be6724c87b51c37,
558            fidl::encoding::DynamicFlags::empty(),
559            ___deadline,
560        )?;
561        Ok(_response.dictionary)
562    }
563
564    /// Installs a `Monitor` to push status. To pull status instead, use
565    /// `GetStatus`.
566    ///
567    /// + request `monitor` the client used to send status updates.
568    pub fn r#add_monitor(
569        &self,
570        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
571        ___deadline: zx::MonotonicInstant,
572    ) -> Result<(), fidl::Error> {
573        let _response = self.client.send_query::<
574            ControllerAddMonitorRequest,
575            fidl::encoding::EmptyPayload,
576            ControllerMarker,
577        >(
578            (monitor,),
579            0x2efbf7d3dc21438e,
580            fidl::encoding::DynamicFlags::empty(),
581            ___deadline,
582        )?;
583        Ok(_response)
584    }
585
586    /// Runs the normal fuzzing feedback loop:
587    ///
588    /// 1. Selects an input from the corpus.
589    /// 2. Mutates the input.
590    /// 3. Uses the `TargetAdapter` to execute the input.
591    /// 4. Checks feedback from the `InstrumentedProcesses`.
592    /// 5. If the input produced useful feedback, adds it to the corpus.
593    ///
594    /// This call returns quickly, but the loop continues until one of three
595    /// conditions is met:
596    ///
597    /// 1. The configured, non-zero number of `runs` has been reached.
598    /// 2. The configured, non-zero `duration` elapses.
599    /// 3. An error is detected, and returned.
600    ///
601    /// See `Result` for more details on long running workflows such as this
602    /// one.
603    ///
604    /// * error `ZX_ERR_BAD_STATE` if another long-running workflow is in
605    ///   progress.
606    pub fn r#fuzz(
607        &self,
608        ___deadline: zx::MonotonicInstant,
609    ) -> Result<ControllerFuzzResult, fidl::Error> {
610        let _response = self.client.send_query::<
611            fidl::encoding::EmptyPayload,
612            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
613            ControllerMarker,
614        >(
615            (),
616            0x62fe3684ea23af62,
617            fidl::encoding::DynamicFlags::empty(),
618            ___deadline,
619        )?;
620        Ok(_response.map(|x| x))
621    }
622
623    /// Executes the target code with a single `test_input`.
624    ///
625    /// See `Result` for more details on long running workflows such as this
626    /// one.
627    ///
628    /// + request `input` the sequence of bytes to use with the fuzz target.
629    /// * error one of the following:
630    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
631    ///       progress.
632    ///     *  A socket error if transferring the input fails.
633    pub fn r#try_one(
634        &self,
635        mut test_input: Input,
636        ___deadline: zx::MonotonicInstant,
637    ) -> Result<ControllerTryOneResult, fidl::Error> {
638        let _response = self.client.send_query::<
639            ControllerTryOneRequest,
640            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
641            ControllerMarker,
642        >(
643            (&mut test_input,),
644            0x368dc762d8e16d46,
645            fidl::encoding::DynamicFlags::empty(),
646            ___deadline,
647        )?;
648        Ok(_response.map(|x| x))
649    }
650
651    /// Attempts to find the smallest input that produces the same error as the
652    /// given `test_input`,
653    /// constrained by the configured `total_time` and/or `runs` options.
654    ///
655    /// See `Result` for more details on long running workflows such as this
656    /// one.
657    ///
658    /// + request `input` the sequence of bytes to minimize.
659    /// * error one of the following:
660    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
661    ///       progress.
662    ///     * A socket error if transferring the input fails.
663    ///     * `ZX_ERR_INVALID_ARGS` if the provided `test_input` does not cause
664    ///       an error.
665    pub fn r#minimize(
666        &self,
667        mut test_input: Input,
668        ___deadline: zx::MonotonicInstant,
669    ) -> Result<ControllerMinimizeResult, fidl::Error> {
670        let _response = self.client.send_query::<
671            ControllerMinimizeRequest,
672            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
673            ControllerMarker,
674        >(
675            (&mut test_input,),
676            0x105a242ee0552794,
677            fidl::encoding::DynamicFlags::empty(),
678            ___deadline,
679        )?;
680        Ok(_response.map(|x| x))
681    }
682
683    /// Attempts to replace bytes of the given `test_input` with "filler" bytes,
684    /// e.g. \x00, \xFF, without changing the error produced.
685    ///
686    /// See `Result` for more details on long running workflows such as this
687    /// one.
688    ///
689    /// To preserve backwards compatibility with libFuzzer and ClusterFuzz, an
690    /// input that produces no result is *not* considered an error, and is
691    /// returned as-is.
692    ///
693    /// + request `input` the sequence of bytes to cleanse.
694    /// * error one of the following:
695    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
696    ///       progress.
697    ///     * A socket error if transferring the input fails.
698    pub fn r#cleanse(
699        &self,
700        mut test_input: Input,
701        ___deadline: zx::MonotonicInstant,
702    ) -> Result<ControllerCleanseResult, fidl::Error> {
703        let _response = self.client.send_query::<
704            ControllerCleanseRequest,
705            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
706            ControllerMarker,
707        >(
708            (&mut test_input,),
709            0x6d7892f62735f3e0,
710            fidl::encoding::DynamicFlags::empty(),
711            ___deadline,
712        )?;
713        Ok(_response.map(|x| x))
714    }
715
716    /// Attempts to shrink the corpora. Inputs from the seed corpus will be
717    /// preserved. All other inputs will be sorted by amount of feedback
718    /// produced and input size, and only those inputs that add new feedback not
719    /// seen earlier in the sequence will be kept.
720    ///
721    /// See `Result` for more details on long running workflows such as this
722    /// one.
723    ///
724    /// * error one of the following:
725    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
726    ///       progress.
727    ///     * `ZX_ERR_INVALID_ARGS` if an input in the seed corpus causes an
728    ///       error. Inputs in the live corpus that cause errors are skipped.
729    pub fn r#merge(
730        &self,
731        ___deadline: zx::MonotonicInstant,
732    ) -> Result<ControllerMergeResult, fidl::Error> {
733        let _response = self.client.send_query::<
734            fidl::encoding::EmptyPayload,
735            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
736            ControllerMarker,
737        >(
738            (),
739            0x3614e5c39413b5eb,
740            fidl::encoding::DynamicFlags::empty(),
741            ___deadline,
742        )?;
743        Ok(_response.map(|x| x))
744    }
745
746    /// Returns various fuzzing metrics, e.g. total coverage, speed, etc.
747    ///
748    /// - response `status` the current value of fuzzing metrics.
749    pub fn r#get_status(&self, ___deadline: zx::MonotonicInstant) -> Result<Status, fidl::Error> {
750        let _response = self.client.send_query::<
751            fidl::encoding::EmptyPayload,
752            ControllerGetStatusResponse,
753            ControllerMarker,
754        >(
755            (),
756            0x51db4975d93ce768,
757            fidl::encoding::DynamicFlags::empty(),
758            ___deadline,
759        )?;
760        Ok(_response.status)
761    }
762
763    /// Returns the results of a long-running workflow.
764    ///
765    /// This method uses the
766    /// ["hanging get" pattern](https://fuchsia.dev/fuchsia-src/development/api/fidl#hanging-get).
767    /// Upon the first call for a given connection, it will immediately return
768    /// the controller's current artifact. Upon subsequent calls, it will block
769    /// until the controller's artifact changes before returning. Clients should
770    /// use `GetStatus` to ensure the fuzzer is not idle before making a
771    /// blocking call to `WatchArtifact`.
772    ///
773    /// Combined with the `Status.running` value obtained from `GetStatus`, this
774    /// allows a (re-)connecting client to infer the state of the fuzzer:
775    ///
776    /// * If the fuzzer is idle and has an empty artifact, then it is
777    ///   unchanged since the last connection, if any.
778    /// * If the fuzzer is running and has an empty artifact, then it is
779    ///   performing a long-running workflow started by a previous connection.
780    ///   The client may call `WatchArtifact` again to wait for the workflow
781    ///   to complete.
782    /// * If the fuzzer is idle and has a non-empty artifact, then it has
783    ///   completed a long-running workflow since the last connection.
784    ///
785    /// It is not an error for clients to disconnect while waiting for a
786    /// response from this method. This method is intended to allow clients to
787    /// resume waiting for a long-running workflow to complete after
788    /// intentionally or inadvertently being disconnected for an indefinite
789    /// amount of time.
790    ///
791    /// - response `artifact` the most recent result and/or error-causing input.
792    pub fn r#watch_artifact(
793        &self,
794        ___deadline: zx::MonotonicInstant,
795    ) -> Result<Artifact, fidl::Error> {
796        let _response = self.client.send_query::<
797            fidl::encoding::EmptyPayload,
798            ControllerWatchArtifactResponse,
799            ControllerMarker,
800        >(
801            (),
802            0x6cfca3730944a414,
803            fidl::encoding::DynamicFlags::empty(),
804            ___deadline,
805        )?;
806        Ok(_response.artifact)
807    }
808}
809
810#[cfg(target_os = "fuchsia")]
811impl From<ControllerSynchronousProxy> for zx::NullableHandle {
812    fn from(value: ControllerSynchronousProxy) -> Self {
813        value.into_channel().into()
814    }
815}
816
817#[cfg(target_os = "fuchsia")]
818impl From<fidl::Channel> for ControllerSynchronousProxy {
819    fn from(value: fidl::Channel) -> Self {
820        Self::new(value)
821    }
822}
823
824#[cfg(target_os = "fuchsia")]
825impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
826    type Protocol = ControllerMarker;
827
828    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
829        Self::new(value.into_channel())
830    }
831}
832
833#[derive(Debug, Clone)]
834pub struct ControllerProxy {
835    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
836}
837
838impl fidl::endpoints::Proxy for ControllerProxy {
839    type Protocol = ControllerMarker;
840
841    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
842        Self::new(inner)
843    }
844
845    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
846        self.client.into_channel().map_err(|client| Self { client })
847    }
848
849    fn as_channel(&self) -> &::fidl::AsyncChannel {
850        self.client.as_channel()
851    }
852}
853
854impl ControllerProxy {
855    /// Create a new Proxy for fuchsia.fuzzer/Controller.
856    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
857        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
858        Self { client: fidl::client::Client::new(channel, protocol_name) }
859    }
860
861    /// Get a Stream of events from the remote end of the protocol.
862    ///
863    /// # Panics
864    ///
865    /// Panics if the event stream was already taken.
866    pub fn take_event_stream(&self) -> ControllerEventStream {
867        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
868    }
869
870    /// Sets various execution and error detection parameters. This may be
871    /// called multiple times; only the most recently received options are used.
872    /// If the `Options` parameter omits one or more fields, those parameters
873    /// are unchanged in the fuzzer. Until the initial call to this method, the
874    /// fuzzer should assume the default values for `Options`.
875    ///
876    /// + request `options` the execution and error detection parameters.
877    /// * error one of the following:
878    /// * error
879    ///     * `ZX_ERR_BAD_STATE` if a long-running call such as `Execute`,
880    ///       `Cleanse`, `Minimize`, `Fuzz`, or `Merge` is in progress.
881    ///     * `ZX_ERR_NOT_SUPPORTED` if a value provided for an option is not
882    ///       supported by the engine. Check the logs for additional details.
883    pub fn r#configure(
884        &self,
885        mut options: &Options,
886    ) -> fidl::client::QueryResponseFut<
887        ControllerConfigureResult,
888        fidl::encoding::DefaultFuchsiaResourceDialect,
889    > {
890        ControllerProxyInterface::r#configure(self, options)
891    }
892
893    /// Gets the current values for the various execution and error detection
894    /// parameters.
895    ///
896    /// - response `options` the execution and error detection parameters.
897    pub fn r#get_options(
898        &self,
899    ) -> fidl::client::QueryResponseFut<Options, fidl::encoding::DefaultFuchsiaResourceDialect>
900    {
901        ControllerProxyInterface::r#get_options(self)
902    }
903
904    /// Writes the provided `input` to either the "seed" or "live" `corpus`.
905    /// Returns an error if transferring the input fails; see `Input` for
906    /// details.
907    ///
908    /// + request `corpus` the type of corpus to add to.
909    /// + request `input` the sequence of bytes to add as a test input.
910    /// * error one of the following:
911    ///     * `ZX_ERR_INVALID_ARGS` if corpus type is invalid.
912    ///     * A socket error if transferring the input fails.
913    pub fn r#add_to_corpus(
914        &self,
915        mut corpus: Corpus,
916        mut input: Input,
917    ) -> fidl::client::QueryResponseFut<
918        ControllerAddToCorpusResult,
919        fidl::encoding::DefaultFuchsiaResourceDialect,
920    > {
921        ControllerProxyInterface::r#add_to_corpus(self, corpus, input)
922    }
923
924    /// Connects a `corpus_reader` for either the "seed" or "live" corpus.
925    ///
926    /// + request `corpus` the type of corpus to read from.
927    /// + request `corpus_reader` the client used to send test inputs.
928    pub fn r#read_corpus(
929        &self,
930        mut corpus: Corpus,
931        mut corpus_reader: fidl::endpoints::ClientEnd<CorpusReaderMarker>,
932    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
933        ControllerProxyInterface::r#read_corpus(self, corpus, corpus_reader)
934    }
935
936    /// Parses and loads an AFL-style dictionary. Invalid entries are logged and
937    /// skipped.
938    ///
939    /// See also:
940    ///
941    /// * https://github.com/mirrorer/afl/blob/master/dictionaries/README.dictionaries
942    ///
943    /// + request `dictionary` the AFL-style dictionary
944    /// * error one of the following:
945    ///     * A socket error if transferring the input fails.
946    ///     *`ZX_ERR_INVALID_ARGS` if parsing the dictionary fails.
947    pub fn r#write_dictionary(
948        &self,
949        mut dictionary: Input,
950    ) -> fidl::client::QueryResponseFut<
951        ControllerWriteDictionaryResult,
952        fidl::encoding::DefaultFuchsiaResourceDialect,
953    > {
954        ControllerProxyInterface::r#write_dictionary(self, dictionary)
955    }
956
957    /// Returns the current dictionary as an Input, which may be empty.
958    ///
959    /// - response `dictionary` the current AFL-style dictionary.
960    pub fn r#read_dictionary(
961        &self,
962    ) -> fidl::client::QueryResponseFut<Input, fidl::encoding::DefaultFuchsiaResourceDialect> {
963        ControllerProxyInterface::r#read_dictionary(self)
964    }
965
966    /// Installs a `Monitor` to push status. To pull status instead, use
967    /// `GetStatus`.
968    ///
969    /// + request `monitor` the client used to send status updates.
970    pub fn r#add_monitor(
971        &self,
972        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
973    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
974        ControllerProxyInterface::r#add_monitor(self, monitor)
975    }
976
977    /// Runs the normal fuzzing feedback loop:
978    ///
979    /// 1. Selects an input from the corpus.
980    /// 2. Mutates the input.
981    /// 3. Uses the `TargetAdapter` to execute the input.
982    /// 4. Checks feedback from the `InstrumentedProcesses`.
983    /// 5. If the input produced useful feedback, adds it to the corpus.
984    ///
985    /// This call returns quickly, but the loop continues until one of three
986    /// conditions is met:
987    ///
988    /// 1. The configured, non-zero number of `runs` has been reached.
989    /// 2. The configured, non-zero `duration` elapses.
990    /// 3. An error is detected, and returned.
991    ///
992    /// See `Result` for more details on long running workflows such as this
993    /// one.
994    ///
995    /// * error `ZX_ERR_BAD_STATE` if another long-running workflow is in
996    ///   progress.
997    pub fn r#fuzz(
998        &self,
999    ) -> fidl::client::QueryResponseFut<
1000        ControllerFuzzResult,
1001        fidl::encoding::DefaultFuchsiaResourceDialect,
1002    > {
1003        ControllerProxyInterface::r#fuzz(self)
1004    }
1005
1006    /// Executes the target code with a single `test_input`.
1007    ///
1008    /// See `Result` for more details on long running workflows such as this
1009    /// one.
1010    ///
1011    /// + request `input` the sequence of bytes to use with the fuzz target.
1012    /// * error one of the following:
1013    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
1014    ///       progress.
1015    ///     *  A socket error if transferring the input fails.
1016    pub fn r#try_one(
1017        &self,
1018        mut test_input: Input,
1019    ) -> fidl::client::QueryResponseFut<
1020        ControllerTryOneResult,
1021        fidl::encoding::DefaultFuchsiaResourceDialect,
1022    > {
1023        ControllerProxyInterface::r#try_one(self, test_input)
1024    }
1025
1026    /// Attempts to find the smallest input that produces the same error as the
1027    /// given `test_input`,
1028    /// constrained by the configured `total_time` and/or `runs` options.
1029    ///
1030    /// See `Result` for more details on long running workflows such as this
1031    /// one.
1032    ///
1033    /// + request `input` the sequence of bytes to minimize.
1034    /// * error one of the following:
1035    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
1036    ///       progress.
1037    ///     * A socket error if transferring the input fails.
1038    ///     * `ZX_ERR_INVALID_ARGS` if the provided `test_input` does not cause
1039    ///       an error.
1040    pub fn r#minimize(
1041        &self,
1042        mut test_input: Input,
1043    ) -> fidl::client::QueryResponseFut<
1044        ControllerMinimizeResult,
1045        fidl::encoding::DefaultFuchsiaResourceDialect,
1046    > {
1047        ControllerProxyInterface::r#minimize(self, test_input)
1048    }
1049
1050    /// Attempts to replace bytes of the given `test_input` with "filler" bytes,
1051    /// e.g. \x00, \xFF, without changing the error produced.
1052    ///
1053    /// See `Result` for more details on long running workflows such as this
1054    /// one.
1055    ///
1056    /// To preserve backwards compatibility with libFuzzer and ClusterFuzz, an
1057    /// input that produces no result is *not* considered an error, and is
1058    /// returned as-is.
1059    ///
1060    /// + request `input` the sequence of bytes to cleanse.
1061    /// * error one of the following:
1062    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
1063    ///       progress.
1064    ///     * A socket error if transferring the input fails.
1065    pub fn r#cleanse(
1066        &self,
1067        mut test_input: Input,
1068    ) -> fidl::client::QueryResponseFut<
1069        ControllerCleanseResult,
1070        fidl::encoding::DefaultFuchsiaResourceDialect,
1071    > {
1072        ControllerProxyInterface::r#cleanse(self, test_input)
1073    }
1074
1075    /// Attempts to shrink the corpora. Inputs from the seed corpus will be
1076    /// preserved. All other inputs will be sorted by amount of feedback
1077    /// produced and input size, and only those inputs that add new feedback not
1078    /// seen earlier in the sequence will be kept.
1079    ///
1080    /// See `Result` for more details on long running workflows such as this
1081    /// one.
1082    ///
1083    /// * error one of the following:
1084    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
1085    ///       progress.
1086    ///     * `ZX_ERR_INVALID_ARGS` if an input in the seed corpus causes an
1087    ///       error. Inputs in the live corpus that cause errors are skipped.
1088    pub fn r#merge(
1089        &self,
1090    ) -> fidl::client::QueryResponseFut<
1091        ControllerMergeResult,
1092        fidl::encoding::DefaultFuchsiaResourceDialect,
1093    > {
1094        ControllerProxyInterface::r#merge(self)
1095    }
1096
1097    /// Returns various fuzzing metrics, e.g. total coverage, speed, etc.
1098    ///
1099    /// - response `status` the current value of fuzzing metrics.
1100    pub fn r#get_status(
1101        &self,
1102    ) -> fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect> {
1103        ControllerProxyInterface::r#get_status(self)
1104    }
1105
1106    /// Returns the results of a long-running workflow.
1107    ///
1108    /// This method uses the
1109    /// ["hanging get" pattern](https://fuchsia.dev/fuchsia-src/development/api/fidl#hanging-get).
1110    /// Upon the first call for a given connection, it will immediately return
1111    /// the controller's current artifact. Upon subsequent calls, it will block
1112    /// until the controller's artifact changes before returning. Clients should
1113    /// use `GetStatus` to ensure the fuzzer is not idle before making a
1114    /// blocking call to `WatchArtifact`.
1115    ///
1116    /// Combined with the `Status.running` value obtained from `GetStatus`, this
1117    /// allows a (re-)connecting client to infer the state of the fuzzer:
1118    ///
1119    /// * If the fuzzer is idle and has an empty artifact, then it is
1120    ///   unchanged since the last connection, if any.
1121    /// * If the fuzzer is running and has an empty artifact, then it is
1122    ///   performing a long-running workflow started by a previous connection.
1123    ///   The client may call `WatchArtifact` again to wait for the workflow
1124    ///   to complete.
1125    /// * If the fuzzer is idle and has a non-empty artifact, then it has
1126    ///   completed a long-running workflow since the last connection.
1127    ///
1128    /// It is not an error for clients to disconnect while waiting for a
1129    /// response from this method. This method is intended to allow clients to
1130    /// resume waiting for a long-running workflow to complete after
1131    /// intentionally or inadvertently being disconnected for an indefinite
1132    /// amount of time.
1133    ///
1134    /// - response `artifact` the most recent result and/or error-causing input.
1135    pub fn r#watch_artifact(
1136        &self,
1137    ) -> fidl::client::QueryResponseFut<Artifact, fidl::encoding::DefaultFuchsiaResourceDialect>
1138    {
1139        ControllerProxyInterface::r#watch_artifact(self)
1140    }
1141}
1142
1143impl ControllerProxyInterface for ControllerProxy {
1144    type ConfigureResponseFut = fidl::client::QueryResponseFut<
1145        ControllerConfigureResult,
1146        fidl::encoding::DefaultFuchsiaResourceDialect,
1147    >;
1148    fn r#configure(&self, mut options: &Options) -> Self::ConfigureResponseFut {
1149        fn _decode(
1150            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1151        ) -> Result<ControllerConfigureResult, fidl::Error> {
1152            let _response = fidl::client::decode_transaction_body::<
1153                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1154                fidl::encoding::DefaultFuchsiaResourceDialect,
1155                0x35c8cba7fa3d32e4,
1156            >(_buf?)?;
1157            Ok(_response.map(|x| x))
1158        }
1159        self.client.send_query_and_decode::<ControllerConfigureRequest, ControllerConfigureResult>(
1160            (options,),
1161            0x35c8cba7fa3d32e4,
1162            fidl::encoding::DynamicFlags::empty(),
1163            _decode,
1164        )
1165    }
1166
1167    type GetOptionsResponseFut =
1168        fidl::client::QueryResponseFut<Options, fidl::encoding::DefaultFuchsiaResourceDialect>;
1169    fn r#get_options(&self) -> Self::GetOptionsResponseFut {
1170        fn _decode(
1171            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1172        ) -> Result<Options, fidl::Error> {
1173            let _response = fidl::client::decode_transaction_body::<
1174                ControllerGetOptionsResponse,
1175                fidl::encoding::DefaultFuchsiaResourceDialect,
1176                0x683d93332504b9cd,
1177            >(_buf?)?;
1178            Ok(_response.options)
1179        }
1180        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Options>(
1181            (),
1182            0x683d93332504b9cd,
1183            fidl::encoding::DynamicFlags::empty(),
1184            _decode,
1185        )
1186    }
1187
1188    type AddToCorpusResponseFut = fidl::client::QueryResponseFut<
1189        ControllerAddToCorpusResult,
1190        fidl::encoding::DefaultFuchsiaResourceDialect,
1191    >;
1192    fn r#add_to_corpus(
1193        &self,
1194        mut corpus: Corpus,
1195        mut input: Input,
1196    ) -> Self::AddToCorpusResponseFut {
1197        fn _decode(
1198            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1199        ) -> Result<ControllerAddToCorpusResult, fidl::Error> {
1200            let _response = fidl::client::decode_transaction_body::<
1201                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1202                fidl::encoding::DefaultFuchsiaResourceDialect,
1203                0x7bdf8336ab534cee,
1204            >(_buf?)?;
1205            Ok(_response.map(|x| x))
1206        }
1207        self.client
1208            .send_query_and_decode::<ControllerAddToCorpusRequest, ControllerAddToCorpusResult>(
1209                (corpus, &mut input),
1210                0x7bdf8336ab534cee,
1211                fidl::encoding::DynamicFlags::empty(),
1212                _decode,
1213            )
1214    }
1215
1216    type ReadCorpusResponseFut =
1217        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1218    fn r#read_corpus(
1219        &self,
1220        mut corpus: Corpus,
1221        mut corpus_reader: fidl::endpoints::ClientEnd<CorpusReaderMarker>,
1222    ) -> Self::ReadCorpusResponseFut {
1223        fn _decode(
1224            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1225        ) -> Result<(), fidl::Error> {
1226            let _response = fidl::client::decode_transaction_body::<
1227                fidl::encoding::EmptyPayload,
1228                fidl::encoding::DefaultFuchsiaResourceDialect,
1229                0x501279b430b34514,
1230            >(_buf?)?;
1231            Ok(_response)
1232        }
1233        self.client.send_query_and_decode::<ControllerReadCorpusRequest, ()>(
1234            (corpus, corpus_reader),
1235            0x501279b430b34514,
1236            fidl::encoding::DynamicFlags::empty(),
1237            _decode,
1238        )
1239    }
1240
1241    type WriteDictionaryResponseFut = fidl::client::QueryResponseFut<
1242        ControllerWriteDictionaryResult,
1243        fidl::encoding::DefaultFuchsiaResourceDialect,
1244    >;
1245    fn r#write_dictionary(&self, mut dictionary: Input) -> Self::WriteDictionaryResponseFut {
1246        fn _decode(
1247            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1248        ) -> Result<ControllerWriteDictionaryResult, fidl::Error> {
1249            let _response = fidl::client::decode_transaction_body::<
1250                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1251                fidl::encoding::DefaultFuchsiaResourceDialect,
1252                0x4ecfc1274fe4a70b,
1253            >(_buf?)?;
1254            Ok(_response.map(|x| x))
1255        }
1256        self.client.send_query_and_decode::<
1257            ControllerWriteDictionaryRequest,
1258            ControllerWriteDictionaryResult,
1259        >(
1260            (&mut dictionary,),
1261            0x4ecfc1274fe4a70b,
1262            fidl::encoding::DynamicFlags::empty(),
1263            _decode,
1264        )
1265    }
1266
1267    type ReadDictionaryResponseFut =
1268        fidl::client::QueryResponseFut<Input, fidl::encoding::DefaultFuchsiaResourceDialect>;
1269    fn r#read_dictionary(&self) -> Self::ReadDictionaryResponseFut {
1270        fn _decode(
1271            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1272        ) -> Result<Input, fidl::Error> {
1273            let _response = fidl::client::decode_transaction_body::<
1274                ControllerReadDictionaryResponse,
1275                fidl::encoding::DefaultFuchsiaResourceDialect,
1276                0x1be6724c87b51c37,
1277            >(_buf?)?;
1278            Ok(_response.dictionary)
1279        }
1280        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Input>(
1281            (),
1282            0x1be6724c87b51c37,
1283            fidl::encoding::DynamicFlags::empty(),
1284            _decode,
1285        )
1286    }
1287
1288    type AddMonitorResponseFut =
1289        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1290    fn r#add_monitor(
1291        &self,
1292        mut monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
1293    ) -> Self::AddMonitorResponseFut {
1294        fn _decode(
1295            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1296        ) -> Result<(), fidl::Error> {
1297            let _response = fidl::client::decode_transaction_body::<
1298                fidl::encoding::EmptyPayload,
1299                fidl::encoding::DefaultFuchsiaResourceDialect,
1300                0x2efbf7d3dc21438e,
1301            >(_buf?)?;
1302            Ok(_response)
1303        }
1304        self.client.send_query_and_decode::<ControllerAddMonitorRequest, ()>(
1305            (monitor,),
1306            0x2efbf7d3dc21438e,
1307            fidl::encoding::DynamicFlags::empty(),
1308            _decode,
1309        )
1310    }
1311
1312    type FuzzResponseFut = fidl::client::QueryResponseFut<
1313        ControllerFuzzResult,
1314        fidl::encoding::DefaultFuchsiaResourceDialect,
1315    >;
1316    fn r#fuzz(&self) -> Self::FuzzResponseFut {
1317        fn _decode(
1318            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1319        ) -> Result<ControllerFuzzResult, fidl::Error> {
1320            let _response = fidl::client::decode_transaction_body::<
1321                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1322                fidl::encoding::DefaultFuchsiaResourceDialect,
1323                0x62fe3684ea23af62,
1324            >(_buf?)?;
1325            Ok(_response.map(|x| x))
1326        }
1327        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerFuzzResult>(
1328            (),
1329            0x62fe3684ea23af62,
1330            fidl::encoding::DynamicFlags::empty(),
1331            _decode,
1332        )
1333    }
1334
1335    type TryOneResponseFut = fidl::client::QueryResponseFut<
1336        ControllerTryOneResult,
1337        fidl::encoding::DefaultFuchsiaResourceDialect,
1338    >;
1339    fn r#try_one(&self, mut test_input: Input) -> Self::TryOneResponseFut {
1340        fn _decode(
1341            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1342        ) -> Result<ControllerTryOneResult, fidl::Error> {
1343            let _response = fidl::client::decode_transaction_body::<
1344                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1345                fidl::encoding::DefaultFuchsiaResourceDialect,
1346                0x368dc762d8e16d46,
1347            >(_buf?)?;
1348            Ok(_response.map(|x| x))
1349        }
1350        self.client.send_query_and_decode::<ControllerTryOneRequest, ControllerTryOneResult>(
1351            (&mut test_input,),
1352            0x368dc762d8e16d46,
1353            fidl::encoding::DynamicFlags::empty(),
1354            _decode,
1355        )
1356    }
1357
1358    type MinimizeResponseFut = fidl::client::QueryResponseFut<
1359        ControllerMinimizeResult,
1360        fidl::encoding::DefaultFuchsiaResourceDialect,
1361    >;
1362    fn r#minimize(&self, mut test_input: Input) -> Self::MinimizeResponseFut {
1363        fn _decode(
1364            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1365        ) -> Result<ControllerMinimizeResult, fidl::Error> {
1366            let _response = fidl::client::decode_transaction_body::<
1367                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1368                fidl::encoding::DefaultFuchsiaResourceDialect,
1369                0x105a242ee0552794,
1370            >(_buf?)?;
1371            Ok(_response.map(|x| x))
1372        }
1373        self.client.send_query_and_decode::<ControllerMinimizeRequest, ControllerMinimizeResult>(
1374            (&mut test_input,),
1375            0x105a242ee0552794,
1376            fidl::encoding::DynamicFlags::empty(),
1377            _decode,
1378        )
1379    }
1380
1381    type CleanseResponseFut = fidl::client::QueryResponseFut<
1382        ControllerCleanseResult,
1383        fidl::encoding::DefaultFuchsiaResourceDialect,
1384    >;
1385    fn r#cleanse(&self, mut test_input: Input) -> Self::CleanseResponseFut {
1386        fn _decode(
1387            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1388        ) -> Result<ControllerCleanseResult, fidl::Error> {
1389            let _response = fidl::client::decode_transaction_body::<
1390                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1391                fidl::encoding::DefaultFuchsiaResourceDialect,
1392                0x6d7892f62735f3e0,
1393            >(_buf?)?;
1394            Ok(_response.map(|x| x))
1395        }
1396        self.client.send_query_and_decode::<ControllerCleanseRequest, ControllerCleanseResult>(
1397            (&mut test_input,),
1398            0x6d7892f62735f3e0,
1399            fidl::encoding::DynamicFlags::empty(),
1400            _decode,
1401        )
1402    }
1403
1404    type MergeResponseFut = fidl::client::QueryResponseFut<
1405        ControllerMergeResult,
1406        fidl::encoding::DefaultFuchsiaResourceDialect,
1407    >;
1408    fn r#merge(&self) -> Self::MergeResponseFut {
1409        fn _decode(
1410            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1411        ) -> Result<ControllerMergeResult, fidl::Error> {
1412            let _response = fidl::client::decode_transaction_body::<
1413                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1414                fidl::encoding::DefaultFuchsiaResourceDialect,
1415                0x3614e5c39413b5eb,
1416            >(_buf?)?;
1417            Ok(_response.map(|x| x))
1418        }
1419        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerMergeResult>(
1420            (),
1421            0x3614e5c39413b5eb,
1422            fidl::encoding::DynamicFlags::empty(),
1423            _decode,
1424        )
1425    }
1426
1427    type GetStatusResponseFut =
1428        fidl::client::QueryResponseFut<Status, fidl::encoding::DefaultFuchsiaResourceDialect>;
1429    fn r#get_status(&self) -> Self::GetStatusResponseFut {
1430        fn _decode(
1431            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1432        ) -> Result<Status, fidl::Error> {
1433            let _response = fidl::client::decode_transaction_body::<
1434                ControllerGetStatusResponse,
1435                fidl::encoding::DefaultFuchsiaResourceDialect,
1436                0x51db4975d93ce768,
1437            >(_buf?)?;
1438            Ok(_response.status)
1439        }
1440        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Status>(
1441            (),
1442            0x51db4975d93ce768,
1443            fidl::encoding::DynamicFlags::empty(),
1444            _decode,
1445        )
1446    }
1447
1448    type WatchArtifactResponseFut =
1449        fidl::client::QueryResponseFut<Artifact, fidl::encoding::DefaultFuchsiaResourceDialect>;
1450    fn r#watch_artifact(&self) -> Self::WatchArtifactResponseFut {
1451        fn _decode(
1452            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1453        ) -> Result<Artifact, fidl::Error> {
1454            let _response = fidl::client::decode_transaction_body::<
1455                ControllerWatchArtifactResponse,
1456                fidl::encoding::DefaultFuchsiaResourceDialect,
1457                0x6cfca3730944a414,
1458            >(_buf?)?;
1459            Ok(_response.artifact)
1460        }
1461        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Artifact>(
1462            (),
1463            0x6cfca3730944a414,
1464            fidl::encoding::DynamicFlags::empty(),
1465            _decode,
1466        )
1467    }
1468}
1469
1470pub struct ControllerEventStream {
1471    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1472}
1473
1474impl std::marker::Unpin for ControllerEventStream {}
1475
1476impl futures::stream::FusedStream for ControllerEventStream {
1477    fn is_terminated(&self) -> bool {
1478        self.event_receiver.is_terminated()
1479    }
1480}
1481
1482impl futures::Stream for ControllerEventStream {
1483    type Item = Result<ControllerEvent, fidl::Error>;
1484
1485    fn poll_next(
1486        mut self: std::pin::Pin<&mut Self>,
1487        cx: &mut std::task::Context<'_>,
1488    ) -> std::task::Poll<Option<Self::Item>> {
1489        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1490            &mut self.event_receiver,
1491            cx
1492        )?) {
1493            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
1494            None => std::task::Poll::Ready(None),
1495        }
1496    }
1497}
1498
1499#[derive(Debug)]
1500pub enum ControllerEvent {}
1501
1502impl ControllerEvent {
1503    /// Decodes a message buffer as a [`ControllerEvent`].
1504    fn decode(
1505        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1506    ) -> Result<ControllerEvent, fidl::Error> {
1507        let (bytes, _handles) = buf.split_mut();
1508        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1509        debug_assert_eq!(tx_header.tx_id, 0);
1510        match tx_header.ordinal {
1511            _ => Err(fidl::Error::UnknownOrdinal {
1512                ordinal: tx_header.ordinal,
1513                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1514            }),
1515        }
1516    }
1517}
1518
1519/// A Stream of incoming requests for fuchsia.fuzzer/Controller.
1520pub struct ControllerRequestStream {
1521    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1522    is_terminated: bool,
1523}
1524
1525impl std::marker::Unpin for ControllerRequestStream {}
1526
1527impl futures::stream::FusedStream for ControllerRequestStream {
1528    fn is_terminated(&self) -> bool {
1529        self.is_terminated
1530    }
1531}
1532
1533impl fidl::endpoints::RequestStream for ControllerRequestStream {
1534    type Protocol = ControllerMarker;
1535    type ControlHandle = ControllerControlHandle;
1536
1537    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1538        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1539    }
1540
1541    fn control_handle(&self) -> Self::ControlHandle {
1542        ControllerControlHandle { inner: self.inner.clone() }
1543    }
1544
1545    fn into_inner(
1546        self,
1547    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1548    {
1549        (self.inner, self.is_terminated)
1550    }
1551
1552    fn from_inner(
1553        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1554        is_terminated: bool,
1555    ) -> Self {
1556        Self { inner, is_terminated }
1557    }
1558}
1559
1560impl futures::Stream for ControllerRequestStream {
1561    type Item = Result<ControllerRequest, fidl::Error>;
1562
1563    fn poll_next(
1564        mut self: std::pin::Pin<&mut Self>,
1565        cx: &mut std::task::Context<'_>,
1566    ) -> std::task::Poll<Option<Self::Item>> {
1567        let this = &mut *self;
1568        if this.inner.check_shutdown(cx) {
1569            this.is_terminated = true;
1570            return std::task::Poll::Ready(None);
1571        }
1572        if this.is_terminated {
1573            panic!("polled ControllerRequestStream after completion");
1574        }
1575        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1576            |bytes, handles| {
1577                match this.inner.channel().read_etc(cx, bytes, handles) {
1578                    std::task::Poll::Ready(Ok(())) => {}
1579                    std::task::Poll::Pending => return std::task::Poll::Pending,
1580                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1581                        this.is_terminated = true;
1582                        return std::task::Poll::Ready(None);
1583                    }
1584                    std::task::Poll::Ready(Err(e)) => {
1585                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1586                            e.into(),
1587                        ))));
1588                    }
1589                }
1590
1591                // A message has been received from the channel
1592                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1593
1594                std::task::Poll::Ready(Some(match header.ordinal {
1595                    0x35c8cba7fa3d32e4 => {
1596                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1597                        let mut req = fidl::new_empty!(
1598                            ControllerConfigureRequest,
1599                            fidl::encoding::DefaultFuchsiaResourceDialect
1600                        );
1601                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerConfigureRequest>(&header, _body_bytes, handles, &mut req)?;
1602                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1603                        Ok(ControllerRequest::Configure {
1604                            options: req.options,
1605
1606                            responder: ControllerConfigureResponder {
1607                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1608                                tx_id: header.tx_id,
1609                            },
1610                        })
1611                    }
1612                    0x683d93332504b9cd => {
1613                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1614                        let mut req = fidl::new_empty!(
1615                            fidl::encoding::EmptyPayload,
1616                            fidl::encoding::DefaultFuchsiaResourceDialect
1617                        );
1618                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1619                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1620                        Ok(ControllerRequest::GetOptions {
1621                            responder: ControllerGetOptionsResponder {
1622                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1623                                tx_id: header.tx_id,
1624                            },
1625                        })
1626                    }
1627                    0x7bdf8336ab534cee => {
1628                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1629                        let mut req = fidl::new_empty!(
1630                            ControllerAddToCorpusRequest,
1631                            fidl::encoding::DefaultFuchsiaResourceDialect
1632                        );
1633                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerAddToCorpusRequest>(&header, _body_bytes, handles, &mut req)?;
1634                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1635                        Ok(ControllerRequest::AddToCorpus {
1636                            corpus: req.corpus,
1637                            input: req.input,
1638
1639                            responder: ControllerAddToCorpusResponder {
1640                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1641                                tx_id: header.tx_id,
1642                            },
1643                        })
1644                    }
1645                    0x501279b430b34514 => {
1646                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1647                        let mut req = fidl::new_empty!(
1648                            ControllerReadCorpusRequest,
1649                            fidl::encoding::DefaultFuchsiaResourceDialect
1650                        );
1651                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerReadCorpusRequest>(&header, _body_bytes, handles, &mut req)?;
1652                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1653                        Ok(ControllerRequest::ReadCorpus {
1654                            corpus: req.corpus,
1655                            corpus_reader: req.corpus_reader,
1656
1657                            responder: ControllerReadCorpusResponder {
1658                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1659                                tx_id: header.tx_id,
1660                            },
1661                        })
1662                    }
1663                    0x4ecfc1274fe4a70b => {
1664                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1665                        let mut req = fidl::new_empty!(
1666                            ControllerWriteDictionaryRequest,
1667                            fidl::encoding::DefaultFuchsiaResourceDialect
1668                        );
1669                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerWriteDictionaryRequest>(&header, _body_bytes, handles, &mut req)?;
1670                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1671                        Ok(ControllerRequest::WriteDictionary {
1672                            dictionary: req.dictionary,
1673
1674                            responder: ControllerWriteDictionaryResponder {
1675                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1676                                tx_id: header.tx_id,
1677                            },
1678                        })
1679                    }
1680                    0x1be6724c87b51c37 => {
1681                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1682                        let mut req = fidl::new_empty!(
1683                            fidl::encoding::EmptyPayload,
1684                            fidl::encoding::DefaultFuchsiaResourceDialect
1685                        );
1686                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1687                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1688                        Ok(ControllerRequest::ReadDictionary {
1689                            responder: ControllerReadDictionaryResponder {
1690                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1691                                tx_id: header.tx_id,
1692                            },
1693                        })
1694                    }
1695                    0x2efbf7d3dc21438e => {
1696                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1697                        let mut req = fidl::new_empty!(
1698                            ControllerAddMonitorRequest,
1699                            fidl::encoding::DefaultFuchsiaResourceDialect
1700                        );
1701                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerAddMonitorRequest>(&header, _body_bytes, handles, &mut req)?;
1702                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1703                        Ok(ControllerRequest::AddMonitor {
1704                            monitor: req.monitor,
1705
1706                            responder: ControllerAddMonitorResponder {
1707                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1708                                tx_id: header.tx_id,
1709                            },
1710                        })
1711                    }
1712                    0x62fe3684ea23af62 => {
1713                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1714                        let mut req = fidl::new_empty!(
1715                            fidl::encoding::EmptyPayload,
1716                            fidl::encoding::DefaultFuchsiaResourceDialect
1717                        );
1718                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1719                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1720                        Ok(ControllerRequest::Fuzz {
1721                            responder: ControllerFuzzResponder {
1722                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1723                                tx_id: header.tx_id,
1724                            },
1725                        })
1726                    }
1727                    0x368dc762d8e16d46 => {
1728                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1729                        let mut req = fidl::new_empty!(
1730                            ControllerTryOneRequest,
1731                            fidl::encoding::DefaultFuchsiaResourceDialect
1732                        );
1733                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerTryOneRequest>(&header, _body_bytes, handles, &mut req)?;
1734                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1735                        Ok(ControllerRequest::TryOne {
1736                            test_input: req.test_input,
1737
1738                            responder: ControllerTryOneResponder {
1739                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1740                                tx_id: header.tx_id,
1741                            },
1742                        })
1743                    }
1744                    0x105a242ee0552794 => {
1745                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1746                        let mut req = fidl::new_empty!(
1747                            ControllerMinimizeRequest,
1748                            fidl::encoding::DefaultFuchsiaResourceDialect
1749                        );
1750                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerMinimizeRequest>(&header, _body_bytes, handles, &mut req)?;
1751                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1752                        Ok(ControllerRequest::Minimize {
1753                            test_input: req.test_input,
1754
1755                            responder: ControllerMinimizeResponder {
1756                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1757                                tx_id: header.tx_id,
1758                            },
1759                        })
1760                    }
1761                    0x6d7892f62735f3e0 => {
1762                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1763                        let mut req = fidl::new_empty!(
1764                            ControllerCleanseRequest,
1765                            fidl::encoding::DefaultFuchsiaResourceDialect
1766                        );
1767                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerCleanseRequest>(&header, _body_bytes, handles, &mut req)?;
1768                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1769                        Ok(ControllerRequest::Cleanse {
1770                            test_input: req.test_input,
1771
1772                            responder: ControllerCleanseResponder {
1773                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1774                                tx_id: header.tx_id,
1775                            },
1776                        })
1777                    }
1778                    0x3614e5c39413b5eb => {
1779                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1780                        let mut req = fidl::new_empty!(
1781                            fidl::encoding::EmptyPayload,
1782                            fidl::encoding::DefaultFuchsiaResourceDialect
1783                        );
1784                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1785                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1786                        Ok(ControllerRequest::Merge {
1787                            responder: ControllerMergeResponder {
1788                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1789                                tx_id: header.tx_id,
1790                            },
1791                        })
1792                    }
1793                    0x51db4975d93ce768 => {
1794                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1795                        let mut req = fidl::new_empty!(
1796                            fidl::encoding::EmptyPayload,
1797                            fidl::encoding::DefaultFuchsiaResourceDialect
1798                        );
1799                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1800                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1801                        Ok(ControllerRequest::GetStatus {
1802                            responder: ControllerGetStatusResponder {
1803                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1804                                tx_id: header.tx_id,
1805                            },
1806                        })
1807                    }
1808                    0x6cfca3730944a414 => {
1809                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1810                        let mut req = fidl::new_empty!(
1811                            fidl::encoding::EmptyPayload,
1812                            fidl::encoding::DefaultFuchsiaResourceDialect
1813                        );
1814                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1815                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1816                        Ok(ControllerRequest::WatchArtifact {
1817                            responder: ControllerWatchArtifactResponder {
1818                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1819                                tx_id: header.tx_id,
1820                            },
1821                        })
1822                    }
1823                    _ => Err(fidl::Error::UnknownOrdinal {
1824                        ordinal: header.ordinal,
1825                        protocol_name:
1826                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1827                    }),
1828                }))
1829            },
1830        )
1831    }
1832}
1833
1834/// Provides the management interface for fuzzing.
1835///
1836/// This protocol is implemented by the fuzzing engine. Clients for this
1837/// protocol are provided by `fuchsia.fuzzer/ControllerProvider.Connect`.
1838///
1839/// The channel is closed when the fuzzer is no longer needed, and on error.
1840/// Clients should exit and not attempt to reconnect.
1841#[derive(Debug)]
1842pub enum ControllerRequest {
1843    /// Sets various execution and error detection parameters. This may be
1844    /// called multiple times; only the most recently received options are used.
1845    /// If the `Options` parameter omits one or more fields, those parameters
1846    /// are unchanged in the fuzzer. Until the initial call to this method, the
1847    /// fuzzer should assume the default values for `Options`.
1848    ///
1849    /// + request `options` the execution and error detection parameters.
1850    /// * error one of the following:
1851    /// * error
1852    ///     * `ZX_ERR_BAD_STATE` if a long-running call such as `Execute`,
1853    ///       `Cleanse`, `Minimize`, `Fuzz`, or `Merge` is in progress.
1854    ///     * `ZX_ERR_NOT_SUPPORTED` if a value provided for an option is not
1855    ///       supported by the engine. Check the logs for additional details.
1856    Configure { options: Options, responder: ControllerConfigureResponder },
1857    /// Gets the current values for the various execution and error detection
1858    /// parameters.
1859    ///
1860    /// - response `options` the execution and error detection parameters.
1861    GetOptions { responder: ControllerGetOptionsResponder },
1862    /// Writes the provided `input` to either the "seed" or "live" `corpus`.
1863    /// Returns an error if transferring the input fails; see `Input` for
1864    /// details.
1865    ///
1866    /// + request `corpus` the type of corpus to add to.
1867    /// + request `input` the sequence of bytes to add as a test input.
1868    /// * error one of the following:
1869    ///     * `ZX_ERR_INVALID_ARGS` if corpus type is invalid.
1870    ///     * A socket error if transferring the input fails.
1871    AddToCorpus { corpus: Corpus, input: Input, responder: ControllerAddToCorpusResponder },
1872    /// Connects a `corpus_reader` for either the "seed" or "live" corpus.
1873    ///
1874    /// + request `corpus` the type of corpus to read from.
1875    /// + request `corpus_reader` the client used to send test inputs.
1876    ReadCorpus {
1877        corpus: Corpus,
1878        corpus_reader: fidl::endpoints::ClientEnd<CorpusReaderMarker>,
1879        responder: ControllerReadCorpusResponder,
1880    },
1881    /// Parses and loads an AFL-style dictionary. Invalid entries are logged and
1882    /// skipped.
1883    ///
1884    /// See also:
1885    ///
1886    /// * https://github.com/mirrorer/afl/blob/master/dictionaries/README.dictionaries
1887    ///
1888    /// + request `dictionary` the AFL-style dictionary
1889    /// * error one of the following:
1890    ///     * A socket error if transferring the input fails.
1891    ///     *`ZX_ERR_INVALID_ARGS` if parsing the dictionary fails.
1892    WriteDictionary { dictionary: Input, responder: ControllerWriteDictionaryResponder },
1893    /// Returns the current dictionary as an Input, which may be empty.
1894    ///
1895    /// - response `dictionary` the current AFL-style dictionary.
1896    ReadDictionary { responder: ControllerReadDictionaryResponder },
1897    /// Installs a `Monitor` to push status. To pull status instead, use
1898    /// `GetStatus`.
1899    ///
1900    /// + request `monitor` the client used to send status updates.
1901    AddMonitor {
1902        monitor: fidl::endpoints::ClientEnd<MonitorMarker>,
1903        responder: ControllerAddMonitorResponder,
1904    },
1905    /// Runs the normal fuzzing feedback loop:
1906    ///
1907    /// 1. Selects an input from the corpus.
1908    /// 2. Mutates the input.
1909    /// 3. Uses the `TargetAdapter` to execute the input.
1910    /// 4. Checks feedback from the `InstrumentedProcesses`.
1911    /// 5. If the input produced useful feedback, adds it to the corpus.
1912    ///
1913    /// This call returns quickly, but the loop continues until one of three
1914    /// conditions is met:
1915    ///
1916    /// 1. The configured, non-zero number of `runs` has been reached.
1917    /// 2. The configured, non-zero `duration` elapses.
1918    /// 3. An error is detected, and returned.
1919    ///
1920    /// See `Result` for more details on long running workflows such as this
1921    /// one.
1922    ///
1923    /// * error `ZX_ERR_BAD_STATE` if another long-running workflow is in
1924    ///   progress.
1925    Fuzz { responder: ControllerFuzzResponder },
1926    /// Executes the target code with a single `test_input`.
1927    ///
1928    /// See `Result` for more details on long running workflows such as this
1929    /// one.
1930    ///
1931    /// + request `input` the sequence of bytes to use with the fuzz target.
1932    /// * error one of the following:
1933    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
1934    ///       progress.
1935    ///     *  A socket error if transferring the input fails.
1936    TryOne { test_input: Input, responder: ControllerTryOneResponder },
1937    /// Attempts to find the smallest input that produces the same error as the
1938    /// given `test_input`,
1939    /// constrained by the configured `total_time` and/or `runs` options.
1940    ///
1941    /// See `Result` for more details on long running workflows such as this
1942    /// one.
1943    ///
1944    /// + request `input` the sequence of bytes to minimize.
1945    /// * error one of the following:
1946    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
1947    ///       progress.
1948    ///     * A socket error if transferring the input fails.
1949    ///     * `ZX_ERR_INVALID_ARGS` if the provided `test_input` does not cause
1950    ///       an error.
1951    Minimize { test_input: Input, responder: ControllerMinimizeResponder },
1952    /// Attempts to replace bytes of the given `test_input` with "filler" bytes,
1953    /// e.g. \x00, \xFF, without changing the error produced.
1954    ///
1955    /// See `Result` for more details on long running workflows such as this
1956    /// one.
1957    ///
1958    /// To preserve backwards compatibility with libFuzzer and ClusterFuzz, an
1959    /// input that produces no result is *not* considered an error, and is
1960    /// returned as-is.
1961    ///
1962    /// + request `input` the sequence of bytes to cleanse.
1963    /// * error one of the following:
1964    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
1965    ///       progress.
1966    ///     * A socket error if transferring the input fails.
1967    Cleanse { test_input: Input, responder: ControllerCleanseResponder },
1968    /// Attempts to shrink the corpora. Inputs from the seed corpus will be
1969    /// preserved. All other inputs will be sorted by amount of feedback
1970    /// produced and input size, and only those inputs that add new feedback not
1971    /// seen earlier in the sequence will be kept.
1972    ///
1973    /// See `Result` for more details on long running workflows such as this
1974    /// one.
1975    ///
1976    /// * error one of the following:
1977    ///     * `ZX_ERR_BAD_STATE` if another long-running workflow is in
1978    ///       progress.
1979    ///     * `ZX_ERR_INVALID_ARGS` if an input in the seed corpus causes an
1980    ///       error. Inputs in the live corpus that cause errors are skipped.
1981    Merge { responder: ControllerMergeResponder },
1982    /// Returns various fuzzing metrics, e.g. total coverage, speed, etc.
1983    ///
1984    /// - response `status` the current value of fuzzing metrics.
1985    GetStatus { responder: ControllerGetStatusResponder },
1986    /// Returns the results of a long-running workflow.
1987    ///
1988    /// This method uses the
1989    /// ["hanging get" pattern](https://fuchsia.dev/fuchsia-src/development/api/fidl#hanging-get).
1990    /// Upon the first call for a given connection, it will immediately return
1991    /// the controller's current artifact. Upon subsequent calls, it will block
1992    /// until the controller's artifact changes before returning. Clients should
1993    /// use `GetStatus` to ensure the fuzzer is not idle before making a
1994    /// blocking call to `WatchArtifact`.
1995    ///
1996    /// Combined with the `Status.running` value obtained from `GetStatus`, this
1997    /// allows a (re-)connecting client to infer the state of the fuzzer:
1998    ///
1999    /// * If the fuzzer is idle and has an empty artifact, then it is
2000    ///   unchanged since the last connection, if any.
2001    /// * If the fuzzer is running and has an empty artifact, then it is
2002    ///   performing a long-running workflow started by a previous connection.
2003    ///   The client may call `WatchArtifact` again to wait for the workflow
2004    ///   to complete.
2005    /// * If the fuzzer is idle and has a non-empty artifact, then it has
2006    ///   completed a long-running workflow since the last connection.
2007    ///
2008    /// It is not an error for clients to disconnect while waiting for a
2009    /// response from this method. This method is intended to allow clients to
2010    /// resume waiting for a long-running workflow to complete after
2011    /// intentionally or inadvertently being disconnected for an indefinite
2012    /// amount of time.
2013    ///
2014    /// - response `artifact` the most recent result and/or error-causing input.
2015    WatchArtifact { responder: ControllerWatchArtifactResponder },
2016}
2017
2018impl ControllerRequest {
2019    #[allow(irrefutable_let_patterns)]
2020    pub fn into_configure(self) -> Option<(Options, ControllerConfigureResponder)> {
2021        if let ControllerRequest::Configure { options, responder } = self {
2022            Some((options, responder))
2023        } else {
2024            None
2025        }
2026    }
2027
2028    #[allow(irrefutable_let_patterns)]
2029    pub fn into_get_options(self) -> Option<(ControllerGetOptionsResponder)> {
2030        if let ControllerRequest::GetOptions { responder } = self {
2031            Some((responder))
2032        } else {
2033            None
2034        }
2035    }
2036
2037    #[allow(irrefutable_let_patterns)]
2038    pub fn into_add_to_corpus(self) -> Option<(Corpus, Input, ControllerAddToCorpusResponder)> {
2039        if let ControllerRequest::AddToCorpus { corpus, input, responder } = self {
2040            Some((corpus, input, responder))
2041        } else {
2042            None
2043        }
2044    }
2045
2046    #[allow(irrefutable_let_patterns)]
2047    pub fn into_read_corpus(
2048        self,
2049    ) -> Option<(
2050        Corpus,
2051        fidl::endpoints::ClientEnd<CorpusReaderMarker>,
2052        ControllerReadCorpusResponder,
2053    )> {
2054        if let ControllerRequest::ReadCorpus { corpus, corpus_reader, responder } = self {
2055            Some((corpus, corpus_reader, responder))
2056        } else {
2057            None
2058        }
2059    }
2060
2061    #[allow(irrefutable_let_patterns)]
2062    pub fn into_write_dictionary(self) -> Option<(Input, ControllerWriteDictionaryResponder)> {
2063        if let ControllerRequest::WriteDictionary { dictionary, responder } = self {
2064            Some((dictionary, responder))
2065        } else {
2066            None
2067        }
2068    }
2069
2070    #[allow(irrefutable_let_patterns)]
2071    pub fn into_read_dictionary(self) -> Option<(ControllerReadDictionaryResponder)> {
2072        if let ControllerRequest::ReadDictionary { responder } = self {
2073            Some((responder))
2074        } else {
2075            None
2076        }
2077    }
2078
2079    #[allow(irrefutable_let_patterns)]
2080    pub fn into_add_monitor(
2081        self,
2082    ) -> Option<(fidl::endpoints::ClientEnd<MonitorMarker>, ControllerAddMonitorResponder)> {
2083        if let ControllerRequest::AddMonitor { monitor, responder } = self {
2084            Some((monitor, responder))
2085        } else {
2086            None
2087        }
2088    }
2089
2090    #[allow(irrefutable_let_patterns)]
2091    pub fn into_fuzz(self) -> Option<(ControllerFuzzResponder)> {
2092        if let ControllerRequest::Fuzz { responder } = self { Some((responder)) } else { None }
2093    }
2094
2095    #[allow(irrefutable_let_patterns)]
2096    pub fn into_try_one(self) -> Option<(Input, ControllerTryOneResponder)> {
2097        if let ControllerRequest::TryOne { test_input, responder } = self {
2098            Some((test_input, responder))
2099        } else {
2100            None
2101        }
2102    }
2103
2104    #[allow(irrefutable_let_patterns)]
2105    pub fn into_minimize(self) -> Option<(Input, ControllerMinimizeResponder)> {
2106        if let ControllerRequest::Minimize { test_input, responder } = self {
2107            Some((test_input, responder))
2108        } else {
2109            None
2110        }
2111    }
2112
2113    #[allow(irrefutable_let_patterns)]
2114    pub fn into_cleanse(self) -> Option<(Input, ControllerCleanseResponder)> {
2115        if let ControllerRequest::Cleanse { test_input, responder } = self {
2116            Some((test_input, responder))
2117        } else {
2118            None
2119        }
2120    }
2121
2122    #[allow(irrefutable_let_patterns)]
2123    pub fn into_merge(self) -> Option<(ControllerMergeResponder)> {
2124        if let ControllerRequest::Merge { responder } = self { Some((responder)) } else { None }
2125    }
2126
2127    #[allow(irrefutable_let_patterns)]
2128    pub fn into_get_status(self) -> Option<(ControllerGetStatusResponder)> {
2129        if let ControllerRequest::GetStatus { responder } = self { Some((responder)) } else { None }
2130    }
2131
2132    #[allow(irrefutable_let_patterns)]
2133    pub fn into_watch_artifact(self) -> Option<(ControllerWatchArtifactResponder)> {
2134        if let ControllerRequest::WatchArtifact { responder } = self {
2135            Some((responder))
2136        } else {
2137            None
2138        }
2139    }
2140
2141    /// Name of the method defined in FIDL
2142    pub fn method_name(&self) -> &'static str {
2143        match *self {
2144            ControllerRequest::Configure { .. } => "configure",
2145            ControllerRequest::GetOptions { .. } => "get_options",
2146            ControllerRequest::AddToCorpus { .. } => "add_to_corpus",
2147            ControllerRequest::ReadCorpus { .. } => "read_corpus",
2148            ControllerRequest::WriteDictionary { .. } => "write_dictionary",
2149            ControllerRequest::ReadDictionary { .. } => "read_dictionary",
2150            ControllerRequest::AddMonitor { .. } => "add_monitor",
2151            ControllerRequest::Fuzz { .. } => "fuzz",
2152            ControllerRequest::TryOne { .. } => "try_one",
2153            ControllerRequest::Minimize { .. } => "minimize",
2154            ControllerRequest::Cleanse { .. } => "cleanse",
2155            ControllerRequest::Merge { .. } => "merge",
2156            ControllerRequest::GetStatus { .. } => "get_status",
2157            ControllerRequest::WatchArtifact { .. } => "watch_artifact",
2158        }
2159    }
2160}
2161
2162#[derive(Debug, Clone)]
2163pub struct ControllerControlHandle {
2164    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2165}
2166
2167impl fidl::endpoints::ControlHandle for ControllerControlHandle {
2168    fn shutdown(&self) {
2169        self.inner.shutdown()
2170    }
2171
2172    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2173        self.inner.shutdown_with_epitaph(status)
2174    }
2175
2176    fn is_closed(&self) -> bool {
2177        self.inner.channel().is_closed()
2178    }
2179    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2180        self.inner.channel().on_closed()
2181    }
2182
2183    #[cfg(target_os = "fuchsia")]
2184    fn signal_peer(
2185        &self,
2186        clear_mask: zx::Signals,
2187        set_mask: zx::Signals,
2188    ) -> Result<(), zx_status::Status> {
2189        use fidl::Peered;
2190        self.inner.channel().signal_peer(clear_mask, set_mask)
2191    }
2192}
2193
2194impl ControllerControlHandle {}
2195
2196#[must_use = "FIDL methods require a response to be sent"]
2197#[derive(Debug)]
2198pub struct ControllerConfigureResponder {
2199    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2200    tx_id: u32,
2201}
2202
2203/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2204/// if the responder is dropped without sending a response, so that the client
2205/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2206impl std::ops::Drop for ControllerConfigureResponder {
2207    fn drop(&mut self) {
2208        self.control_handle.shutdown();
2209        // Safety: drops once, never accessed again
2210        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2211    }
2212}
2213
2214impl fidl::endpoints::Responder for ControllerConfigureResponder {
2215    type ControlHandle = ControllerControlHandle;
2216
2217    fn control_handle(&self) -> &ControllerControlHandle {
2218        &self.control_handle
2219    }
2220
2221    fn drop_without_shutdown(mut self) {
2222        // Safety: drops once, never accessed again due to mem::forget
2223        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2224        // Prevent Drop from running (which would shut down the channel)
2225        std::mem::forget(self);
2226    }
2227}
2228
2229impl ControllerConfigureResponder {
2230    /// Sends a response to the FIDL transaction.
2231    ///
2232    /// Sets the channel to shutdown if an error occurs.
2233    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2234        let _result = self.send_raw(result);
2235        if _result.is_err() {
2236            self.control_handle.shutdown();
2237        }
2238        self.drop_without_shutdown();
2239        _result
2240    }
2241
2242    /// Similar to "send" but does not shutdown the channel if an error occurs.
2243    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2244        let _result = self.send_raw(result);
2245        self.drop_without_shutdown();
2246        _result
2247    }
2248
2249    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2250        self.control_handle
2251            .inner
2252            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2253                result,
2254                self.tx_id,
2255                0x35c8cba7fa3d32e4,
2256                fidl::encoding::DynamicFlags::empty(),
2257            )
2258    }
2259}
2260
2261#[must_use = "FIDL methods require a response to be sent"]
2262#[derive(Debug)]
2263pub struct ControllerGetOptionsResponder {
2264    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2265    tx_id: u32,
2266}
2267
2268/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2269/// if the responder is dropped without sending a response, so that the client
2270/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2271impl std::ops::Drop for ControllerGetOptionsResponder {
2272    fn drop(&mut self) {
2273        self.control_handle.shutdown();
2274        // Safety: drops once, never accessed again
2275        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2276    }
2277}
2278
2279impl fidl::endpoints::Responder for ControllerGetOptionsResponder {
2280    type ControlHandle = ControllerControlHandle;
2281
2282    fn control_handle(&self) -> &ControllerControlHandle {
2283        &self.control_handle
2284    }
2285
2286    fn drop_without_shutdown(mut self) {
2287        // Safety: drops once, never accessed again due to mem::forget
2288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2289        // Prevent Drop from running (which would shut down the channel)
2290        std::mem::forget(self);
2291    }
2292}
2293
2294impl ControllerGetOptionsResponder {
2295    /// Sends a response to the FIDL transaction.
2296    ///
2297    /// Sets the channel to shutdown if an error occurs.
2298    pub fn send(self, mut options: &Options) -> Result<(), fidl::Error> {
2299        let _result = self.send_raw(options);
2300        if _result.is_err() {
2301            self.control_handle.shutdown();
2302        }
2303        self.drop_without_shutdown();
2304        _result
2305    }
2306
2307    /// Similar to "send" but does not shutdown the channel if an error occurs.
2308    pub fn send_no_shutdown_on_err(self, mut options: &Options) -> Result<(), fidl::Error> {
2309        let _result = self.send_raw(options);
2310        self.drop_without_shutdown();
2311        _result
2312    }
2313
2314    fn send_raw(&self, mut options: &Options) -> Result<(), fidl::Error> {
2315        self.control_handle.inner.send::<ControllerGetOptionsResponse>(
2316            (options,),
2317            self.tx_id,
2318            0x683d93332504b9cd,
2319            fidl::encoding::DynamicFlags::empty(),
2320        )
2321    }
2322}
2323
2324#[must_use = "FIDL methods require a response to be sent"]
2325#[derive(Debug)]
2326pub struct ControllerAddToCorpusResponder {
2327    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2328    tx_id: u32,
2329}
2330
2331/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2332/// if the responder is dropped without sending a response, so that the client
2333/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2334impl std::ops::Drop for ControllerAddToCorpusResponder {
2335    fn drop(&mut self) {
2336        self.control_handle.shutdown();
2337        // Safety: drops once, never accessed again
2338        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2339    }
2340}
2341
2342impl fidl::endpoints::Responder for ControllerAddToCorpusResponder {
2343    type ControlHandle = ControllerControlHandle;
2344
2345    fn control_handle(&self) -> &ControllerControlHandle {
2346        &self.control_handle
2347    }
2348
2349    fn drop_without_shutdown(mut self) {
2350        // Safety: drops once, never accessed again due to mem::forget
2351        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2352        // Prevent Drop from running (which would shut down the channel)
2353        std::mem::forget(self);
2354    }
2355}
2356
2357impl ControllerAddToCorpusResponder {
2358    /// Sends a response to the FIDL transaction.
2359    ///
2360    /// Sets the channel to shutdown if an error occurs.
2361    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2362        let _result = self.send_raw(result);
2363        if _result.is_err() {
2364            self.control_handle.shutdown();
2365        }
2366        self.drop_without_shutdown();
2367        _result
2368    }
2369
2370    /// Similar to "send" but does not shutdown the channel if an error occurs.
2371    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2372        let _result = self.send_raw(result);
2373        self.drop_without_shutdown();
2374        _result
2375    }
2376
2377    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2378        self.control_handle
2379            .inner
2380            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2381                result,
2382                self.tx_id,
2383                0x7bdf8336ab534cee,
2384                fidl::encoding::DynamicFlags::empty(),
2385            )
2386    }
2387}
2388
2389#[must_use = "FIDL methods require a response to be sent"]
2390#[derive(Debug)]
2391pub struct ControllerReadCorpusResponder {
2392    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2393    tx_id: u32,
2394}
2395
2396/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2397/// if the responder is dropped without sending a response, so that the client
2398/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2399impl std::ops::Drop for ControllerReadCorpusResponder {
2400    fn drop(&mut self) {
2401        self.control_handle.shutdown();
2402        // Safety: drops once, never accessed again
2403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2404    }
2405}
2406
2407impl fidl::endpoints::Responder for ControllerReadCorpusResponder {
2408    type ControlHandle = ControllerControlHandle;
2409
2410    fn control_handle(&self) -> &ControllerControlHandle {
2411        &self.control_handle
2412    }
2413
2414    fn drop_without_shutdown(mut self) {
2415        // Safety: drops once, never accessed again due to mem::forget
2416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2417        // Prevent Drop from running (which would shut down the channel)
2418        std::mem::forget(self);
2419    }
2420}
2421
2422impl ControllerReadCorpusResponder {
2423    /// Sends a response to the FIDL transaction.
2424    ///
2425    /// Sets the channel to shutdown if an error occurs.
2426    pub fn send(self) -> Result<(), fidl::Error> {
2427        let _result = self.send_raw();
2428        if _result.is_err() {
2429            self.control_handle.shutdown();
2430        }
2431        self.drop_without_shutdown();
2432        _result
2433    }
2434
2435    /// Similar to "send" but does not shutdown the channel if an error occurs.
2436    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2437        let _result = self.send_raw();
2438        self.drop_without_shutdown();
2439        _result
2440    }
2441
2442    fn send_raw(&self) -> Result<(), fidl::Error> {
2443        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2444            (),
2445            self.tx_id,
2446            0x501279b430b34514,
2447            fidl::encoding::DynamicFlags::empty(),
2448        )
2449    }
2450}
2451
2452#[must_use = "FIDL methods require a response to be sent"]
2453#[derive(Debug)]
2454pub struct ControllerWriteDictionaryResponder {
2455    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2456    tx_id: u32,
2457}
2458
2459/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2460/// if the responder is dropped without sending a response, so that the client
2461/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2462impl std::ops::Drop for ControllerWriteDictionaryResponder {
2463    fn drop(&mut self) {
2464        self.control_handle.shutdown();
2465        // Safety: drops once, never accessed again
2466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2467    }
2468}
2469
2470impl fidl::endpoints::Responder for ControllerWriteDictionaryResponder {
2471    type ControlHandle = ControllerControlHandle;
2472
2473    fn control_handle(&self) -> &ControllerControlHandle {
2474        &self.control_handle
2475    }
2476
2477    fn drop_without_shutdown(mut self) {
2478        // Safety: drops once, never accessed again due to mem::forget
2479        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2480        // Prevent Drop from running (which would shut down the channel)
2481        std::mem::forget(self);
2482    }
2483}
2484
2485impl ControllerWriteDictionaryResponder {
2486    /// Sends a response to the FIDL transaction.
2487    ///
2488    /// Sets the channel to shutdown if an error occurs.
2489    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2490        let _result = self.send_raw(result);
2491        if _result.is_err() {
2492            self.control_handle.shutdown();
2493        }
2494        self.drop_without_shutdown();
2495        _result
2496    }
2497
2498    /// Similar to "send" but does not shutdown the channel if an error occurs.
2499    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2500        let _result = self.send_raw(result);
2501        self.drop_without_shutdown();
2502        _result
2503    }
2504
2505    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2506        self.control_handle
2507            .inner
2508            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2509                result,
2510                self.tx_id,
2511                0x4ecfc1274fe4a70b,
2512                fidl::encoding::DynamicFlags::empty(),
2513            )
2514    }
2515}
2516
2517#[must_use = "FIDL methods require a response to be sent"]
2518#[derive(Debug)]
2519pub struct ControllerReadDictionaryResponder {
2520    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2521    tx_id: u32,
2522}
2523
2524/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2525/// if the responder is dropped without sending a response, so that the client
2526/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2527impl std::ops::Drop for ControllerReadDictionaryResponder {
2528    fn drop(&mut self) {
2529        self.control_handle.shutdown();
2530        // Safety: drops once, never accessed again
2531        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2532    }
2533}
2534
2535impl fidl::endpoints::Responder for ControllerReadDictionaryResponder {
2536    type ControlHandle = ControllerControlHandle;
2537
2538    fn control_handle(&self) -> &ControllerControlHandle {
2539        &self.control_handle
2540    }
2541
2542    fn drop_without_shutdown(mut self) {
2543        // Safety: drops once, never accessed again due to mem::forget
2544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2545        // Prevent Drop from running (which would shut down the channel)
2546        std::mem::forget(self);
2547    }
2548}
2549
2550impl ControllerReadDictionaryResponder {
2551    /// Sends a response to the FIDL transaction.
2552    ///
2553    /// Sets the channel to shutdown if an error occurs.
2554    pub fn send(self, mut dictionary: Input) -> Result<(), fidl::Error> {
2555        let _result = self.send_raw(dictionary);
2556        if _result.is_err() {
2557            self.control_handle.shutdown();
2558        }
2559        self.drop_without_shutdown();
2560        _result
2561    }
2562
2563    /// Similar to "send" but does not shutdown the channel if an error occurs.
2564    pub fn send_no_shutdown_on_err(self, mut dictionary: Input) -> Result<(), fidl::Error> {
2565        let _result = self.send_raw(dictionary);
2566        self.drop_without_shutdown();
2567        _result
2568    }
2569
2570    fn send_raw(&self, mut dictionary: Input) -> Result<(), fidl::Error> {
2571        self.control_handle.inner.send::<ControllerReadDictionaryResponse>(
2572            (&mut dictionary,),
2573            self.tx_id,
2574            0x1be6724c87b51c37,
2575            fidl::encoding::DynamicFlags::empty(),
2576        )
2577    }
2578}
2579
2580#[must_use = "FIDL methods require a response to be sent"]
2581#[derive(Debug)]
2582pub struct ControllerAddMonitorResponder {
2583    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2584    tx_id: u32,
2585}
2586
2587/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2588/// if the responder is dropped without sending a response, so that the client
2589/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2590impl std::ops::Drop for ControllerAddMonitorResponder {
2591    fn drop(&mut self) {
2592        self.control_handle.shutdown();
2593        // Safety: drops once, never accessed again
2594        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2595    }
2596}
2597
2598impl fidl::endpoints::Responder for ControllerAddMonitorResponder {
2599    type ControlHandle = ControllerControlHandle;
2600
2601    fn control_handle(&self) -> &ControllerControlHandle {
2602        &self.control_handle
2603    }
2604
2605    fn drop_without_shutdown(mut self) {
2606        // Safety: drops once, never accessed again due to mem::forget
2607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2608        // Prevent Drop from running (which would shut down the channel)
2609        std::mem::forget(self);
2610    }
2611}
2612
2613impl ControllerAddMonitorResponder {
2614    /// Sends a response to the FIDL transaction.
2615    ///
2616    /// Sets the channel to shutdown if an error occurs.
2617    pub fn send(self) -> Result<(), fidl::Error> {
2618        let _result = self.send_raw();
2619        if _result.is_err() {
2620            self.control_handle.shutdown();
2621        }
2622        self.drop_without_shutdown();
2623        _result
2624    }
2625
2626    /// Similar to "send" but does not shutdown the channel if an error occurs.
2627    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2628        let _result = self.send_raw();
2629        self.drop_without_shutdown();
2630        _result
2631    }
2632
2633    fn send_raw(&self) -> Result<(), fidl::Error> {
2634        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2635            (),
2636            self.tx_id,
2637            0x2efbf7d3dc21438e,
2638            fidl::encoding::DynamicFlags::empty(),
2639        )
2640    }
2641}
2642
2643#[must_use = "FIDL methods require a response to be sent"]
2644#[derive(Debug)]
2645pub struct ControllerFuzzResponder {
2646    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2647    tx_id: u32,
2648}
2649
2650/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2651/// if the responder is dropped without sending a response, so that the client
2652/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2653impl std::ops::Drop for ControllerFuzzResponder {
2654    fn drop(&mut self) {
2655        self.control_handle.shutdown();
2656        // Safety: drops once, never accessed again
2657        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2658    }
2659}
2660
2661impl fidl::endpoints::Responder for ControllerFuzzResponder {
2662    type ControlHandle = ControllerControlHandle;
2663
2664    fn control_handle(&self) -> &ControllerControlHandle {
2665        &self.control_handle
2666    }
2667
2668    fn drop_without_shutdown(mut self) {
2669        // Safety: drops once, never accessed again due to mem::forget
2670        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2671        // Prevent Drop from running (which would shut down the channel)
2672        std::mem::forget(self);
2673    }
2674}
2675
2676impl ControllerFuzzResponder {
2677    /// Sends a response to the FIDL transaction.
2678    ///
2679    /// Sets the channel to shutdown if an error occurs.
2680    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2681        let _result = self.send_raw(result);
2682        if _result.is_err() {
2683            self.control_handle.shutdown();
2684        }
2685        self.drop_without_shutdown();
2686        _result
2687    }
2688
2689    /// Similar to "send" but does not shutdown the channel if an error occurs.
2690    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2691        let _result = self.send_raw(result);
2692        self.drop_without_shutdown();
2693        _result
2694    }
2695
2696    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2697        self.control_handle
2698            .inner
2699            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2700                result,
2701                self.tx_id,
2702                0x62fe3684ea23af62,
2703                fidl::encoding::DynamicFlags::empty(),
2704            )
2705    }
2706}
2707
2708#[must_use = "FIDL methods require a response to be sent"]
2709#[derive(Debug)]
2710pub struct ControllerTryOneResponder {
2711    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2712    tx_id: u32,
2713}
2714
2715/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2716/// if the responder is dropped without sending a response, so that the client
2717/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2718impl std::ops::Drop for ControllerTryOneResponder {
2719    fn drop(&mut self) {
2720        self.control_handle.shutdown();
2721        // Safety: drops once, never accessed again
2722        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2723    }
2724}
2725
2726impl fidl::endpoints::Responder for ControllerTryOneResponder {
2727    type ControlHandle = ControllerControlHandle;
2728
2729    fn control_handle(&self) -> &ControllerControlHandle {
2730        &self.control_handle
2731    }
2732
2733    fn drop_without_shutdown(mut self) {
2734        // Safety: drops once, never accessed again due to mem::forget
2735        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2736        // Prevent Drop from running (which would shut down the channel)
2737        std::mem::forget(self);
2738    }
2739}
2740
2741impl ControllerTryOneResponder {
2742    /// Sends a response to the FIDL transaction.
2743    ///
2744    /// Sets the channel to shutdown if an error occurs.
2745    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2746        let _result = self.send_raw(result);
2747        if _result.is_err() {
2748            self.control_handle.shutdown();
2749        }
2750        self.drop_without_shutdown();
2751        _result
2752    }
2753
2754    /// Similar to "send" but does not shutdown the channel if an error occurs.
2755    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2756        let _result = self.send_raw(result);
2757        self.drop_without_shutdown();
2758        _result
2759    }
2760
2761    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2762        self.control_handle
2763            .inner
2764            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2765                result,
2766                self.tx_id,
2767                0x368dc762d8e16d46,
2768                fidl::encoding::DynamicFlags::empty(),
2769            )
2770    }
2771}
2772
2773#[must_use = "FIDL methods require a response to be sent"]
2774#[derive(Debug)]
2775pub struct ControllerMinimizeResponder {
2776    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2777    tx_id: u32,
2778}
2779
2780/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2781/// if the responder is dropped without sending a response, so that the client
2782/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2783impl std::ops::Drop for ControllerMinimizeResponder {
2784    fn drop(&mut self) {
2785        self.control_handle.shutdown();
2786        // Safety: drops once, never accessed again
2787        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2788    }
2789}
2790
2791impl fidl::endpoints::Responder for ControllerMinimizeResponder {
2792    type ControlHandle = ControllerControlHandle;
2793
2794    fn control_handle(&self) -> &ControllerControlHandle {
2795        &self.control_handle
2796    }
2797
2798    fn drop_without_shutdown(mut self) {
2799        // Safety: drops once, never accessed again due to mem::forget
2800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2801        // Prevent Drop from running (which would shut down the channel)
2802        std::mem::forget(self);
2803    }
2804}
2805
2806impl ControllerMinimizeResponder {
2807    /// Sends a response to the FIDL transaction.
2808    ///
2809    /// Sets the channel to shutdown if an error occurs.
2810    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2811        let _result = self.send_raw(result);
2812        if _result.is_err() {
2813            self.control_handle.shutdown();
2814        }
2815        self.drop_without_shutdown();
2816        _result
2817    }
2818
2819    /// Similar to "send" but does not shutdown the channel if an error occurs.
2820    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2821        let _result = self.send_raw(result);
2822        self.drop_without_shutdown();
2823        _result
2824    }
2825
2826    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2827        self.control_handle
2828            .inner
2829            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2830                result,
2831                self.tx_id,
2832                0x105a242ee0552794,
2833                fidl::encoding::DynamicFlags::empty(),
2834            )
2835    }
2836}
2837
2838#[must_use = "FIDL methods require a response to be sent"]
2839#[derive(Debug)]
2840pub struct ControllerCleanseResponder {
2841    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2842    tx_id: u32,
2843}
2844
2845/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2846/// if the responder is dropped without sending a response, so that the client
2847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2848impl std::ops::Drop for ControllerCleanseResponder {
2849    fn drop(&mut self) {
2850        self.control_handle.shutdown();
2851        // Safety: drops once, never accessed again
2852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2853    }
2854}
2855
2856impl fidl::endpoints::Responder for ControllerCleanseResponder {
2857    type ControlHandle = ControllerControlHandle;
2858
2859    fn control_handle(&self) -> &ControllerControlHandle {
2860        &self.control_handle
2861    }
2862
2863    fn drop_without_shutdown(mut self) {
2864        // Safety: drops once, never accessed again due to mem::forget
2865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2866        // Prevent Drop from running (which would shut down the channel)
2867        std::mem::forget(self);
2868    }
2869}
2870
2871impl ControllerCleanseResponder {
2872    /// Sends a response to the FIDL transaction.
2873    ///
2874    /// Sets the channel to shutdown if an error occurs.
2875    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2876        let _result = self.send_raw(result);
2877        if _result.is_err() {
2878            self.control_handle.shutdown();
2879        }
2880        self.drop_without_shutdown();
2881        _result
2882    }
2883
2884    /// Similar to "send" but does not shutdown the channel if an error occurs.
2885    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2886        let _result = self.send_raw(result);
2887        self.drop_without_shutdown();
2888        _result
2889    }
2890
2891    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2892        self.control_handle
2893            .inner
2894            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2895                result,
2896                self.tx_id,
2897                0x6d7892f62735f3e0,
2898                fidl::encoding::DynamicFlags::empty(),
2899            )
2900    }
2901}
2902
2903#[must_use = "FIDL methods require a response to be sent"]
2904#[derive(Debug)]
2905pub struct ControllerMergeResponder {
2906    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2907    tx_id: u32,
2908}
2909
2910/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2911/// if the responder is dropped without sending a response, so that the client
2912/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2913impl std::ops::Drop for ControllerMergeResponder {
2914    fn drop(&mut self) {
2915        self.control_handle.shutdown();
2916        // Safety: drops once, never accessed again
2917        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2918    }
2919}
2920
2921impl fidl::endpoints::Responder for ControllerMergeResponder {
2922    type ControlHandle = ControllerControlHandle;
2923
2924    fn control_handle(&self) -> &ControllerControlHandle {
2925        &self.control_handle
2926    }
2927
2928    fn drop_without_shutdown(mut self) {
2929        // Safety: drops once, never accessed again due to mem::forget
2930        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2931        // Prevent Drop from running (which would shut down the channel)
2932        std::mem::forget(self);
2933    }
2934}
2935
2936impl ControllerMergeResponder {
2937    /// Sends a response to the FIDL transaction.
2938    ///
2939    /// Sets the channel to shutdown if an error occurs.
2940    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2941        let _result = self.send_raw(result);
2942        if _result.is_err() {
2943            self.control_handle.shutdown();
2944        }
2945        self.drop_without_shutdown();
2946        _result
2947    }
2948
2949    /// Similar to "send" but does not shutdown the channel if an error occurs.
2950    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2951        let _result = self.send_raw(result);
2952        self.drop_without_shutdown();
2953        _result
2954    }
2955
2956    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2957        self.control_handle
2958            .inner
2959            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2960                result,
2961                self.tx_id,
2962                0x3614e5c39413b5eb,
2963                fidl::encoding::DynamicFlags::empty(),
2964            )
2965    }
2966}
2967
2968#[must_use = "FIDL methods require a response to be sent"]
2969#[derive(Debug)]
2970pub struct ControllerGetStatusResponder {
2971    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2972    tx_id: u32,
2973}
2974
2975/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2976/// if the responder is dropped without sending a response, so that the client
2977/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2978impl std::ops::Drop for ControllerGetStatusResponder {
2979    fn drop(&mut self) {
2980        self.control_handle.shutdown();
2981        // Safety: drops once, never accessed again
2982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2983    }
2984}
2985
2986impl fidl::endpoints::Responder for ControllerGetStatusResponder {
2987    type ControlHandle = ControllerControlHandle;
2988
2989    fn control_handle(&self) -> &ControllerControlHandle {
2990        &self.control_handle
2991    }
2992
2993    fn drop_without_shutdown(mut self) {
2994        // Safety: drops once, never accessed again due to mem::forget
2995        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2996        // Prevent Drop from running (which would shut down the channel)
2997        std::mem::forget(self);
2998    }
2999}
3000
3001impl ControllerGetStatusResponder {
3002    /// Sends a response to the FIDL transaction.
3003    ///
3004    /// Sets the channel to shutdown if an error occurs.
3005    pub fn send(self, mut status: &Status) -> Result<(), fidl::Error> {
3006        let _result = self.send_raw(status);
3007        if _result.is_err() {
3008            self.control_handle.shutdown();
3009        }
3010        self.drop_without_shutdown();
3011        _result
3012    }
3013
3014    /// Similar to "send" but does not shutdown the channel if an error occurs.
3015    pub fn send_no_shutdown_on_err(self, mut status: &Status) -> Result<(), fidl::Error> {
3016        let _result = self.send_raw(status);
3017        self.drop_without_shutdown();
3018        _result
3019    }
3020
3021    fn send_raw(&self, mut status: &Status) -> Result<(), fidl::Error> {
3022        self.control_handle.inner.send::<ControllerGetStatusResponse>(
3023            (status,),
3024            self.tx_id,
3025            0x51db4975d93ce768,
3026            fidl::encoding::DynamicFlags::empty(),
3027        )
3028    }
3029}
3030
3031#[must_use = "FIDL methods require a response to be sent"]
3032#[derive(Debug)]
3033pub struct ControllerWatchArtifactResponder {
3034    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
3035    tx_id: u32,
3036}
3037
3038/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
3039/// if the responder is dropped without sending a response, so that the client
3040/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3041impl std::ops::Drop for ControllerWatchArtifactResponder {
3042    fn drop(&mut self) {
3043        self.control_handle.shutdown();
3044        // Safety: drops once, never accessed again
3045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3046    }
3047}
3048
3049impl fidl::endpoints::Responder for ControllerWatchArtifactResponder {
3050    type ControlHandle = ControllerControlHandle;
3051
3052    fn control_handle(&self) -> &ControllerControlHandle {
3053        &self.control_handle
3054    }
3055
3056    fn drop_without_shutdown(mut self) {
3057        // Safety: drops once, never accessed again due to mem::forget
3058        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3059        // Prevent Drop from running (which would shut down the channel)
3060        std::mem::forget(self);
3061    }
3062}
3063
3064impl ControllerWatchArtifactResponder {
3065    /// Sends a response to the FIDL transaction.
3066    ///
3067    /// Sets the channel to shutdown if an error occurs.
3068    pub fn send(self, mut artifact: Artifact) -> Result<(), fidl::Error> {
3069        let _result = self.send_raw(artifact);
3070        if _result.is_err() {
3071            self.control_handle.shutdown();
3072        }
3073        self.drop_without_shutdown();
3074        _result
3075    }
3076
3077    /// Similar to "send" but does not shutdown the channel if an error occurs.
3078    pub fn send_no_shutdown_on_err(self, mut artifact: Artifact) -> Result<(), fidl::Error> {
3079        let _result = self.send_raw(artifact);
3080        self.drop_without_shutdown();
3081        _result
3082    }
3083
3084    fn send_raw(&self, mut artifact: Artifact) -> Result<(), fidl::Error> {
3085        self.control_handle.inner.send::<ControllerWatchArtifactResponse>(
3086            (&mut artifact,),
3087            self.tx_id,
3088            0x6cfca3730944a414,
3089            fidl::encoding::DynamicFlags::empty(),
3090        )
3091    }
3092}
3093
3094#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3095pub struct ControllerProviderMarker;
3096
3097impl fidl::endpoints::ProtocolMarker for ControllerProviderMarker {
3098    type Proxy = ControllerProviderProxy;
3099    type RequestStream = ControllerProviderRequestStream;
3100    #[cfg(target_os = "fuchsia")]
3101    type SynchronousProxy = ControllerProviderSynchronousProxy;
3102
3103    const DEBUG_NAME: &'static str = "(anonymous) ControllerProvider";
3104}
3105
3106pub trait ControllerProviderProxyInterface: Send + Sync {
3107    type ConnectResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3108    fn r#connect(
3109        &self,
3110        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
3111    ) -> Self::ConnectResponseFut;
3112    fn r#stop(&self) -> Result<(), fidl::Error>;
3113}
3114#[derive(Debug)]
3115#[cfg(target_os = "fuchsia")]
3116pub struct ControllerProviderSynchronousProxy {
3117    client: fidl::client::sync::Client,
3118}
3119
3120#[cfg(target_os = "fuchsia")]
3121impl fidl::endpoints::SynchronousProxy for ControllerProviderSynchronousProxy {
3122    type Proxy = ControllerProviderProxy;
3123    type Protocol = ControllerProviderMarker;
3124
3125    fn from_channel(inner: fidl::Channel) -> Self {
3126        Self::new(inner)
3127    }
3128
3129    fn into_channel(self) -> fidl::Channel {
3130        self.client.into_channel()
3131    }
3132
3133    fn as_channel(&self) -> &fidl::Channel {
3134        self.client.as_channel()
3135    }
3136}
3137
3138#[cfg(target_os = "fuchsia")]
3139impl ControllerProviderSynchronousProxy {
3140    pub fn new(channel: fidl::Channel) -> Self {
3141        Self { client: fidl::client::sync::Client::new(channel) }
3142    }
3143
3144    pub fn into_channel(self) -> fidl::Channel {
3145        self.client.into_channel()
3146    }
3147
3148    /// Waits until an event arrives and returns it. It is safe for other
3149    /// threads to make concurrent requests while waiting for an event.
3150    pub fn wait_for_event(
3151        &self,
3152        deadline: zx::MonotonicInstant,
3153    ) -> Result<ControllerProviderEvent, fidl::Error> {
3154        ControllerProviderEvent::decode(
3155            self.client.wait_for_event::<ControllerProviderMarker>(deadline)?,
3156        )
3157    }
3158
3159    /// Connects a client to the fuzzer.
3160    ///
3161    /// Within the component fuzzing framework, the fuzz-manager forwards
3162    /// `Controller` connection requests to the fuzz-registry, which uses
3163    /// clients of this interface provided by the fuzzers themselves to perform
3164    /// the connection.
3165    ///
3166    /// At most one client can be connected to a controller at any given time.
3167    /// A subsequent call to `Connect` will preempt and replace the existing
3168    /// connection.
3169    ///
3170    /// + request `controller` the connection from the client.
3171    pub fn r#connect(
3172        &self,
3173        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
3174        ___deadline: zx::MonotonicInstant,
3175    ) -> Result<(), fidl::Error> {
3176        let _response = self.client.send_query::<
3177            ControllerProviderConnectRequest,
3178            fidl::encoding::EmptyPayload,
3179            ControllerProviderMarker,
3180        >(
3181            (controller,),
3182            0xc0325f0732defcb,
3183            fidl::encoding::DynamicFlags::empty(),
3184            ___deadline,
3185        )?;
3186        Ok(_response)
3187    }
3188
3189    /// Interrupt any current workflow, closes the channel, and exits the
3190    /// fuzzing engine.
3191    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3192        self.client.send::<fidl::encoding::EmptyPayload>(
3193            (),
3194            0x6cd6a98fc38bcbf2,
3195            fidl::encoding::DynamicFlags::empty(),
3196        )
3197    }
3198}
3199
3200#[cfg(target_os = "fuchsia")]
3201impl From<ControllerProviderSynchronousProxy> for zx::NullableHandle {
3202    fn from(value: ControllerProviderSynchronousProxy) -> Self {
3203        value.into_channel().into()
3204    }
3205}
3206
3207#[cfg(target_os = "fuchsia")]
3208impl From<fidl::Channel> for ControllerProviderSynchronousProxy {
3209    fn from(value: fidl::Channel) -> Self {
3210        Self::new(value)
3211    }
3212}
3213
3214#[cfg(target_os = "fuchsia")]
3215impl fidl::endpoints::FromClient for ControllerProviderSynchronousProxy {
3216    type Protocol = ControllerProviderMarker;
3217
3218    fn from_client(value: fidl::endpoints::ClientEnd<ControllerProviderMarker>) -> Self {
3219        Self::new(value.into_channel())
3220    }
3221}
3222
3223#[derive(Debug, Clone)]
3224pub struct ControllerProviderProxy {
3225    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3226}
3227
3228impl fidl::endpoints::Proxy for ControllerProviderProxy {
3229    type Protocol = ControllerProviderMarker;
3230
3231    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3232        Self::new(inner)
3233    }
3234
3235    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3236        self.client.into_channel().map_err(|client| Self { client })
3237    }
3238
3239    fn as_channel(&self) -> &::fidl::AsyncChannel {
3240        self.client.as_channel()
3241    }
3242}
3243
3244impl ControllerProviderProxy {
3245    /// Create a new Proxy for fuchsia.fuzzer/ControllerProvider.
3246    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3247        let protocol_name =
3248            <ControllerProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3249        Self { client: fidl::client::Client::new(channel, protocol_name) }
3250    }
3251
3252    /// Get a Stream of events from the remote end of the protocol.
3253    ///
3254    /// # Panics
3255    ///
3256    /// Panics if the event stream was already taken.
3257    pub fn take_event_stream(&self) -> ControllerProviderEventStream {
3258        ControllerProviderEventStream { event_receiver: self.client.take_event_receiver() }
3259    }
3260
3261    /// Connects a client to the fuzzer.
3262    ///
3263    /// Within the component fuzzing framework, the fuzz-manager forwards
3264    /// `Controller` connection requests to the fuzz-registry, which uses
3265    /// clients of this interface provided by the fuzzers themselves to perform
3266    /// the connection.
3267    ///
3268    /// At most one client can be connected to a controller at any given time.
3269    /// A subsequent call to `Connect` will preempt and replace the existing
3270    /// connection.
3271    ///
3272    /// + request `controller` the connection from the client.
3273    pub fn r#connect(
3274        &self,
3275        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
3276    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3277        ControllerProviderProxyInterface::r#connect(self, controller)
3278    }
3279
3280    /// Interrupt any current workflow, closes the channel, and exits the
3281    /// fuzzing engine.
3282    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3283        ControllerProviderProxyInterface::r#stop(self)
3284    }
3285}
3286
3287impl ControllerProviderProxyInterface for ControllerProviderProxy {
3288    type ConnectResponseFut =
3289        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3290    fn r#connect(
3291        &self,
3292        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
3293    ) -> Self::ConnectResponseFut {
3294        fn _decode(
3295            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3296        ) -> Result<(), fidl::Error> {
3297            let _response = fidl::client::decode_transaction_body::<
3298                fidl::encoding::EmptyPayload,
3299                fidl::encoding::DefaultFuchsiaResourceDialect,
3300                0xc0325f0732defcb,
3301            >(_buf?)?;
3302            Ok(_response)
3303        }
3304        self.client.send_query_and_decode::<ControllerProviderConnectRequest, ()>(
3305            (controller,),
3306            0xc0325f0732defcb,
3307            fidl::encoding::DynamicFlags::empty(),
3308            _decode,
3309        )
3310    }
3311
3312    fn r#stop(&self) -> Result<(), fidl::Error> {
3313        self.client.send::<fidl::encoding::EmptyPayload>(
3314            (),
3315            0x6cd6a98fc38bcbf2,
3316            fidl::encoding::DynamicFlags::empty(),
3317        )
3318    }
3319}
3320
3321pub struct ControllerProviderEventStream {
3322    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3323}
3324
3325impl std::marker::Unpin for ControllerProviderEventStream {}
3326
3327impl futures::stream::FusedStream for ControllerProviderEventStream {
3328    fn is_terminated(&self) -> bool {
3329        self.event_receiver.is_terminated()
3330    }
3331}
3332
3333impl futures::Stream for ControllerProviderEventStream {
3334    type Item = Result<ControllerProviderEvent, fidl::Error>;
3335
3336    fn poll_next(
3337        mut self: std::pin::Pin<&mut Self>,
3338        cx: &mut std::task::Context<'_>,
3339    ) -> std::task::Poll<Option<Self::Item>> {
3340        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3341            &mut self.event_receiver,
3342            cx
3343        )?) {
3344            Some(buf) => std::task::Poll::Ready(Some(ControllerProviderEvent::decode(buf))),
3345            None => std::task::Poll::Ready(None),
3346        }
3347    }
3348}
3349
3350#[derive(Debug)]
3351pub enum ControllerProviderEvent {}
3352
3353impl ControllerProviderEvent {
3354    /// Decodes a message buffer as a [`ControllerProviderEvent`].
3355    fn decode(
3356        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3357    ) -> Result<ControllerProviderEvent, fidl::Error> {
3358        let (bytes, _handles) = buf.split_mut();
3359        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3360        debug_assert_eq!(tx_header.tx_id, 0);
3361        match tx_header.ordinal {
3362            _ => Err(fidl::Error::UnknownOrdinal {
3363                ordinal: tx_header.ordinal,
3364                protocol_name:
3365                    <ControllerProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3366            }),
3367        }
3368    }
3369}
3370
3371/// A Stream of incoming requests for fuchsia.fuzzer/ControllerProvider.
3372pub struct ControllerProviderRequestStream {
3373    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3374    is_terminated: bool,
3375}
3376
3377impl std::marker::Unpin for ControllerProviderRequestStream {}
3378
3379impl futures::stream::FusedStream for ControllerProviderRequestStream {
3380    fn is_terminated(&self) -> bool {
3381        self.is_terminated
3382    }
3383}
3384
3385impl fidl::endpoints::RequestStream for ControllerProviderRequestStream {
3386    type Protocol = ControllerProviderMarker;
3387    type ControlHandle = ControllerProviderControlHandle;
3388
3389    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3390        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3391    }
3392
3393    fn control_handle(&self) -> Self::ControlHandle {
3394        ControllerProviderControlHandle { inner: self.inner.clone() }
3395    }
3396
3397    fn into_inner(
3398        self,
3399    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3400    {
3401        (self.inner, self.is_terminated)
3402    }
3403
3404    fn from_inner(
3405        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3406        is_terminated: bool,
3407    ) -> Self {
3408        Self { inner, is_terminated }
3409    }
3410}
3411
3412impl futures::Stream for ControllerProviderRequestStream {
3413    type Item = Result<ControllerProviderRequest, fidl::Error>;
3414
3415    fn poll_next(
3416        mut self: std::pin::Pin<&mut Self>,
3417        cx: &mut std::task::Context<'_>,
3418    ) -> std::task::Poll<Option<Self::Item>> {
3419        let this = &mut *self;
3420        if this.inner.check_shutdown(cx) {
3421            this.is_terminated = true;
3422            return std::task::Poll::Ready(None);
3423        }
3424        if this.is_terminated {
3425            panic!("polled ControllerProviderRequestStream after completion");
3426        }
3427        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3428            |bytes, handles| {
3429                match this.inner.channel().read_etc(cx, bytes, handles) {
3430                    std::task::Poll::Ready(Ok(())) => {}
3431                    std::task::Poll::Pending => return std::task::Poll::Pending,
3432                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3433                        this.is_terminated = true;
3434                        return std::task::Poll::Ready(None);
3435                    }
3436                    std::task::Poll::Ready(Err(e)) => {
3437                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3438                            e.into(),
3439                        ))));
3440                    }
3441                }
3442
3443                // A message has been received from the channel
3444                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3445
3446                std::task::Poll::Ready(Some(match header.ordinal {
3447                0xc0325f0732defcb => {
3448                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3449                    let mut req = fidl::new_empty!(ControllerProviderConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3450                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerProviderConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3451                    let control_handle = ControllerProviderControlHandle {
3452                        inner: this.inner.clone(),
3453                    };
3454                    Ok(ControllerProviderRequest::Connect {controller: req.controller,
3455
3456                        responder: ControllerProviderConnectResponder {
3457                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3458                            tx_id: header.tx_id,
3459                        },
3460                    })
3461                }
3462                0x6cd6a98fc38bcbf2 => {
3463                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3464                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3465                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3466                    let control_handle = ControllerProviderControlHandle {
3467                        inner: this.inner.clone(),
3468                    };
3469                    Ok(ControllerProviderRequest::Stop {
3470                        control_handle,
3471                    })
3472                }
3473                _ => Err(fidl::Error::UnknownOrdinal {
3474                    ordinal: header.ordinal,
3475                    protocol_name: <ControllerProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3476                }),
3477            }))
3478            },
3479        )
3480    }
3481}
3482
3483/// Provides a `Controller` implementation.
3484///
3485/// This protocol is implemented by the fuzzing engine. This capability is *not*
3486/// routed. Instead, the engine uses the `fuchsia.fuzzer/Registry` channel
3487/// provided by the fuzz-test-runner to send the client end of this interface to
3488/// the fuzz-registry.
3489///
3490/// The fuzz-registry will close the channel upon error, or upon its own exit.
3491/// The fuzzer should exit and not attempt to reconnect when on channel close.
3492#[derive(Debug)]
3493pub enum ControllerProviderRequest {
3494    /// Connects a client to the fuzzer.
3495    ///
3496    /// Within the component fuzzing framework, the fuzz-manager forwards
3497    /// `Controller` connection requests to the fuzz-registry, which uses
3498    /// clients of this interface provided by the fuzzers themselves to perform
3499    /// the connection.
3500    ///
3501    /// At most one client can be connected to a controller at any given time.
3502    /// A subsequent call to `Connect` will preempt and replace the existing
3503    /// connection.
3504    ///
3505    /// + request `controller` the connection from the client.
3506    Connect {
3507        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
3508        responder: ControllerProviderConnectResponder,
3509    },
3510    /// Interrupt any current workflow, closes the channel, and exits the
3511    /// fuzzing engine.
3512    Stop { control_handle: ControllerProviderControlHandle },
3513}
3514
3515impl ControllerProviderRequest {
3516    #[allow(irrefutable_let_patterns)]
3517    pub fn into_connect(
3518        self,
3519    ) -> Option<(fidl::endpoints::ServerEnd<ControllerMarker>, ControllerProviderConnectResponder)>
3520    {
3521        if let ControllerProviderRequest::Connect { controller, responder } = self {
3522            Some((controller, responder))
3523        } else {
3524            None
3525        }
3526    }
3527
3528    #[allow(irrefutable_let_patterns)]
3529    pub fn into_stop(self) -> Option<(ControllerProviderControlHandle)> {
3530        if let ControllerProviderRequest::Stop { control_handle } = self {
3531            Some((control_handle))
3532        } else {
3533            None
3534        }
3535    }
3536
3537    /// Name of the method defined in FIDL
3538    pub fn method_name(&self) -> &'static str {
3539        match *self {
3540            ControllerProviderRequest::Connect { .. } => "connect",
3541            ControllerProviderRequest::Stop { .. } => "stop",
3542        }
3543    }
3544}
3545
3546#[derive(Debug, Clone)]
3547pub struct ControllerProviderControlHandle {
3548    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3549}
3550
3551impl fidl::endpoints::ControlHandle for ControllerProviderControlHandle {
3552    fn shutdown(&self) {
3553        self.inner.shutdown()
3554    }
3555
3556    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3557        self.inner.shutdown_with_epitaph(status)
3558    }
3559
3560    fn is_closed(&self) -> bool {
3561        self.inner.channel().is_closed()
3562    }
3563    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3564        self.inner.channel().on_closed()
3565    }
3566
3567    #[cfg(target_os = "fuchsia")]
3568    fn signal_peer(
3569        &self,
3570        clear_mask: zx::Signals,
3571        set_mask: zx::Signals,
3572    ) -> Result<(), zx_status::Status> {
3573        use fidl::Peered;
3574        self.inner.channel().signal_peer(clear_mask, set_mask)
3575    }
3576}
3577
3578impl ControllerProviderControlHandle {}
3579
3580#[must_use = "FIDL methods require a response to be sent"]
3581#[derive(Debug)]
3582pub struct ControllerProviderConnectResponder {
3583    control_handle: std::mem::ManuallyDrop<ControllerProviderControlHandle>,
3584    tx_id: u32,
3585}
3586
3587/// Set the the channel to be shutdown (see [`ControllerProviderControlHandle::shutdown`])
3588/// if the responder is dropped without sending a response, so that the client
3589/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3590impl std::ops::Drop for ControllerProviderConnectResponder {
3591    fn drop(&mut self) {
3592        self.control_handle.shutdown();
3593        // Safety: drops once, never accessed again
3594        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3595    }
3596}
3597
3598impl fidl::endpoints::Responder for ControllerProviderConnectResponder {
3599    type ControlHandle = ControllerProviderControlHandle;
3600
3601    fn control_handle(&self) -> &ControllerProviderControlHandle {
3602        &self.control_handle
3603    }
3604
3605    fn drop_without_shutdown(mut self) {
3606        // Safety: drops once, never accessed again due to mem::forget
3607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3608        // Prevent Drop from running (which would shut down the channel)
3609        std::mem::forget(self);
3610    }
3611}
3612
3613impl ControllerProviderConnectResponder {
3614    /// Sends a response to the FIDL transaction.
3615    ///
3616    /// Sets the channel to shutdown if an error occurs.
3617    pub fn send(self) -> Result<(), fidl::Error> {
3618        let _result = self.send_raw();
3619        if _result.is_err() {
3620            self.control_handle.shutdown();
3621        }
3622        self.drop_without_shutdown();
3623        _result
3624    }
3625
3626    /// Similar to "send" but does not shutdown the channel if an error occurs.
3627    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3628        let _result = self.send_raw();
3629        self.drop_without_shutdown();
3630        _result
3631    }
3632
3633    fn send_raw(&self) -> Result<(), fidl::Error> {
3634        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3635            (),
3636            self.tx_id,
3637            0xc0325f0732defcb,
3638            fidl::encoding::DynamicFlags::empty(),
3639        )
3640    }
3641}
3642
3643#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3644pub struct CorpusReaderMarker;
3645
3646impl fidl::endpoints::ProtocolMarker for CorpusReaderMarker {
3647    type Proxy = CorpusReaderProxy;
3648    type RequestStream = CorpusReaderRequestStream;
3649    #[cfg(target_os = "fuchsia")]
3650    type SynchronousProxy = CorpusReaderSynchronousProxy;
3651
3652    const DEBUG_NAME: &'static str = "(anonymous) CorpusReader";
3653}
3654
3655pub trait CorpusReaderProxyInterface: Send + Sync {
3656    type NextResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
3657    fn r#next(&self, test_input: Input) -> Self::NextResponseFut;
3658}
3659#[derive(Debug)]
3660#[cfg(target_os = "fuchsia")]
3661pub struct CorpusReaderSynchronousProxy {
3662    client: fidl::client::sync::Client,
3663}
3664
3665#[cfg(target_os = "fuchsia")]
3666impl fidl::endpoints::SynchronousProxy for CorpusReaderSynchronousProxy {
3667    type Proxy = CorpusReaderProxy;
3668    type Protocol = CorpusReaderMarker;
3669
3670    fn from_channel(inner: fidl::Channel) -> Self {
3671        Self::new(inner)
3672    }
3673
3674    fn into_channel(self) -> fidl::Channel {
3675        self.client.into_channel()
3676    }
3677
3678    fn as_channel(&self) -> &fidl::Channel {
3679        self.client.as_channel()
3680    }
3681}
3682
3683#[cfg(target_os = "fuchsia")]
3684impl CorpusReaderSynchronousProxy {
3685    pub fn new(channel: fidl::Channel) -> Self {
3686        Self { client: fidl::client::sync::Client::new(channel) }
3687    }
3688
3689    pub fn into_channel(self) -> fidl::Channel {
3690        self.client.into_channel()
3691    }
3692
3693    /// Waits until an event arrives and returns it. It is safe for other
3694    /// threads to make concurrent requests while waiting for an event.
3695    pub fn wait_for_event(
3696        &self,
3697        deadline: zx::MonotonicInstant,
3698    ) -> Result<CorpusReaderEvent, fidl::Error> {
3699        CorpusReaderEvent::decode(self.client.wait_for_event::<CorpusReaderMarker>(deadline)?)
3700    }
3701
3702    /// Sends the next test input from the corpus.
3703    ///
3704    /// + request `test_input` the byte sequence representing the next test
3705    ///   input in a corpus.
3706    /// - response `result` one of the following:
3707    ///     - `ZX_OK` if the test input was sent.
3708    ///     - A socket error if transferring the input failed.
3709    pub fn r#next(
3710        &self,
3711        mut test_input: Input,
3712        ___deadline: zx::MonotonicInstant,
3713    ) -> Result<i32, fidl::Error> {
3714        let _response = self
3715            .client
3716            .send_query::<CorpusReaderNextRequest, CorpusReaderNextResponse, CorpusReaderMarker>(
3717                (&mut test_input,),
3718                0x68d19e55ea635356,
3719                fidl::encoding::DynamicFlags::empty(),
3720                ___deadline,
3721            )?;
3722        Ok(_response.result)
3723    }
3724}
3725
3726#[cfg(target_os = "fuchsia")]
3727impl From<CorpusReaderSynchronousProxy> for zx::NullableHandle {
3728    fn from(value: CorpusReaderSynchronousProxy) -> Self {
3729        value.into_channel().into()
3730    }
3731}
3732
3733#[cfg(target_os = "fuchsia")]
3734impl From<fidl::Channel> for CorpusReaderSynchronousProxy {
3735    fn from(value: fidl::Channel) -> Self {
3736        Self::new(value)
3737    }
3738}
3739
3740#[cfg(target_os = "fuchsia")]
3741impl fidl::endpoints::FromClient for CorpusReaderSynchronousProxy {
3742    type Protocol = CorpusReaderMarker;
3743
3744    fn from_client(value: fidl::endpoints::ClientEnd<CorpusReaderMarker>) -> Self {
3745        Self::new(value.into_channel())
3746    }
3747}
3748
3749#[derive(Debug, Clone)]
3750pub struct CorpusReaderProxy {
3751    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3752}
3753
3754impl fidl::endpoints::Proxy for CorpusReaderProxy {
3755    type Protocol = CorpusReaderMarker;
3756
3757    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3758        Self::new(inner)
3759    }
3760
3761    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3762        self.client.into_channel().map_err(|client| Self { client })
3763    }
3764
3765    fn as_channel(&self) -> &::fidl::AsyncChannel {
3766        self.client.as_channel()
3767    }
3768}
3769
3770impl CorpusReaderProxy {
3771    /// Create a new Proxy for fuchsia.fuzzer/CorpusReader.
3772    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3773        let protocol_name = <CorpusReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3774        Self { client: fidl::client::Client::new(channel, protocol_name) }
3775    }
3776
3777    /// Get a Stream of events from the remote end of the protocol.
3778    ///
3779    /// # Panics
3780    ///
3781    /// Panics if the event stream was already taken.
3782    pub fn take_event_stream(&self) -> CorpusReaderEventStream {
3783        CorpusReaderEventStream { event_receiver: self.client.take_event_receiver() }
3784    }
3785
3786    /// Sends the next test input from the corpus.
3787    ///
3788    /// + request `test_input` the byte sequence representing the next test
3789    ///   input in a corpus.
3790    /// - response `result` one of the following:
3791    ///     - `ZX_OK` if the test input was sent.
3792    ///     - A socket error if transferring the input failed.
3793    pub fn r#next(
3794        &self,
3795        mut test_input: Input,
3796    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
3797        CorpusReaderProxyInterface::r#next(self, test_input)
3798    }
3799}
3800
3801impl CorpusReaderProxyInterface for CorpusReaderProxy {
3802    type NextResponseFut =
3803        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
3804    fn r#next(&self, mut test_input: Input) -> Self::NextResponseFut {
3805        fn _decode(
3806            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3807        ) -> Result<i32, fidl::Error> {
3808            let _response = fidl::client::decode_transaction_body::<
3809                CorpusReaderNextResponse,
3810                fidl::encoding::DefaultFuchsiaResourceDialect,
3811                0x68d19e55ea635356,
3812            >(_buf?)?;
3813            Ok(_response.result)
3814        }
3815        self.client.send_query_and_decode::<CorpusReaderNextRequest, i32>(
3816            (&mut test_input,),
3817            0x68d19e55ea635356,
3818            fidl::encoding::DynamicFlags::empty(),
3819            _decode,
3820        )
3821    }
3822}
3823
3824pub struct CorpusReaderEventStream {
3825    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3826}
3827
3828impl std::marker::Unpin for CorpusReaderEventStream {}
3829
3830impl futures::stream::FusedStream for CorpusReaderEventStream {
3831    fn is_terminated(&self) -> bool {
3832        self.event_receiver.is_terminated()
3833    }
3834}
3835
3836impl futures::Stream for CorpusReaderEventStream {
3837    type Item = Result<CorpusReaderEvent, fidl::Error>;
3838
3839    fn poll_next(
3840        mut self: std::pin::Pin<&mut Self>,
3841        cx: &mut std::task::Context<'_>,
3842    ) -> std::task::Poll<Option<Self::Item>> {
3843        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3844            &mut self.event_receiver,
3845            cx
3846        )?) {
3847            Some(buf) => std::task::Poll::Ready(Some(CorpusReaderEvent::decode(buf))),
3848            None => std::task::Poll::Ready(None),
3849        }
3850    }
3851}
3852
3853#[derive(Debug)]
3854pub enum CorpusReaderEvent {}
3855
3856impl CorpusReaderEvent {
3857    /// Decodes a message buffer as a [`CorpusReaderEvent`].
3858    fn decode(
3859        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3860    ) -> Result<CorpusReaderEvent, fidl::Error> {
3861        let (bytes, _handles) = buf.split_mut();
3862        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3863        debug_assert_eq!(tx_header.tx_id, 0);
3864        match tx_header.ordinal {
3865            _ => Err(fidl::Error::UnknownOrdinal {
3866                ordinal: tx_header.ordinal,
3867                protocol_name: <CorpusReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3868            }),
3869        }
3870    }
3871}
3872
3873/// A Stream of incoming requests for fuchsia.fuzzer/CorpusReader.
3874pub struct CorpusReaderRequestStream {
3875    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3876    is_terminated: bool,
3877}
3878
3879impl std::marker::Unpin for CorpusReaderRequestStream {}
3880
3881impl futures::stream::FusedStream for CorpusReaderRequestStream {
3882    fn is_terminated(&self) -> bool {
3883        self.is_terminated
3884    }
3885}
3886
3887impl fidl::endpoints::RequestStream for CorpusReaderRequestStream {
3888    type Protocol = CorpusReaderMarker;
3889    type ControlHandle = CorpusReaderControlHandle;
3890
3891    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3892        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3893    }
3894
3895    fn control_handle(&self) -> Self::ControlHandle {
3896        CorpusReaderControlHandle { inner: self.inner.clone() }
3897    }
3898
3899    fn into_inner(
3900        self,
3901    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3902    {
3903        (self.inner, self.is_terminated)
3904    }
3905
3906    fn from_inner(
3907        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3908        is_terminated: bool,
3909    ) -> Self {
3910        Self { inner, is_terminated }
3911    }
3912}
3913
3914impl futures::Stream for CorpusReaderRequestStream {
3915    type Item = Result<CorpusReaderRequest, fidl::Error>;
3916
3917    fn poll_next(
3918        mut self: std::pin::Pin<&mut Self>,
3919        cx: &mut std::task::Context<'_>,
3920    ) -> std::task::Poll<Option<Self::Item>> {
3921        let this = &mut *self;
3922        if this.inner.check_shutdown(cx) {
3923            this.is_terminated = true;
3924            return std::task::Poll::Ready(None);
3925        }
3926        if this.is_terminated {
3927            panic!("polled CorpusReaderRequestStream after completion");
3928        }
3929        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3930            |bytes, handles| {
3931                match this.inner.channel().read_etc(cx, bytes, handles) {
3932                    std::task::Poll::Ready(Ok(())) => {}
3933                    std::task::Poll::Pending => return std::task::Poll::Pending,
3934                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3935                        this.is_terminated = true;
3936                        return std::task::Poll::Ready(None);
3937                    }
3938                    std::task::Poll::Ready(Err(e)) => {
3939                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3940                            e.into(),
3941                        ))));
3942                    }
3943                }
3944
3945                // A message has been received from the channel
3946                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3947
3948                std::task::Poll::Ready(Some(match header.ordinal {
3949                    0x68d19e55ea635356 => {
3950                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3951                        let mut req = fidl::new_empty!(
3952                            CorpusReaderNextRequest,
3953                            fidl::encoding::DefaultFuchsiaResourceDialect
3954                        );
3955                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CorpusReaderNextRequest>(&header, _body_bytes, handles, &mut req)?;
3956                        let control_handle =
3957                            CorpusReaderControlHandle { inner: this.inner.clone() };
3958                        Ok(CorpusReaderRequest::Next {
3959                            test_input: req.test_input,
3960
3961                            responder: CorpusReaderNextResponder {
3962                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3963                                tx_id: header.tx_id,
3964                            },
3965                        })
3966                    }
3967                    _ => Err(fidl::Error::UnknownOrdinal {
3968                        ordinal: header.ordinal,
3969                        protocol_name:
3970                            <CorpusReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3971                    }),
3972                }))
3973            },
3974        )
3975    }
3976}
3977
3978/// Sends a sequence of test inputs belonging to a fuzzer's corpus.
3979#[derive(Debug)]
3980pub enum CorpusReaderRequest {
3981    /// Sends the next test input from the corpus.
3982    ///
3983    /// + request `test_input` the byte sequence representing the next test
3984    ///   input in a corpus.
3985    /// - response `result` one of the following:
3986    ///     - `ZX_OK` if the test input was sent.
3987    ///     - A socket error if transferring the input failed.
3988    Next { test_input: Input, responder: CorpusReaderNextResponder },
3989}
3990
3991impl CorpusReaderRequest {
3992    #[allow(irrefutable_let_patterns)]
3993    pub fn into_next(self) -> Option<(Input, CorpusReaderNextResponder)> {
3994        if let CorpusReaderRequest::Next { test_input, responder } = self {
3995            Some((test_input, responder))
3996        } else {
3997            None
3998        }
3999    }
4000
4001    /// Name of the method defined in FIDL
4002    pub fn method_name(&self) -> &'static str {
4003        match *self {
4004            CorpusReaderRequest::Next { .. } => "next",
4005        }
4006    }
4007}
4008
4009#[derive(Debug, Clone)]
4010pub struct CorpusReaderControlHandle {
4011    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4012}
4013
4014impl fidl::endpoints::ControlHandle for CorpusReaderControlHandle {
4015    fn shutdown(&self) {
4016        self.inner.shutdown()
4017    }
4018
4019    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4020        self.inner.shutdown_with_epitaph(status)
4021    }
4022
4023    fn is_closed(&self) -> bool {
4024        self.inner.channel().is_closed()
4025    }
4026    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4027        self.inner.channel().on_closed()
4028    }
4029
4030    #[cfg(target_os = "fuchsia")]
4031    fn signal_peer(
4032        &self,
4033        clear_mask: zx::Signals,
4034        set_mask: zx::Signals,
4035    ) -> Result<(), zx_status::Status> {
4036        use fidl::Peered;
4037        self.inner.channel().signal_peer(clear_mask, set_mask)
4038    }
4039}
4040
4041impl CorpusReaderControlHandle {}
4042
4043#[must_use = "FIDL methods require a response to be sent"]
4044#[derive(Debug)]
4045pub struct CorpusReaderNextResponder {
4046    control_handle: std::mem::ManuallyDrop<CorpusReaderControlHandle>,
4047    tx_id: u32,
4048}
4049
4050/// Set the the channel to be shutdown (see [`CorpusReaderControlHandle::shutdown`])
4051/// if the responder is dropped without sending a response, so that the client
4052/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4053impl std::ops::Drop for CorpusReaderNextResponder {
4054    fn drop(&mut self) {
4055        self.control_handle.shutdown();
4056        // Safety: drops once, never accessed again
4057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4058    }
4059}
4060
4061impl fidl::endpoints::Responder for CorpusReaderNextResponder {
4062    type ControlHandle = CorpusReaderControlHandle;
4063
4064    fn control_handle(&self) -> &CorpusReaderControlHandle {
4065        &self.control_handle
4066    }
4067
4068    fn drop_without_shutdown(mut self) {
4069        // Safety: drops once, never accessed again due to mem::forget
4070        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4071        // Prevent Drop from running (which would shut down the channel)
4072        std::mem::forget(self);
4073    }
4074}
4075
4076impl CorpusReaderNextResponder {
4077    /// Sends a response to the FIDL transaction.
4078    ///
4079    /// Sets the channel to shutdown if an error occurs.
4080    pub fn send(self, mut result: i32) -> Result<(), fidl::Error> {
4081        let _result = self.send_raw(result);
4082        if _result.is_err() {
4083            self.control_handle.shutdown();
4084        }
4085        self.drop_without_shutdown();
4086        _result
4087    }
4088
4089    /// Similar to "send" but does not shutdown the channel if an error occurs.
4090    pub fn send_no_shutdown_on_err(self, mut result: i32) -> Result<(), fidl::Error> {
4091        let _result = self.send_raw(result);
4092        self.drop_without_shutdown();
4093        _result
4094    }
4095
4096    fn send_raw(&self, mut result: i32) -> Result<(), fidl::Error> {
4097        self.control_handle.inner.send::<CorpusReaderNextResponse>(
4098            (result,),
4099            self.tx_id,
4100            0x68d19e55ea635356,
4101            fidl::encoding::DynamicFlags::empty(),
4102        )
4103    }
4104}
4105
4106#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4107pub struct CoverageDataCollectorMarker;
4108
4109impl fidl::endpoints::ProtocolMarker for CoverageDataCollectorMarker {
4110    type Proxy = CoverageDataCollectorProxy;
4111    type RequestStream = CoverageDataCollectorRequestStream;
4112    #[cfg(target_os = "fuchsia")]
4113    type SynchronousProxy = CoverageDataCollectorSynchronousProxy;
4114
4115    const DEBUG_NAME: &'static str = "fuchsia.fuzzer.CoverageDataCollector";
4116}
4117impl fidl::endpoints::DiscoverableProtocolMarker for CoverageDataCollectorMarker {}
4118
4119pub trait CoverageDataCollectorProxyInterface: Send + Sync {
4120    type InitializeResponseFut: std::future::Future<Output = Result<Options, fidl::Error>> + Send;
4121    fn r#initialize(
4122        &self,
4123        eventpair: fidl::EventPair,
4124        process: fidl::Process,
4125    ) -> Self::InitializeResponseFut;
4126    type AddInline8bitCountersResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
4127        + Send;
4128    fn r#add_inline8bit_counters(
4129        &self,
4130        inline_8bit_counters: fidl::Vmo,
4131    ) -> Self::AddInline8bitCountersResponseFut;
4132}
4133#[derive(Debug)]
4134#[cfg(target_os = "fuchsia")]
4135pub struct CoverageDataCollectorSynchronousProxy {
4136    client: fidl::client::sync::Client,
4137}
4138
4139#[cfg(target_os = "fuchsia")]
4140impl fidl::endpoints::SynchronousProxy for CoverageDataCollectorSynchronousProxy {
4141    type Proxy = CoverageDataCollectorProxy;
4142    type Protocol = CoverageDataCollectorMarker;
4143
4144    fn from_channel(inner: fidl::Channel) -> Self {
4145        Self::new(inner)
4146    }
4147
4148    fn into_channel(self) -> fidl::Channel {
4149        self.client.into_channel()
4150    }
4151
4152    fn as_channel(&self) -> &fidl::Channel {
4153        self.client.as_channel()
4154    }
4155}
4156
4157#[cfg(target_os = "fuchsia")]
4158impl CoverageDataCollectorSynchronousProxy {
4159    pub fn new(channel: fidl::Channel) -> Self {
4160        Self { client: fidl::client::sync::Client::new(channel) }
4161    }
4162
4163    pub fn into_channel(self) -> fidl::Channel {
4164        self.client.into_channel()
4165    }
4166
4167    /// Waits until an event arrives and returns it. It is safe for other
4168    /// threads to make concurrent requests while waiting for an event.
4169    pub fn wait_for_event(
4170        &self,
4171        deadline: zx::MonotonicInstant,
4172    ) -> Result<CoverageDataCollectorEvent, fidl::Error> {
4173        CoverageDataCollectorEvent::decode(
4174            self.client.wait_for_event::<CoverageDataCollectorMarker>(deadline)?,
4175        )
4176    }
4177
4178    /// Registers the instrumented target process.
4179    ///
4180    /// This method is called once per connection to set up:
4181    ///    * The eventpair used to synchronize the start and end of code coverage collection.
4182    ///    * The process Handle used to monitor the target process for errors.
4183    ///
4184    /// This method must be called before the target process can call `AddLlvmModule`.
4185    ///
4186    /// It returns the currently set options; see `fuchsia.fuzzer.Controller/Configure`.
4187    ///
4188    /// Certain options determine sanitizer behaviors before `main` is called, and cannot
4189    /// subsequently be changed while the target process is running. This is the root cause of the
4190    /// constraint in `Controller` against modifying options during "long-running workflows", i.e
4191    /// those that spawn target processes.
4192    ///
4193    /// The channel is closed on FIDL error. Clients should not attempt to reconnect.
4194    pub fn r#initialize(
4195        &self,
4196        mut eventpair: fidl::EventPair,
4197        mut process: fidl::Process,
4198        ___deadline: zx::MonotonicInstant,
4199    ) -> Result<Options, fidl::Error> {
4200        let _response = self.client.send_query::<
4201            CoverageDataCollectorInitializeRequest,
4202            CoverageDataCollectorInitializeResponse,
4203            CoverageDataCollectorMarker,
4204        >(
4205            (eventpair, process,),
4206            0x51d6f91d6f02d9d6,
4207            fidl::encoding::DynamicFlags::empty(),
4208            ___deadline,
4209        )?;
4210        Ok(_response.options)
4211    }
4212
4213    /// Adds a VMO with the code coverage of an LLVM module.
4214    ///
4215    /// The VMO used to share inline 8-bit code-coverage edge counters for a single LLVM module in
4216    /// an instrumented target process.
4217    ///
4218    /// Its ZX_PROP_NAME property must be set, and client and server implementations must agree on
4219    /// how to use it to uniquely identify the module. If the same module is added more than once by
4220    /// different processes, the module identifiers must match so that the code counters can be
4221    /// combined.
4222    ///
4223    /// Its ZX_PROP_VMO_CONTENT_SIZE property must be set to the actual number of counters present.
4224    ///
4225    /// It is an error to call this method without first calling |Initialize|.
4226    ///
4227    /// The channel is closed on FIDL error. Clients should not attempt to reconnect.
4228    ///
4229    /// See also:
4230    ///     https://clang.llvm.org/docs/SanitizerCoverage.html#inline-8bit-counters
4231    pub fn r#add_inline8bit_counters(
4232        &self,
4233        mut inline_8bit_counters: fidl::Vmo,
4234        ___deadline: zx::MonotonicInstant,
4235    ) -> Result<(), fidl::Error> {
4236        let _response = self.client.send_query::<
4237            CoverageDataCollectorAddInline8bitCountersRequest,
4238            fidl::encoding::EmptyPayload,
4239            CoverageDataCollectorMarker,
4240        >(
4241            (inline_8bit_counters,),
4242            0x75f87cadfc94d1be,
4243            fidl::encoding::DynamicFlags::empty(),
4244            ___deadline,
4245        )?;
4246        Ok(_response)
4247    }
4248}
4249
4250#[cfg(target_os = "fuchsia")]
4251impl From<CoverageDataCollectorSynchronousProxy> for zx::NullableHandle {
4252    fn from(value: CoverageDataCollectorSynchronousProxy) -> Self {
4253        value.into_channel().into()
4254    }
4255}
4256
4257#[cfg(target_os = "fuchsia")]
4258impl From<fidl::Channel> for CoverageDataCollectorSynchronousProxy {
4259    fn from(value: fidl::Channel) -> Self {
4260        Self::new(value)
4261    }
4262}
4263
4264#[cfg(target_os = "fuchsia")]
4265impl fidl::endpoints::FromClient for CoverageDataCollectorSynchronousProxy {
4266    type Protocol = CoverageDataCollectorMarker;
4267
4268    fn from_client(value: fidl::endpoints::ClientEnd<CoverageDataCollectorMarker>) -> Self {
4269        Self::new(value.into_channel())
4270    }
4271}
4272
4273#[derive(Debug, Clone)]
4274pub struct CoverageDataCollectorProxy {
4275    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4276}
4277
4278impl fidl::endpoints::Proxy for CoverageDataCollectorProxy {
4279    type Protocol = CoverageDataCollectorMarker;
4280
4281    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4282        Self::new(inner)
4283    }
4284
4285    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4286        self.client.into_channel().map_err(|client| Self { client })
4287    }
4288
4289    fn as_channel(&self) -> &::fidl::AsyncChannel {
4290        self.client.as_channel()
4291    }
4292}
4293
4294impl CoverageDataCollectorProxy {
4295    /// Create a new Proxy for fuchsia.fuzzer/CoverageDataCollector.
4296    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4297        let protocol_name =
4298            <CoverageDataCollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4299        Self { client: fidl::client::Client::new(channel, protocol_name) }
4300    }
4301
4302    /// Get a Stream of events from the remote end of the protocol.
4303    ///
4304    /// # Panics
4305    ///
4306    /// Panics if the event stream was already taken.
4307    pub fn take_event_stream(&self) -> CoverageDataCollectorEventStream {
4308        CoverageDataCollectorEventStream { event_receiver: self.client.take_event_receiver() }
4309    }
4310
4311    /// Registers the instrumented target process.
4312    ///
4313    /// This method is called once per connection to set up:
4314    ///    * The eventpair used to synchronize the start and end of code coverage collection.
4315    ///    * The process Handle used to monitor the target process for errors.
4316    ///
4317    /// This method must be called before the target process can call `AddLlvmModule`.
4318    ///
4319    /// It returns the currently set options; see `fuchsia.fuzzer.Controller/Configure`.
4320    ///
4321    /// Certain options determine sanitizer behaviors before `main` is called, and cannot
4322    /// subsequently be changed while the target process is running. This is the root cause of the
4323    /// constraint in `Controller` against modifying options during "long-running workflows", i.e
4324    /// those that spawn target processes.
4325    ///
4326    /// The channel is closed on FIDL error. Clients should not attempt to reconnect.
4327    pub fn r#initialize(
4328        &self,
4329        mut eventpair: fidl::EventPair,
4330        mut process: fidl::Process,
4331    ) -> fidl::client::QueryResponseFut<Options, fidl::encoding::DefaultFuchsiaResourceDialect>
4332    {
4333        CoverageDataCollectorProxyInterface::r#initialize(self, eventpair, process)
4334    }
4335
4336    /// Adds a VMO with the code coverage of an LLVM module.
4337    ///
4338    /// The VMO used to share inline 8-bit code-coverage edge counters for a single LLVM module in
4339    /// an instrumented target process.
4340    ///
4341    /// Its ZX_PROP_NAME property must be set, and client and server implementations must agree on
4342    /// how to use it to uniquely identify the module. If the same module is added more than once by
4343    /// different processes, the module identifiers must match so that the code counters can be
4344    /// combined.
4345    ///
4346    /// Its ZX_PROP_VMO_CONTENT_SIZE property must be set to the actual number of counters present.
4347    ///
4348    /// It is an error to call this method without first calling |Initialize|.
4349    ///
4350    /// The channel is closed on FIDL error. Clients should not attempt to reconnect.
4351    ///
4352    /// See also:
4353    ///     https://clang.llvm.org/docs/SanitizerCoverage.html#inline-8bit-counters
4354    pub fn r#add_inline8bit_counters(
4355        &self,
4356        mut inline_8bit_counters: fidl::Vmo,
4357    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4358        CoverageDataCollectorProxyInterface::r#add_inline8bit_counters(self, inline_8bit_counters)
4359    }
4360}
4361
4362impl CoverageDataCollectorProxyInterface for CoverageDataCollectorProxy {
4363    type InitializeResponseFut =
4364        fidl::client::QueryResponseFut<Options, fidl::encoding::DefaultFuchsiaResourceDialect>;
4365    fn r#initialize(
4366        &self,
4367        mut eventpair: fidl::EventPair,
4368        mut process: fidl::Process,
4369    ) -> Self::InitializeResponseFut {
4370        fn _decode(
4371            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4372        ) -> Result<Options, fidl::Error> {
4373            let _response = fidl::client::decode_transaction_body::<
4374                CoverageDataCollectorInitializeResponse,
4375                fidl::encoding::DefaultFuchsiaResourceDialect,
4376                0x51d6f91d6f02d9d6,
4377            >(_buf?)?;
4378            Ok(_response.options)
4379        }
4380        self.client.send_query_and_decode::<CoverageDataCollectorInitializeRequest, Options>(
4381            (eventpair, process),
4382            0x51d6f91d6f02d9d6,
4383            fidl::encoding::DynamicFlags::empty(),
4384            _decode,
4385        )
4386    }
4387
4388    type AddInline8bitCountersResponseFut =
4389        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4390    fn r#add_inline8bit_counters(
4391        &self,
4392        mut inline_8bit_counters: fidl::Vmo,
4393    ) -> Self::AddInline8bitCountersResponseFut {
4394        fn _decode(
4395            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4396        ) -> Result<(), fidl::Error> {
4397            let _response = fidl::client::decode_transaction_body::<
4398                fidl::encoding::EmptyPayload,
4399                fidl::encoding::DefaultFuchsiaResourceDialect,
4400                0x75f87cadfc94d1be,
4401            >(_buf?)?;
4402            Ok(_response)
4403        }
4404        self.client.send_query_and_decode::<CoverageDataCollectorAddInline8bitCountersRequest, ()>(
4405            (inline_8bit_counters,),
4406            0x75f87cadfc94d1be,
4407            fidl::encoding::DynamicFlags::empty(),
4408            _decode,
4409        )
4410    }
4411}
4412
4413pub struct CoverageDataCollectorEventStream {
4414    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4415}
4416
4417impl std::marker::Unpin for CoverageDataCollectorEventStream {}
4418
4419impl futures::stream::FusedStream for CoverageDataCollectorEventStream {
4420    fn is_terminated(&self) -> bool {
4421        self.event_receiver.is_terminated()
4422    }
4423}
4424
4425impl futures::Stream for CoverageDataCollectorEventStream {
4426    type Item = Result<CoverageDataCollectorEvent, fidl::Error>;
4427
4428    fn poll_next(
4429        mut self: std::pin::Pin<&mut Self>,
4430        cx: &mut std::task::Context<'_>,
4431    ) -> std::task::Poll<Option<Self::Item>> {
4432        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4433            &mut self.event_receiver,
4434            cx
4435        )?) {
4436            Some(buf) => std::task::Poll::Ready(Some(CoverageDataCollectorEvent::decode(buf))),
4437            None => std::task::Poll::Ready(None),
4438        }
4439    }
4440}
4441
4442#[derive(Debug)]
4443pub enum CoverageDataCollectorEvent {}
4444
4445impl CoverageDataCollectorEvent {
4446    /// Decodes a message buffer as a [`CoverageDataCollectorEvent`].
4447    fn decode(
4448        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4449    ) -> Result<CoverageDataCollectorEvent, fidl::Error> {
4450        let (bytes, _handles) = buf.split_mut();
4451        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4452        debug_assert_eq!(tx_header.tx_id, 0);
4453        match tx_header.ordinal {
4454            _ => Err(fidl::Error::UnknownOrdinal {
4455                ordinal: tx_header.ordinal,
4456                protocol_name:
4457                    <CoverageDataCollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4458            }),
4459        }
4460    }
4461}
4462
4463/// A Stream of incoming requests for fuchsia.fuzzer/CoverageDataCollector.
4464pub struct CoverageDataCollectorRequestStream {
4465    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4466    is_terminated: bool,
4467}
4468
4469impl std::marker::Unpin for CoverageDataCollectorRequestStream {}
4470
4471impl futures::stream::FusedStream for CoverageDataCollectorRequestStream {
4472    fn is_terminated(&self) -> bool {
4473        self.is_terminated
4474    }
4475}
4476
4477impl fidl::endpoints::RequestStream for CoverageDataCollectorRequestStream {
4478    type Protocol = CoverageDataCollectorMarker;
4479    type ControlHandle = CoverageDataCollectorControlHandle;
4480
4481    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4482        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4483    }
4484
4485    fn control_handle(&self) -> Self::ControlHandle {
4486        CoverageDataCollectorControlHandle { inner: self.inner.clone() }
4487    }
4488
4489    fn into_inner(
4490        self,
4491    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4492    {
4493        (self.inner, self.is_terminated)
4494    }
4495
4496    fn from_inner(
4497        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4498        is_terminated: bool,
4499    ) -> Self {
4500        Self { inner, is_terminated }
4501    }
4502}
4503
4504impl futures::Stream for CoverageDataCollectorRequestStream {
4505    type Item = Result<CoverageDataCollectorRequest, fidl::Error>;
4506
4507    fn poll_next(
4508        mut self: std::pin::Pin<&mut Self>,
4509        cx: &mut std::task::Context<'_>,
4510    ) -> std::task::Poll<Option<Self::Item>> {
4511        let this = &mut *self;
4512        if this.inner.check_shutdown(cx) {
4513            this.is_terminated = true;
4514            return std::task::Poll::Ready(None);
4515        }
4516        if this.is_terminated {
4517            panic!("polled CoverageDataCollectorRequestStream after completion");
4518        }
4519        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4520            |bytes, handles| {
4521                match this.inner.channel().read_etc(cx, bytes, handles) {
4522                    std::task::Poll::Ready(Ok(())) => {}
4523                    std::task::Poll::Pending => return std::task::Poll::Pending,
4524                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4525                        this.is_terminated = true;
4526                        return std::task::Poll::Ready(None);
4527                    }
4528                    std::task::Poll::Ready(Err(e)) => {
4529                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4530                            e.into(),
4531                        ))));
4532                    }
4533                }
4534
4535                // A message has been received from the channel
4536                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4537
4538                std::task::Poll::Ready(Some(match header.ordinal {
4539                0x51d6f91d6f02d9d6 => {
4540                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4541                    let mut req = fidl::new_empty!(CoverageDataCollectorInitializeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4542                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoverageDataCollectorInitializeRequest>(&header, _body_bytes, handles, &mut req)?;
4543                    let control_handle = CoverageDataCollectorControlHandle {
4544                        inner: this.inner.clone(),
4545                    };
4546                    Ok(CoverageDataCollectorRequest::Initialize {eventpair: req.eventpair,
4547process: req.process,
4548
4549                        responder: CoverageDataCollectorInitializeResponder {
4550                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4551                            tx_id: header.tx_id,
4552                        },
4553                    })
4554                }
4555                0x75f87cadfc94d1be => {
4556                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4557                    let mut req = fidl::new_empty!(CoverageDataCollectorAddInline8bitCountersRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4558                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoverageDataCollectorAddInline8bitCountersRequest>(&header, _body_bytes, handles, &mut req)?;
4559                    let control_handle = CoverageDataCollectorControlHandle {
4560                        inner: this.inner.clone(),
4561                    };
4562                    Ok(CoverageDataCollectorRequest::AddInline8bitCounters {inline_8bit_counters: req.inline_8bit_counters,
4563
4564                        responder: CoverageDataCollectorAddInline8bitCountersResponder {
4565                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4566                            tx_id: header.tx_id,
4567                        },
4568                    })
4569                }
4570                _ => Err(fidl::Error::UnknownOrdinal {
4571                    ordinal: header.ordinal,
4572                    protocol_name: <CoverageDataCollectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4573                }),
4574            }))
4575            },
4576        )
4577    }
4578}
4579
4580/// Collects VMOs used to share code coverage from instrumented target processes.
4581///
4582/// The instrumented target processes act as clients to this protocol, which is implemented by
4583/// test_manager's fuzz_coverage component. The protocol coordinates feedback collection and other
4584/// diagnostics with target processes under test. The connection should be established very early in
4585/// a target process's lifecycle, i.e. before `main` begins.
4586#[derive(Debug)]
4587pub enum CoverageDataCollectorRequest {
4588    /// Registers the instrumented target process.
4589    ///
4590    /// This method is called once per connection to set up:
4591    ///    * The eventpair used to synchronize the start and end of code coverage collection.
4592    ///    * The process Handle used to monitor the target process for errors.
4593    ///
4594    /// This method must be called before the target process can call `AddLlvmModule`.
4595    ///
4596    /// It returns the currently set options; see `fuchsia.fuzzer.Controller/Configure`.
4597    ///
4598    /// Certain options determine sanitizer behaviors before `main` is called, and cannot
4599    /// subsequently be changed while the target process is running. This is the root cause of the
4600    /// constraint in `Controller` against modifying options during "long-running workflows", i.e
4601    /// those that spawn target processes.
4602    ///
4603    /// The channel is closed on FIDL error. Clients should not attempt to reconnect.
4604    Initialize {
4605        eventpair: fidl::EventPair,
4606        process: fidl::Process,
4607        responder: CoverageDataCollectorInitializeResponder,
4608    },
4609    /// Adds a VMO with the code coverage of an LLVM module.
4610    ///
4611    /// The VMO used to share inline 8-bit code-coverage edge counters for a single LLVM module in
4612    /// an instrumented target process.
4613    ///
4614    /// Its ZX_PROP_NAME property must be set, and client and server implementations must agree on
4615    /// how to use it to uniquely identify the module. If the same module is added more than once by
4616    /// different processes, the module identifiers must match so that the code counters can be
4617    /// combined.
4618    ///
4619    /// Its ZX_PROP_VMO_CONTENT_SIZE property must be set to the actual number of counters present.
4620    ///
4621    /// It is an error to call this method without first calling |Initialize|.
4622    ///
4623    /// The channel is closed on FIDL error. Clients should not attempt to reconnect.
4624    ///
4625    /// See also:
4626    ///     https://clang.llvm.org/docs/SanitizerCoverage.html#inline-8bit-counters
4627    AddInline8bitCounters {
4628        inline_8bit_counters: fidl::Vmo,
4629        responder: CoverageDataCollectorAddInline8bitCountersResponder,
4630    },
4631}
4632
4633impl CoverageDataCollectorRequest {
4634    #[allow(irrefutable_let_patterns)]
4635    pub fn into_initialize(
4636        self,
4637    ) -> Option<(fidl::EventPair, fidl::Process, CoverageDataCollectorInitializeResponder)> {
4638        if let CoverageDataCollectorRequest::Initialize { eventpair, process, responder } = self {
4639            Some((eventpair, process, responder))
4640        } else {
4641            None
4642        }
4643    }
4644
4645    #[allow(irrefutable_let_patterns)]
4646    pub fn into_add_inline8bit_counters(
4647        self,
4648    ) -> Option<(fidl::Vmo, CoverageDataCollectorAddInline8bitCountersResponder)> {
4649        if let CoverageDataCollectorRequest::AddInline8bitCounters {
4650            inline_8bit_counters,
4651            responder,
4652        } = self
4653        {
4654            Some((inline_8bit_counters, responder))
4655        } else {
4656            None
4657        }
4658    }
4659
4660    /// Name of the method defined in FIDL
4661    pub fn method_name(&self) -> &'static str {
4662        match *self {
4663            CoverageDataCollectorRequest::Initialize { .. } => "initialize",
4664            CoverageDataCollectorRequest::AddInline8bitCounters { .. } => "add_inline8bit_counters",
4665        }
4666    }
4667}
4668
4669#[derive(Debug, Clone)]
4670pub struct CoverageDataCollectorControlHandle {
4671    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4672}
4673
4674impl fidl::endpoints::ControlHandle for CoverageDataCollectorControlHandle {
4675    fn shutdown(&self) {
4676        self.inner.shutdown()
4677    }
4678
4679    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4680        self.inner.shutdown_with_epitaph(status)
4681    }
4682
4683    fn is_closed(&self) -> bool {
4684        self.inner.channel().is_closed()
4685    }
4686    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4687        self.inner.channel().on_closed()
4688    }
4689
4690    #[cfg(target_os = "fuchsia")]
4691    fn signal_peer(
4692        &self,
4693        clear_mask: zx::Signals,
4694        set_mask: zx::Signals,
4695    ) -> Result<(), zx_status::Status> {
4696        use fidl::Peered;
4697        self.inner.channel().signal_peer(clear_mask, set_mask)
4698    }
4699}
4700
4701impl CoverageDataCollectorControlHandle {}
4702
4703#[must_use = "FIDL methods require a response to be sent"]
4704#[derive(Debug)]
4705pub struct CoverageDataCollectorInitializeResponder {
4706    control_handle: std::mem::ManuallyDrop<CoverageDataCollectorControlHandle>,
4707    tx_id: u32,
4708}
4709
4710/// Set the the channel to be shutdown (see [`CoverageDataCollectorControlHandle::shutdown`])
4711/// if the responder is dropped without sending a response, so that the client
4712/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4713impl std::ops::Drop for CoverageDataCollectorInitializeResponder {
4714    fn drop(&mut self) {
4715        self.control_handle.shutdown();
4716        // Safety: drops once, never accessed again
4717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4718    }
4719}
4720
4721impl fidl::endpoints::Responder for CoverageDataCollectorInitializeResponder {
4722    type ControlHandle = CoverageDataCollectorControlHandle;
4723
4724    fn control_handle(&self) -> &CoverageDataCollectorControlHandle {
4725        &self.control_handle
4726    }
4727
4728    fn drop_without_shutdown(mut self) {
4729        // Safety: drops once, never accessed again due to mem::forget
4730        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4731        // Prevent Drop from running (which would shut down the channel)
4732        std::mem::forget(self);
4733    }
4734}
4735
4736impl CoverageDataCollectorInitializeResponder {
4737    /// Sends a response to the FIDL transaction.
4738    ///
4739    /// Sets the channel to shutdown if an error occurs.
4740    pub fn send(self, mut options: &Options) -> Result<(), fidl::Error> {
4741        let _result = self.send_raw(options);
4742        if _result.is_err() {
4743            self.control_handle.shutdown();
4744        }
4745        self.drop_without_shutdown();
4746        _result
4747    }
4748
4749    /// Similar to "send" but does not shutdown the channel if an error occurs.
4750    pub fn send_no_shutdown_on_err(self, mut options: &Options) -> Result<(), fidl::Error> {
4751        let _result = self.send_raw(options);
4752        self.drop_without_shutdown();
4753        _result
4754    }
4755
4756    fn send_raw(&self, mut options: &Options) -> Result<(), fidl::Error> {
4757        self.control_handle.inner.send::<CoverageDataCollectorInitializeResponse>(
4758            (options,),
4759            self.tx_id,
4760            0x51d6f91d6f02d9d6,
4761            fidl::encoding::DynamicFlags::empty(),
4762        )
4763    }
4764}
4765
4766#[must_use = "FIDL methods require a response to be sent"]
4767#[derive(Debug)]
4768pub struct CoverageDataCollectorAddInline8bitCountersResponder {
4769    control_handle: std::mem::ManuallyDrop<CoverageDataCollectorControlHandle>,
4770    tx_id: u32,
4771}
4772
4773/// Set the the channel to be shutdown (see [`CoverageDataCollectorControlHandle::shutdown`])
4774/// if the responder is dropped without sending a response, so that the client
4775/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4776impl std::ops::Drop for CoverageDataCollectorAddInline8bitCountersResponder {
4777    fn drop(&mut self) {
4778        self.control_handle.shutdown();
4779        // Safety: drops once, never accessed again
4780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4781    }
4782}
4783
4784impl fidl::endpoints::Responder for CoverageDataCollectorAddInline8bitCountersResponder {
4785    type ControlHandle = CoverageDataCollectorControlHandle;
4786
4787    fn control_handle(&self) -> &CoverageDataCollectorControlHandle {
4788        &self.control_handle
4789    }
4790
4791    fn drop_without_shutdown(mut self) {
4792        // Safety: drops once, never accessed again due to mem::forget
4793        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4794        // Prevent Drop from running (which would shut down the channel)
4795        std::mem::forget(self);
4796    }
4797}
4798
4799impl CoverageDataCollectorAddInline8bitCountersResponder {
4800    /// Sends a response to the FIDL transaction.
4801    ///
4802    /// Sets the channel to shutdown if an error occurs.
4803    pub fn send(self) -> Result<(), fidl::Error> {
4804        let _result = self.send_raw();
4805        if _result.is_err() {
4806            self.control_handle.shutdown();
4807        }
4808        self.drop_without_shutdown();
4809        _result
4810    }
4811
4812    /// Similar to "send" but does not shutdown the channel if an error occurs.
4813    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4814        let _result = self.send_raw();
4815        self.drop_without_shutdown();
4816        _result
4817    }
4818
4819    fn send_raw(&self) -> Result<(), fidl::Error> {
4820        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4821            (),
4822            self.tx_id,
4823            0x75f87cadfc94d1be,
4824            fidl::encoding::DynamicFlags::empty(),
4825        )
4826    }
4827}
4828
4829#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4830pub struct CoverageDataProviderMarker;
4831
4832impl fidl::endpoints::ProtocolMarker for CoverageDataProviderMarker {
4833    type Proxy = CoverageDataProviderProxy;
4834    type RequestStream = CoverageDataProviderRequestStream;
4835    #[cfg(target_os = "fuchsia")]
4836    type SynchronousProxy = CoverageDataProviderSynchronousProxy;
4837
4838    const DEBUG_NAME: &'static str = "fuchsia.fuzzer.CoverageDataProvider";
4839}
4840impl fidl::endpoints::DiscoverableProtocolMarker for CoverageDataProviderMarker {}
4841
4842pub trait CoverageDataProviderProxyInterface: Send + Sync {
4843    fn r#set_options(&self, options: &Options) -> Result<(), fidl::Error>;
4844    type WatchCoverageDataResponseFut: std::future::Future<Output = Result<Vec<CoverageData>, fidl::Error>>
4845        + Send;
4846    fn r#watch_coverage_data(&self) -> Self::WatchCoverageDataResponseFut;
4847}
4848#[derive(Debug)]
4849#[cfg(target_os = "fuchsia")]
4850pub struct CoverageDataProviderSynchronousProxy {
4851    client: fidl::client::sync::Client,
4852}
4853
4854#[cfg(target_os = "fuchsia")]
4855impl fidl::endpoints::SynchronousProxy for CoverageDataProviderSynchronousProxy {
4856    type Proxy = CoverageDataProviderProxy;
4857    type Protocol = CoverageDataProviderMarker;
4858
4859    fn from_channel(inner: fidl::Channel) -> Self {
4860        Self::new(inner)
4861    }
4862
4863    fn into_channel(self) -> fidl::Channel {
4864        self.client.into_channel()
4865    }
4866
4867    fn as_channel(&self) -> &fidl::Channel {
4868        self.client.as_channel()
4869    }
4870}
4871
4872#[cfg(target_os = "fuchsia")]
4873impl CoverageDataProviderSynchronousProxy {
4874    pub fn new(channel: fidl::Channel) -> Self {
4875        Self { client: fidl::client::sync::Client::new(channel) }
4876    }
4877
4878    pub fn into_channel(self) -> fidl::Channel {
4879        self.client.into_channel()
4880    }
4881
4882    /// Waits until an event arrives and returns it. It is safe for other
4883    /// threads to make concurrent requests while waiting for an event.
4884    pub fn wait_for_event(
4885        &self,
4886        deadline: zx::MonotonicInstant,
4887    ) -> Result<CoverageDataProviderEvent, fidl::Error> {
4888        CoverageDataProviderEvent::decode(
4889            self.client.wait_for_event::<CoverageDataProviderMarker>(deadline)?,
4890        )
4891    }
4892
4893    /// Sets the options to be returned by `fuchsia.fuzzer.CoverageDataCollector/Initialize`.
4894    pub fn r#set_options(&self, mut options: &Options) -> Result<(), fidl::Error> {
4895        self.client.send::<CoverageDataProviderSetOptionsRequest>(
4896            (options,),
4897            0x4873c4a5c7683384,
4898            fidl::encoding::DynamicFlags::empty(),
4899        )
4900    }
4901
4902    /// Provides coverage data collected from multiple processes.
4903    ///
4904    /// Returns a vector of `CoverageData` structs containing the information provided by clients of
4905    /// `fuchsia.fuzzer.CoverageDataCollector`. This method uses the "hanging get" pattern: The
4906    /// initial call will immediately return whatever data is available, up to `MAX_COVERAGE_DATA`.
4907    /// If no fuzzed components have been started yet, this be an empty vector. If there are more
4908    /// than `MAX_COVERAGE_DATA` elements available, the remainder are retained for subsequent
4909    /// calls. If there is no more data available, subsequent calls will block until new coverage
4910    /// data is available.
4911    ///
4912    /// The channel is closed on FIDL error. Clients should exit and not attempt to reconnect.
4913    pub fn r#watch_coverage_data(
4914        &self,
4915        ___deadline: zx::MonotonicInstant,
4916    ) -> Result<Vec<CoverageData>, fidl::Error> {
4917        let _response = self.client.send_query::<
4918            fidl::encoding::EmptyPayload,
4919            CoverageDataProviderWatchCoverageDataResponse,
4920            CoverageDataProviderMarker,
4921        >(
4922            (),
4923            0x34a92fc9c73bea5a,
4924            fidl::encoding::DynamicFlags::empty(),
4925            ___deadline,
4926        )?;
4927        Ok(_response.coverage_data)
4928    }
4929}
4930
4931#[cfg(target_os = "fuchsia")]
4932impl From<CoverageDataProviderSynchronousProxy> for zx::NullableHandle {
4933    fn from(value: CoverageDataProviderSynchronousProxy) -> Self {
4934        value.into_channel().into()
4935    }
4936}
4937
4938#[cfg(target_os = "fuchsia")]
4939impl From<fidl::Channel> for CoverageDataProviderSynchronousProxy {
4940    fn from(value: fidl::Channel) -> Self {
4941        Self::new(value)
4942    }
4943}
4944
4945#[cfg(target_os = "fuchsia")]
4946impl fidl::endpoints::FromClient for CoverageDataProviderSynchronousProxy {
4947    type Protocol = CoverageDataProviderMarker;
4948
4949    fn from_client(value: fidl::endpoints::ClientEnd<CoverageDataProviderMarker>) -> Self {
4950        Self::new(value.into_channel())
4951    }
4952}
4953
4954#[derive(Debug, Clone)]
4955pub struct CoverageDataProviderProxy {
4956    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4957}
4958
4959impl fidl::endpoints::Proxy for CoverageDataProviderProxy {
4960    type Protocol = CoverageDataProviderMarker;
4961
4962    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4963        Self::new(inner)
4964    }
4965
4966    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4967        self.client.into_channel().map_err(|client| Self { client })
4968    }
4969
4970    fn as_channel(&self) -> &::fidl::AsyncChannel {
4971        self.client.as_channel()
4972    }
4973}
4974
4975impl CoverageDataProviderProxy {
4976    /// Create a new Proxy for fuchsia.fuzzer/CoverageDataProvider.
4977    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4978        let protocol_name =
4979            <CoverageDataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4980        Self { client: fidl::client::Client::new(channel, protocol_name) }
4981    }
4982
4983    /// Get a Stream of events from the remote end of the protocol.
4984    ///
4985    /// # Panics
4986    ///
4987    /// Panics if the event stream was already taken.
4988    pub fn take_event_stream(&self) -> CoverageDataProviderEventStream {
4989        CoverageDataProviderEventStream { event_receiver: self.client.take_event_receiver() }
4990    }
4991
4992    /// Sets the options to be returned by `fuchsia.fuzzer.CoverageDataCollector/Initialize`.
4993    pub fn r#set_options(&self, mut options: &Options) -> Result<(), fidl::Error> {
4994        CoverageDataProviderProxyInterface::r#set_options(self, options)
4995    }
4996
4997    /// Provides coverage data collected from multiple processes.
4998    ///
4999    /// Returns a vector of `CoverageData` structs containing the information provided by clients of
5000    /// `fuchsia.fuzzer.CoverageDataCollector`. This method uses the "hanging get" pattern: The
5001    /// initial call will immediately return whatever data is available, up to `MAX_COVERAGE_DATA`.
5002    /// If no fuzzed components have been started yet, this be an empty vector. If there are more
5003    /// than `MAX_COVERAGE_DATA` elements available, the remainder are retained for subsequent
5004    /// calls. If there is no more data available, subsequent calls will block until new coverage
5005    /// data is available.
5006    ///
5007    /// The channel is closed on FIDL error. Clients should exit and not attempt to reconnect.
5008    pub fn r#watch_coverage_data(
5009        &self,
5010    ) -> fidl::client::QueryResponseFut<
5011        Vec<CoverageData>,
5012        fidl::encoding::DefaultFuchsiaResourceDialect,
5013    > {
5014        CoverageDataProviderProxyInterface::r#watch_coverage_data(self)
5015    }
5016}
5017
5018impl CoverageDataProviderProxyInterface for CoverageDataProviderProxy {
5019    fn r#set_options(&self, mut options: &Options) -> Result<(), fidl::Error> {
5020        self.client.send::<CoverageDataProviderSetOptionsRequest>(
5021            (options,),
5022            0x4873c4a5c7683384,
5023            fidl::encoding::DynamicFlags::empty(),
5024        )
5025    }
5026
5027    type WatchCoverageDataResponseFut = fidl::client::QueryResponseFut<
5028        Vec<CoverageData>,
5029        fidl::encoding::DefaultFuchsiaResourceDialect,
5030    >;
5031    fn r#watch_coverage_data(&self) -> Self::WatchCoverageDataResponseFut {
5032        fn _decode(
5033            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5034        ) -> Result<Vec<CoverageData>, fidl::Error> {
5035            let _response = fidl::client::decode_transaction_body::<
5036                CoverageDataProviderWatchCoverageDataResponse,
5037                fidl::encoding::DefaultFuchsiaResourceDialect,
5038                0x34a92fc9c73bea5a,
5039            >(_buf?)?;
5040            Ok(_response.coverage_data)
5041        }
5042        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<CoverageData>>(
5043            (),
5044            0x34a92fc9c73bea5a,
5045            fidl::encoding::DynamicFlags::empty(),
5046            _decode,
5047        )
5048    }
5049}
5050
5051pub struct CoverageDataProviderEventStream {
5052    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5053}
5054
5055impl std::marker::Unpin for CoverageDataProviderEventStream {}
5056
5057impl futures::stream::FusedStream for CoverageDataProviderEventStream {
5058    fn is_terminated(&self) -> bool {
5059        self.event_receiver.is_terminated()
5060    }
5061}
5062
5063impl futures::Stream for CoverageDataProviderEventStream {
5064    type Item = Result<CoverageDataProviderEvent, fidl::Error>;
5065
5066    fn poll_next(
5067        mut self: std::pin::Pin<&mut Self>,
5068        cx: &mut std::task::Context<'_>,
5069    ) -> std::task::Poll<Option<Self::Item>> {
5070        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5071            &mut self.event_receiver,
5072            cx
5073        )?) {
5074            Some(buf) => std::task::Poll::Ready(Some(CoverageDataProviderEvent::decode(buf))),
5075            None => std::task::Poll::Ready(None),
5076        }
5077    }
5078}
5079
5080#[derive(Debug)]
5081pub enum CoverageDataProviderEvent {}
5082
5083impl CoverageDataProviderEvent {
5084    /// Decodes a message buffer as a [`CoverageDataProviderEvent`].
5085    fn decode(
5086        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5087    ) -> Result<CoverageDataProviderEvent, fidl::Error> {
5088        let (bytes, _handles) = buf.split_mut();
5089        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5090        debug_assert_eq!(tx_header.tx_id, 0);
5091        match tx_header.ordinal {
5092            _ => Err(fidl::Error::UnknownOrdinal {
5093                ordinal: tx_header.ordinal,
5094                protocol_name:
5095                    <CoverageDataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5096            }),
5097        }
5098    }
5099}
5100
5101/// A Stream of incoming requests for fuchsia.fuzzer/CoverageDataProvider.
5102pub struct CoverageDataProviderRequestStream {
5103    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5104    is_terminated: bool,
5105}
5106
5107impl std::marker::Unpin for CoverageDataProviderRequestStream {}
5108
5109impl futures::stream::FusedStream for CoverageDataProviderRequestStream {
5110    fn is_terminated(&self) -> bool {
5111        self.is_terminated
5112    }
5113}
5114
5115impl fidl::endpoints::RequestStream for CoverageDataProviderRequestStream {
5116    type Protocol = CoverageDataProviderMarker;
5117    type ControlHandle = CoverageDataProviderControlHandle;
5118
5119    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5120        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5121    }
5122
5123    fn control_handle(&self) -> Self::ControlHandle {
5124        CoverageDataProviderControlHandle { inner: self.inner.clone() }
5125    }
5126
5127    fn into_inner(
5128        self,
5129    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5130    {
5131        (self.inner, self.is_terminated)
5132    }
5133
5134    fn from_inner(
5135        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5136        is_terminated: bool,
5137    ) -> Self {
5138        Self { inner, is_terminated }
5139    }
5140}
5141
5142impl futures::Stream for CoverageDataProviderRequestStream {
5143    type Item = Result<CoverageDataProviderRequest, fidl::Error>;
5144
5145    fn poll_next(
5146        mut self: std::pin::Pin<&mut Self>,
5147        cx: &mut std::task::Context<'_>,
5148    ) -> std::task::Poll<Option<Self::Item>> {
5149        let this = &mut *self;
5150        if this.inner.check_shutdown(cx) {
5151            this.is_terminated = true;
5152            return std::task::Poll::Ready(None);
5153        }
5154        if this.is_terminated {
5155            panic!("polled CoverageDataProviderRequestStream after completion");
5156        }
5157        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5158            |bytes, handles| {
5159                match this.inner.channel().read_etc(cx, bytes, handles) {
5160                    std::task::Poll::Ready(Ok(())) => {}
5161                    std::task::Poll::Pending => return std::task::Poll::Pending,
5162                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5163                        this.is_terminated = true;
5164                        return std::task::Poll::Ready(None);
5165                    }
5166                    std::task::Poll::Ready(Err(e)) => {
5167                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5168                            e.into(),
5169                        ))));
5170                    }
5171                }
5172
5173                // A message has been received from the channel
5174                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5175
5176                std::task::Poll::Ready(Some(match header.ordinal {
5177                0x4873c4a5c7683384 => {
5178                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5179                    let mut req = fidl::new_empty!(CoverageDataProviderSetOptionsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5180                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CoverageDataProviderSetOptionsRequest>(&header, _body_bytes, handles, &mut req)?;
5181                    let control_handle = CoverageDataProviderControlHandle {
5182                        inner: this.inner.clone(),
5183                    };
5184                    Ok(CoverageDataProviderRequest::SetOptions {options: req.options,
5185
5186                        control_handle,
5187                    })
5188                }
5189                0x34a92fc9c73bea5a => {
5190                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5191                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5192                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5193                    let control_handle = CoverageDataProviderControlHandle {
5194                        inner: this.inner.clone(),
5195                    };
5196                    Ok(CoverageDataProviderRequest::WatchCoverageData {
5197                        responder: CoverageDataProviderWatchCoverageDataResponder {
5198                            control_handle: std::mem::ManuallyDrop::new(control_handle),
5199                            tx_id: header.tx_id,
5200                        },
5201                    })
5202                }
5203                _ => Err(fidl::Error::UnknownOrdinal {
5204                    ordinal: header.ordinal,
5205                    protocol_name: <CoverageDataProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5206                }),
5207            }))
5208            },
5209        )
5210    }
5211}
5212
5213/// Provides the process Handles and VMOs used to share code coverage to the fuzzing engine.
5214///
5215/// This protocol is implemented by `test_manager`'s `fuzz_coverage` component. The fuzzing engine
5216/// acts as a client, although it does not connect directly. Instead the `fuzz_test_runner` makes
5217/// the connection and passes it off to fuzzing engine on process start. It allows the engine to
5218/// retrieve the coverage-related Handles published by instrumented target processes.
5219///
5220/// The channel is closed on FIDL error. Clients should exit and not attempt to reconnect.
5221#[derive(Debug)]
5222pub enum CoverageDataProviderRequest {
5223    /// Sets the options to be returned by `fuchsia.fuzzer.CoverageDataCollector/Initialize`.
5224    SetOptions { options: Options, control_handle: CoverageDataProviderControlHandle },
5225    /// Provides coverage data collected from multiple processes.
5226    ///
5227    /// Returns a vector of `CoverageData` structs containing the information provided by clients of
5228    /// `fuchsia.fuzzer.CoverageDataCollector`. This method uses the "hanging get" pattern: The
5229    /// initial call will immediately return whatever data is available, up to `MAX_COVERAGE_DATA`.
5230    /// If no fuzzed components have been started yet, this be an empty vector. If there are more
5231    /// than `MAX_COVERAGE_DATA` elements available, the remainder are retained for subsequent
5232    /// calls. If there is no more data available, subsequent calls will block until new coverage
5233    /// data is available.
5234    ///
5235    /// The channel is closed on FIDL error. Clients should exit and not attempt to reconnect.
5236    WatchCoverageData { responder: CoverageDataProviderWatchCoverageDataResponder },
5237}
5238
5239impl CoverageDataProviderRequest {
5240    #[allow(irrefutable_let_patterns)]
5241    pub fn into_set_options(self) -> Option<(Options, CoverageDataProviderControlHandle)> {
5242        if let CoverageDataProviderRequest::SetOptions { options, control_handle } = self {
5243            Some((options, control_handle))
5244        } else {
5245            None
5246        }
5247    }
5248
5249    #[allow(irrefutable_let_patterns)]
5250    pub fn into_watch_coverage_data(
5251        self,
5252    ) -> Option<(CoverageDataProviderWatchCoverageDataResponder)> {
5253        if let CoverageDataProviderRequest::WatchCoverageData { responder } = self {
5254            Some((responder))
5255        } else {
5256            None
5257        }
5258    }
5259
5260    /// Name of the method defined in FIDL
5261    pub fn method_name(&self) -> &'static str {
5262        match *self {
5263            CoverageDataProviderRequest::SetOptions { .. } => "set_options",
5264            CoverageDataProviderRequest::WatchCoverageData { .. } => "watch_coverage_data",
5265        }
5266    }
5267}
5268
5269#[derive(Debug, Clone)]
5270pub struct CoverageDataProviderControlHandle {
5271    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5272}
5273
5274impl fidl::endpoints::ControlHandle for CoverageDataProviderControlHandle {
5275    fn shutdown(&self) {
5276        self.inner.shutdown()
5277    }
5278
5279    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5280        self.inner.shutdown_with_epitaph(status)
5281    }
5282
5283    fn is_closed(&self) -> bool {
5284        self.inner.channel().is_closed()
5285    }
5286    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5287        self.inner.channel().on_closed()
5288    }
5289
5290    #[cfg(target_os = "fuchsia")]
5291    fn signal_peer(
5292        &self,
5293        clear_mask: zx::Signals,
5294        set_mask: zx::Signals,
5295    ) -> Result<(), zx_status::Status> {
5296        use fidl::Peered;
5297        self.inner.channel().signal_peer(clear_mask, set_mask)
5298    }
5299}
5300
5301impl CoverageDataProviderControlHandle {}
5302
5303#[must_use = "FIDL methods require a response to be sent"]
5304#[derive(Debug)]
5305pub struct CoverageDataProviderWatchCoverageDataResponder {
5306    control_handle: std::mem::ManuallyDrop<CoverageDataProviderControlHandle>,
5307    tx_id: u32,
5308}
5309
5310/// Set the the channel to be shutdown (see [`CoverageDataProviderControlHandle::shutdown`])
5311/// if the responder is dropped without sending a response, so that the client
5312/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5313impl std::ops::Drop for CoverageDataProviderWatchCoverageDataResponder {
5314    fn drop(&mut self) {
5315        self.control_handle.shutdown();
5316        // Safety: drops once, never accessed again
5317        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5318    }
5319}
5320
5321impl fidl::endpoints::Responder for CoverageDataProviderWatchCoverageDataResponder {
5322    type ControlHandle = CoverageDataProviderControlHandle;
5323
5324    fn control_handle(&self) -> &CoverageDataProviderControlHandle {
5325        &self.control_handle
5326    }
5327
5328    fn drop_without_shutdown(mut self) {
5329        // Safety: drops once, never accessed again due to mem::forget
5330        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5331        // Prevent Drop from running (which would shut down the channel)
5332        std::mem::forget(self);
5333    }
5334}
5335
5336impl CoverageDataProviderWatchCoverageDataResponder {
5337    /// Sends a response to the FIDL transaction.
5338    ///
5339    /// Sets the channel to shutdown if an error occurs.
5340    pub fn send(self, mut coverage_data: Vec<CoverageData>) -> Result<(), fidl::Error> {
5341        let _result = self.send_raw(coverage_data);
5342        if _result.is_err() {
5343            self.control_handle.shutdown();
5344        }
5345        self.drop_without_shutdown();
5346        _result
5347    }
5348
5349    /// Similar to "send" but does not shutdown the channel if an error occurs.
5350    pub fn send_no_shutdown_on_err(
5351        self,
5352        mut coverage_data: Vec<CoverageData>,
5353    ) -> Result<(), fidl::Error> {
5354        let _result = self.send_raw(coverage_data);
5355        self.drop_without_shutdown();
5356        _result
5357    }
5358
5359    fn send_raw(&self, mut coverage_data: Vec<CoverageData>) -> Result<(), fidl::Error> {
5360        self.control_handle.inner.send::<CoverageDataProviderWatchCoverageDataResponse>(
5361            (coverage_data.as_mut(),),
5362            self.tx_id,
5363            0x34a92fc9c73bea5a,
5364            fidl::encoding::DynamicFlags::empty(),
5365        )
5366    }
5367}
5368
5369#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5370pub struct ManagerMarker;
5371
5372impl fidl::endpoints::ProtocolMarker for ManagerMarker {
5373    type Proxy = ManagerProxy;
5374    type RequestStream = ManagerRequestStream;
5375    #[cfg(target_os = "fuchsia")]
5376    type SynchronousProxy = ManagerSynchronousProxy;
5377
5378    const DEBUG_NAME: &'static str = "fuchsia.fuzzer.Manager";
5379}
5380impl fidl::endpoints::DiscoverableProtocolMarker for ManagerMarker {}
5381pub type ManagerConnectResult = Result<(), i32>;
5382pub type ManagerGetOutputResult = Result<(), i32>;
5383pub type ManagerStopResult = Result<(), i32>;
5384
5385pub trait ManagerProxyInterface: Send + Sync {
5386    type ConnectResponseFut: std::future::Future<Output = Result<ManagerConnectResult, fidl::Error>>
5387        + Send;
5388    fn r#connect(
5389        &self,
5390        fuzzer_url: &str,
5391        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5392    ) -> Self::ConnectResponseFut;
5393    type GetOutputResponseFut: std::future::Future<Output = Result<ManagerGetOutputResult, fidl::Error>>
5394        + Send;
5395    fn r#get_output(
5396        &self,
5397        fuzzer_url: &str,
5398        output: TestOutput,
5399        socket: fidl::Socket,
5400    ) -> Self::GetOutputResponseFut;
5401    type StopResponseFut: std::future::Future<Output = Result<ManagerStopResult, fidl::Error>>
5402        + Send;
5403    fn r#stop(&self, fuzzer_url: &str) -> Self::StopResponseFut;
5404}
5405#[derive(Debug)]
5406#[cfg(target_os = "fuchsia")]
5407pub struct ManagerSynchronousProxy {
5408    client: fidl::client::sync::Client,
5409}
5410
5411#[cfg(target_os = "fuchsia")]
5412impl fidl::endpoints::SynchronousProxy for ManagerSynchronousProxy {
5413    type Proxy = ManagerProxy;
5414    type Protocol = ManagerMarker;
5415
5416    fn from_channel(inner: fidl::Channel) -> Self {
5417        Self::new(inner)
5418    }
5419
5420    fn into_channel(self) -> fidl::Channel {
5421        self.client.into_channel()
5422    }
5423
5424    fn as_channel(&self) -> &fidl::Channel {
5425        self.client.as_channel()
5426    }
5427}
5428
5429#[cfg(target_os = "fuchsia")]
5430impl ManagerSynchronousProxy {
5431    pub fn new(channel: fidl::Channel) -> Self {
5432        Self { client: fidl::client::sync::Client::new(channel) }
5433    }
5434
5435    pub fn into_channel(self) -> fidl::Channel {
5436        self.client.into_channel()
5437    }
5438
5439    /// Waits until an event arrives and returns it. It is safe for other
5440    /// threads to make concurrent requests while waiting for an event.
5441    pub fn wait_for_event(
5442        &self,
5443        deadline: zx::MonotonicInstant,
5444    ) -> Result<ManagerEvent, fidl::Error> {
5445        ManagerEvent::decode(self.client.wait_for_event::<ManagerMarker>(deadline)?)
5446    }
5447
5448    /// Connects to a fuzzer that implements the `fuchsia.fuzzer/Controller`
5449    /// protocol.
5450    ///
5451    /// If the fuzzer is not currently running, the `fuzz_manager` will first
5452    /// start it (via the test_manager) before proceeding. The `fuzz_manager`
5453    /// sends the `controller` on to the fuzz-registry, which contains the
5454    /// `ControllerProviders` that can fulfill the connection request.
5455    ///
5456    /// See `fuchsia.test.manager/LaunchError` for details on ways
5457    /// `test_manager` can fail.
5458    ///
5459    /// + request `fuzzer_url` the package URL for the fuzzer.
5460    /// + request `controller` the connection from the client.
5461    /// * error one of the following:
5462    ///     * `ZX_ERR_NO_RESOURCES` if `test_manager` needs resources that are
5463    ///       unavailable.
5464    ///     * `ZX_ERR_NOT_FOUND` if the fuzzer URL is not recognized by
5465    ///       `test_manager`.
5466    ///     * `ZX_ERR_INVALID_ARGS` if `test_manager` reports invalid arguments.
5467    ///     * `ZX_ERR_NOT_SUPPORTED` if `test_manager` cannot connect to the
5468    ///       test suite.
5469    ///     * `ZX_ERR_INTERNAL` if `test_manager` encountered some other,
5470    ///       unspecified failure.
5471    ///     * `ZX_ERR_TIMED_OUT` if the fuzzer is not present or added to
5472    ///       fuzz-registry after starting.
5473    ///     * `ZX_ERR_SHOULD_WAIT` if another fuzzer is still starting.
5474    pub fn r#connect(
5475        &self,
5476        mut fuzzer_url: &str,
5477        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5478        ___deadline: zx::MonotonicInstant,
5479    ) -> Result<ManagerConnectResult, fidl::Error> {
5480        let _response = self.client.send_query::<
5481            ManagerConnectRequest,
5482            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5483            ManagerMarker,
5484        >(
5485            (fuzzer_url, controller,),
5486            0x1620cd742a89f064,
5487            fidl::encoding::DynamicFlags::empty(),
5488            ___deadline,
5489        )?;
5490        Ok(_response.map(|x| x))
5491    }
5492
5493    /// Forwards the fuzzer's output of the given type to the provided socket.
5494    ///
5495    /// If this method is called multiple times for the same output type, the
5496    /// socket from the subsequent call replaces the socket from the earlier
5497    /// call, which is closed.
5498    ///
5499    /// + request `fuzzer_url` the package URL for the fuzzer.
5500    /// + request `output` the type of the output stream to forward.
5501    /// + request `socket` a socket to forward the output stream to.
5502    /// * error one of the following:
5503    ///     * `ZX_ERR_INVALID_ARGS` if the URL cannot be parsed.
5504    ///     * `ZX_ERR_NOT_FOUND` if the fuzzer URL was not recognized by
5505    ///       `test_manager`.
5506    ///     * `ZX_ERR_BAD_STATE` if the fuzzer is not connected.
5507    pub fn r#get_output(
5508        &self,
5509        mut fuzzer_url: &str,
5510        mut output: TestOutput,
5511        mut socket: fidl::Socket,
5512        ___deadline: zx::MonotonicInstant,
5513    ) -> Result<ManagerGetOutputResult, fidl::Error> {
5514        let _response = self.client.send_query::<
5515            ManagerGetOutputRequest,
5516            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5517            ManagerMarker,
5518        >(
5519            (fuzzer_url, output, socket,),
5520            0x755c28eecf20a88d,
5521            fidl::encoding::DynamicFlags::empty(),
5522            ___deadline,
5523        )?;
5524        Ok(_response.map(|x| x))
5525    }
5526
5527    /// Stops the associated fuzzer immediately, ending any workflows in
5528    /// progress.
5529    ///
5530    /// + request `fuzzer_url` the package URL for the fuzzer.
5531    /// * error `ZX_ERR_NOT_FOUND` if no fuzzer was active with the given URL.
5532    pub fn r#stop(
5533        &self,
5534        mut fuzzer_url: &str,
5535        ___deadline: zx::MonotonicInstant,
5536    ) -> Result<ManagerStopResult, fidl::Error> {
5537        let _response = self.client.send_query::<
5538            ManagerStopRequest,
5539            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5540            ManagerMarker,
5541        >(
5542            (fuzzer_url,),
5543            0x27e53d86badd21f3,
5544            fidl::encoding::DynamicFlags::empty(),
5545            ___deadline,
5546        )?;
5547        Ok(_response.map(|x| x))
5548    }
5549}
5550
5551#[cfg(target_os = "fuchsia")]
5552impl From<ManagerSynchronousProxy> for zx::NullableHandle {
5553    fn from(value: ManagerSynchronousProxy) -> Self {
5554        value.into_channel().into()
5555    }
5556}
5557
5558#[cfg(target_os = "fuchsia")]
5559impl From<fidl::Channel> for ManagerSynchronousProxy {
5560    fn from(value: fidl::Channel) -> Self {
5561        Self::new(value)
5562    }
5563}
5564
5565#[cfg(target_os = "fuchsia")]
5566impl fidl::endpoints::FromClient for ManagerSynchronousProxy {
5567    type Protocol = ManagerMarker;
5568
5569    fn from_client(value: fidl::endpoints::ClientEnd<ManagerMarker>) -> Self {
5570        Self::new(value.into_channel())
5571    }
5572}
5573
5574#[derive(Debug, Clone)]
5575pub struct ManagerProxy {
5576    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5577}
5578
5579impl fidl::endpoints::Proxy for ManagerProxy {
5580    type Protocol = ManagerMarker;
5581
5582    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5583        Self::new(inner)
5584    }
5585
5586    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5587        self.client.into_channel().map_err(|client| Self { client })
5588    }
5589
5590    fn as_channel(&self) -> &::fidl::AsyncChannel {
5591        self.client.as_channel()
5592    }
5593}
5594
5595impl ManagerProxy {
5596    /// Create a new Proxy for fuchsia.fuzzer/Manager.
5597    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5598        let protocol_name = <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5599        Self { client: fidl::client::Client::new(channel, protocol_name) }
5600    }
5601
5602    /// Get a Stream of events from the remote end of the protocol.
5603    ///
5604    /// # Panics
5605    ///
5606    /// Panics if the event stream was already taken.
5607    pub fn take_event_stream(&self) -> ManagerEventStream {
5608        ManagerEventStream { event_receiver: self.client.take_event_receiver() }
5609    }
5610
5611    /// Connects to a fuzzer that implements the `fuchsia.fuzzer/Controller`
5612    /// protocol.
5613    ///
5614    /// If the fuzzer is not currently running, the `fuzz_manager` will first
5615    /// start it (via the test_manager) before proceeding. The `fuzz_manager`
5616    /// sends the `controller` on to the fuzz-registry, which contains the
5617    /// `ControllerProviders` that can fulfill the connection request.
5618    ///
5619    /// See `fuchsia.test.manager/LaunchError` for details on ways
5620    /// `test_manager` can fail.
5621    ///
5622    /// + request `fuzzer_url` the package URL for the fuzzer.
5623    /// + request `controller` the connection from the client.
5624    /// * error one of the following:
5625    ///     * `ZX_ERR_NO_RESOURCES` if `test_manager` needs resources that are
5626    ///       unavailable.
5627    ///     * `ZX_ERR_NOT_FOUND` if the fuzzer URL is not recognized by
5628    ///       `test_manager`.
5629    ///     * `ZX_ERR_INVALID_ARGS` if `test_manager` reports invalid arguments.
5630    ///     * `ZX_ERR_NOT_SUPPORTED` if `test_manager` cannot connect to the
5631    ///       test suite.
5632    ///     * `ZX_ERR_INTERNAL` if `test_manager` encountered some other,
5633    ///       unspecified failure.
5634    ///     * `ZX_ERR_TIMED_OUT` if the fuzzer is not present or added to
5635    ///       fuzz-registry after starting.
5636    ///     * `ZX_ERR_SHOULD_WAIT` if another fuzzer is still starting.
5637    pub fn r#connect(
5638        &self,
5639        mut fuzzer_url: &str,
5640        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5641    ) -> fidl::client::QueryResponseFut<
5642        ManagerConnectResult,
5643        fidl::encoding::DefaultFuchsiaResourceDialect,
5644    > {
5645        ManagerProxyInterface::r#connect(self, fuzzer_url, controller)
5646    }
5647
5648    /// Forwards the fuzzer's output of the given type to the provided socket.
5649    ///
5650    /// If this method is called multiple times for the same output type, the
5651    /// socket from the subsequent call replaces the socket from the earlier
5652    /// call, which is closed.
5653    ///
5654    /// + request `fuzzer_url` the package URL for the fuzzer.
5655    /// + request `output` the type of the output stream to forward.
5656    /// + request `socket` a socket to forward the output stream to.
5657    /// * error one of the following:
5658    ///     * `ZX_ERR_INVALID_ARGS` if the URL cannot be parsed.
5659    ///     * `ZX_ERR_NOT_FOUND` if the fuzzer URL was not recognized by
5660    ///       `test_manager`.
5661    ///     * `ZX_ERR_BAD_STATE` if the fuzzer is not connected.
5662    pub fn r#get_output(
5663        &self,
5664        mut fuzzer_url: &str,
5665        mut output: TestOutput,
5666        mut socket: fidl::Socket,
5667    ) -> fidl::client::QueryResponseFut<
5668        ManagerGetOutputResult,
5669        fidl::encoding::DefaultFuchsiaResourceDialect,
5670    > {
5671        ManagerProxyInterface::r#get_output(self, fuzzer_url, output, socket)
5672    }
5673
5674    /// Stops the associated fuzzer immediately, ending any workflows in
5675    /// progress.
5676    ///
5677    /// + request `fuzzer_url` the package URL for the fuzzer.
5678    /// * error `ZX_ERR_NOT_FOUND` if no fuzzer was active with the given URL.
5679    pub fn r#stop(
5680        &self,
5681        mut fuzzer_url: &str,
5682    ) -> fidl::client::QueryResponseFut<
5683        ManagerStopResult,
5684        fidl::encoding::DefaultFuchsiaResourceDialect,
5685    > {
5686        ManagerProxyInterface::r#stop(self, fuzzer_url)
5687    }
5688}
5689
5690impl ManagerProxyInterface for ManagerProxy {
5691    type ConnectResponseFut = fidl::client::QueryResponseFut<
5692        ManagerConnectResult,
5693        fidl::encoding::DefaultFuchsiaResourceDialect,
5694    >;
5695    fn r#connect(
5696        &self,
5697        mut fuzzer_url: &str,
5698        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5699    ) -> Self::ConnectResponseFut {
5700        fn _decode(
5701            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5702        ) -> Result<ManagerConnectResult, fidl::Error> {
5703            let _response = fidl::client::decode_transaction_body::<
5704                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5705                fidl::encoding::DefaultFuchsiaResourceDialect,
5706                0x1620cd742a89f064,
5707            >(_buf?)?;
5708            Ok(_response.map(|x| x))
5709        }
5710        self.client.send_query_and_decode::<ManagerConnectRequest, ManagerConnectResult>(
5711            (fuzzer_url, controller),
5712            0x1620cd742a89f064,
5713            fidl::encoding::DynamicFlags::empty(),
5714            _decode,
5715        )
5716    }
5717
5718    type GetOutputResponseFut = fidl::client::QueryResponseFut<
5719        ManagerGetOutputResult,
5720        fidl::encoding::DefaultFuchsiaResourceDialect,
5721    >;
5722    fn r#get_output(
5723        &self,
5724        mut fuzzer_url: &str,
5725        mut output: TestOutput,
5726        mut socket: fidl::Socket,
5727    ) -> Self::GetOutputResponseFut {
5728        fn _decode(
5729            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5730        ) -> Result<ManagerGetOutputResult, fidl::Error> {
5731            let _response = fidl::client::decode_transaction_body::<
5732                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5733                fidl::encoding::DefaultFuchsiaResourceDialect,
5734                0x755c28eecf20a88d,
5735            >(_buf?)?;
5736            Ok(_response.map(|x| x))
5737        }
5738        self.client.send_query_and_decode::<ManagerGetOutputRequest, ManagerGetOutputResult>(
5739            (fuzzer_url, output, socket),
5740            0x755c28eecf20a88d,
5741            fidl::encoding::DynamicFlags::empty(),
5742            _decode,
5743        )
5744    }
5745
5746    type StopResponseFut = fidl::client::QueryResponseFut<
5747        ManagerStopResult,
5748        fidl::encoding::DefaultFuchsiaResourceDialect,
5749    >;
5750    fn r#stop(&self, mut fuzzer_url: &str) -> Self::StopResponseFut {
5751        fn _decode(
5752            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5753        ) -> Result<ManagerStopResult, fidl::Error> {
5754            let _response = fidl::client::decode_transaction_body::<
5755                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
5756                fidl::encoding::DefaultFuchsiaResourceDialect,
5757                0x27e53d86badd21f3,
5758            >(_buf?)?;
5759            Ok(_response.map(|x| x))
5760        }
5761        self.client.send_query_and_decode::<ManagerStopRequest, ManagerStopResult>(
5762            (fuzzer_url,),
5763            0x27e53d86badd21f3,
5764            fidl::encoding::DynamicFlags::empty(),
5765            _decode,
5766        )
5767    }
5768}
5769
5770pub struct ManagerEventStream {
5771    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5772}
5773
5774impl std::marker::Unpin for ManagerEventStream {}
5775
5776impl futures::stream::FusedStream for ManagerEventStream {
5777    fn is_terminated(&self) -> bool {
5778        self.event_receiver.is_terminated()
5779    }
5780}
5781
5782impl futures::Stream for ManagerEventStream {
5783    type Item = Result<ManagerEvent, fidl::Error>;
5784
5785    fn poll_next(
5786        mut self: std::pin::Pin<&mut Self>,
5787        cx: &mut std::task::Context<'_>,
5788    ) -> std::task::Poll<Option<Self::Item>> {
5789        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5790            &mut self.event_receiver,
5791            cx
5792        )?) {
5793            Some(buf) => std::task::Poll::Ready(Some(ManagerEvent::decode(buf))),
5794            None => std::task::Poll::Ready(None),
5795        }
5796    }
5797}
5798
5799#[derive(Debug)]
5800pub enum ManagerEvent {}
5801
5802impl ManagerEvent {
5803    /// Decodes a message buffer as a [`ManagerEvent`].
5804    fn decode(
5805        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5806    ) -> Result<ManagerEvent, fidl::Error> {
5807        let (bytes, _handles) = buf.split_mut();
5808        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5809        debug_assert_eq!(tx_header.tx_id, 0);
5810        match tx_header.ordinal {
5811            _ => Err(fidl::Error::UnknownOrdinal {
5812                ordinal: tx_header.ordinal,
5813                protocol_name: <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5814            }),
5815        }
5816    }
5817}
5818
5819/// A Stream of incoming requests for fuchsia.fuzzer/Manager.
5820pub struct ManagerRequestStream {
5821    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5822    is_terminated: bool,
5823}
5824
5825impl std::marker::Unpin for ManagerRequestStream {}
5826
5827impl futures::stream::FusedStream for ManagerRequestStream {
5828    fn is_terminated(&self) -> bool {
5829        self.is_terminated
5830    }
5831}
5832
5833impl fidl::endpoints::RequestStream for ManagerRequestStream {
5834    type Protocol = ManagerMarker;
5835    type ControlHandle = ManagerControlHandle;
5836
5837    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5838        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5839    }
5840
5841    fn control_handle(&self) -> Self::ControlHandle {
5842        ManagerControlHandle { inner: self.inner.clone() }
5843    }
5844
5845    fn into_inner(
5846        self,
5847    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5848    {
5849        (self.inner, self.is_terminated)
5850    }
5851
5852    fn from_inner(
5853        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5854        is_terminated: bool,
5855    ) -> Self {
5856        Self { inner, is_terminated }
5857    }
5858}
5859
5860impl futures::Stream for ManagerRequestStream {
5861    type Item = Result<ManagerRequest, fidl::Error>;
5862
5863    fn poll_next(
5864        mut self: std::pin::Pin<&mut Self>,
5865        cx: &mut std::task::Context<'_>,
5866    ) -> std::task::Poll<Option<Self::Item>> {
5867        let this = &mut *self;
5868        if this.inner.check_shutdown(cx) {
5869            this.is_terminated = true;
5870            return std::task::Poll::Ready(None);
5871        }
5872        if this.is_terminated {
5873            panic!("polled ManagerRequestStream after completion");
5874        }
5875        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5876            |bytes, handles| {
5877                match this.inner.channel().read_etc(cx, bytes, handles) {
5878                    std::task::Poll::Ready(Ok(())) => {}
5879                    std::task::Poll::Pending => return std::task::Poll::Pending,
5880                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5881                        this.is_terminated = true;
5882                        return std::task::Poll::Ready(None);
5883                    }
5884                    std::task::Poll::Ready(Err(e)) => {
5885                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5886                            e.into(),
5887                        ))));
5888                    }
5889                }
5890
5891                // A message has been received from the channel
5892                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5893
5894                std::task::Poll::Ready(Some(match header.ordinal {
5895                    0x1620cd742a89f064 => {
5896                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5897                        let mut req = fidl::new_empty!(
5898                            ManagerConnectRequest,
5899                            fidl::encoding::DefaultFuchsiaResourceDialect
5900                        );
5901                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5902                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
5903                        Ok(ManagerRequest::Connect {
5904                            fuzzer_url: req.fuzzer_url,
5905                            controller: req.controller,
5906
5907                            responder: ManagerConnectResponder {
5908                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5909                                tx_id: header.tx_id,
5910                            },
5911                        })
5912                    }
5913                    0x755c28eecf20a88d => {
5914                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5915                        let mut req = fidl::new_empty!(
5916                            ManagerGetOutputRequest,
5917                            fidl::encoding::DefaultFuchsiaResourceDialect
5918                        );
5919                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerGetOutputRequest>(&header, _body_bytes, handles, &mut req)?;
5920                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
5921                        Ok(ManagerRequest::GetOutput {
5922                            fuzzer_url: req.fuzzer_url,
5923                            output: req.output,
5924                            socket: req.socket,
5925
5926                            responder: ManagerGetOutputResponder {
5927                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5928                                tx_id: header.tx_id,
5929                            },
5930                        })
5931                    }
5932                    0x27e53d86badd21f3 => {
5933                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5934                        let mut req = fidl::new_empty!(
5935                            ManagerStopRequest,
5936                            fidl::encoding::DefaultFuchsiaResourceDialect
5937                        );
5938                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ManagerStopRequest>(&header, _body_bytes, handles, &mut req)?;
5939                        let control_handle = ManagerControlHandle { inner: this.inner.clone() };
5940                        Ok(ManagerRequest::Stop {
5941                            fuzzer_url: req.fuzzer_url,
5942
5943                            responder: ManagerStopResponder {
5944                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5945                                tx_id: header.tx_id,
5946                            },
5947                        })
5948                    }
5949                    _ => Err(fidl::Error::UnknownOrdinal {
5950                        ordinal: header.ordinal,
5951                        protocol_name:
5952                            <ManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5953                    }),
5954                }))
5955            },
5956        )
5957    }
5958}
5959
5960/// Entry point for users, e.g. `ffx fuzz`, used to start and stop fuzzers. A
5961/// fuzzer will be started on the first call to `Connect` with a given URL.
5962/// Closing the given `Controller` channel does *not* stop the associated
5963/// fuzzer. Instead, since fuzzing is meant to be long-running, clients
5964/// may drop the connection and re-`Connect` some time later.
5965#[derive(Debug)]
5966pub enum ManagerRequest {
5967    /// Connects to a fuzzer that implements the `fuchsia.fuzzer/Controller`
5968    /// protocol.
5969    ///
5970    /// If the fuzzer is not currently running, the `fuzz_manager` will first
5971    /// start it (via the test_manager) before proceeding. The `fuzz_manager`
5972    /// sends the `controller` on to the fuzz-registry, which contains the
5973    /// `ControllerProviders` that can fulfill the connection request.
5974    ///
5975    /// See `fuchsia.test.manager/LaunchError` for details on ways
5976    /// `test_manager` can fail.
5977    ///
5978    /// + request `fuzzer_url` the package URL for the fuzzer.
5979    /// + request `controller` the connection from the client.
5980    /// * error one of the following:
5981    ///     * `ZX_ERR_NO_RESOURCES` if `test_manager` needs resources that are
5982    ///       unavailable.
5983    ///     * `ZX_ERR_NOT_FOUND` if the fuzzer URL is not recognized by
5984    ///       `test_manager`.
5985    ///     * `ZX_ERR_INVALID_ARGS` if `test_manager` reports invalid arguments.
5986    ///     * `ZX_ERR_NOT_SUPPORTED` if `test_manager` cannot connect to the
5987    ///       test suite.
5988    ///     * `ZX_ERR_INTERNAL` if `test_manager` encountered some other,
5989    ///       unspecified failure.
5990    ///     * `ZX_ERR_TIMED_OUT` if the fuzzer is not present or added to
5991    ///       fuzz-registry after starting.
5992    ///     * `ZX_ERR_SHOULD_WAIT` if another fuzzer is still starting.
5993    Connect {
5994        fuzzer_url: String,
5995        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
5996        responder: ManagerConnectResponder,
5997    },
5998    /// Forwards the fuzzer's output of the given type to the provided socket.
5999    ///
6000    /// If this method is called multiple times for the same output type, the
6001    /// socket from the subsequent call replaces the socket from the earlier
6002    /// call, which is closed.
6003    ///
6004    /// + request `fuzzer_url` the package URL for the fuzzer.
6005    /// + request `output` the type of the output stream to forward.
6006    /// + request `socket` a socket to forward the output stream to.
6007    /// * error one of the following:
6008    ///     * `ZX_ERR_INVALID_ARGS` if the URL cannot be parsed.
6009    ///     * `ZX_ERR_NOT_FOUND` if the fuzzer URL was not recognized by
6010    ///       `test_manager`.
6011    ///     * `ZX_ERR_BAD_STATE` if the fuzzer is not connected.
6012    GetOutput {
6013        fuzzer_url: String,
6014        output: TestOutput,
6015        socket: fidl::Socket,
6016        responder: ManagerGetOutputResponder,
6017    },
6018    /// Stops the associated fuzzer immediately, ending any workflows in
6019    /// progress.
6020    ///
6021    /// + request `fuzzer_url` the package URL for the fuzzer.
6022    /// * error `ZX_ERR_NOT_FOUND` if no fuzzer was active with the given URL.
6023    Stop { fuzzer_url: String, responder: ManagerStopResponder },
6024}
6025
6026impl ManagerRequest {
6027    #[allow(irrefutable_let_patterns)]
6028    pub fn into_connect(
6029        self,
6030    ) -> Option<(String, fidl::endpoints::ServerEnd<ControllerMarker>, ManagerConnectResponder)>
6031    {
6032        if let ManagerRequest::Connect { fuzzer_url, controller, responder } = self {
6033            Some((fuzzer_url, controller, responder))
6034        } else {
6035            None
6036        }
6037    }
6038
6039    #[allow(irrefutable_let_patterns)]
6040    pub fn into_get_output(
6041        self,
6042    ) -> Option<(String, TestOutput, fidl::Socket, ManagerGetOutputResponder)> {
6043        if let ManagerRequest::GetOutput { fuzzer_url, output, socket, responder } = self {
6044            Some((fuzzer_url, output, socket, responder))
6045        } else {
6046            None
6047        }
6048    }
6049
6050    #[allow(irrefutable_let_patterns)]
6051    pub fn into_stop(self) -> Option<(String, ManagerStopResponder)> {
6052        if let ManagerRequest::Stop { fuzzer_url, responder } = self {
6053            Some((fuzzer_url, responder))
6054        } else {
6055            None
6056        }
6057    }
6058
6059    /// Name of the method defined in FIDL
6060    pub fn method_name(&self) -> &'static str {
6061        match *self {
6062            ManagerRequest::Connect { .. } => "connect",
6063            ManagerRequest::GetOutput { .. } => "get_output",
6064            ManagerRequest::Stop { .. } => "stop",
6065        }
6066    }
6067}
6068
6069#[derive(Debug, Clone)]
6070pub struct ManagerControlHandle {
6071    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6072}
6073
6074impl fidl::endpoints::ControlHandle for ManagerControlHandle {
6075    fn shutdown(&self) {
6076        self.inner.shutdown()
6077    }
6078
6079    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6080        self.inner.shutdown_with_epitaph(status)
6081    }
6082
6083    fn is_closed(&self) -> bool {
6084        self.inner.channel().is_closed()
6085    }
6086    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6087        self.inner.channel().on_closed()
6088    }
6089
6090    #[cfg(target_os = "fuchsia")]
6091    fn signal_peer(
6092        &self,
6093        clear_mask: zx::Signals,
6094        set_mask: zx::Signals,
6095    ) -> Result<(), zx_status::Status> {
6096        use fidl::Peered;
6097        self.inner.channel().signal_peer(clear_mask, set_mask)
6098    }
6099}
6100
6101impl ManagerControlHandle {}
6102
6103#[must_use = "FIDL methods require a response to be sent"]
6104#[derive(Debug)]
6105pub struct ManagerConnectResponder {
6106    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
6107    tx_id: u32,
6108}
6109
6110/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
6111/// if the responder is dropped without sending a response, so that the client
6112/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6113impl std::ops::Drop for ManagerConnectResponder {
6114    fn drop(&mut self) {
6115        self.control_handle.shutdown();
6116        // Safety: drops once, never accessed again
6117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6118    }
6119}
6120
6121impl fidl::endpoints::Responder for ManagerConnectResponder {
6122    type ControlHandle = ManagerControlHandle;
6123
6124    fn control_handle(&self) -> &ManagerControlHandle {
6125        &self.control_handle
6126    }
6127
6128    fn drop_without_shutdown(mut self) {
6129        // Safety: drops once, never accessed again due to mem::forget
6130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6131        // Prevent Drop from running (which would shut down the channel)
6132        std::mem::forget(self);
6133    }
6134}
6135
6136impl ManagerConnectResponder {
6137    /// Sends a response to the FIDL transaction.
6138    ///
6139    /// Sets the channel to shutdown if an error occurs.
6140    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6141        let _result = self.send_raw(result);
6142        if _result.is_err() {
6143            self.control_handle.shutdown();
6144        }
6145        self.drop_without_shutdown();
6146        _result
6147    }
6148
6149    /// Similar to "send" but does not shutdown the channel if an error occurs.
6150    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6151        let _result = self.send_raw(result);
6152        self.drop_without_shutdown();
6153        _result
6154    }
6155
6156    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6157        self.control_handle
6158            .inner
6159            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6160                result,
6161                self.tx_id,
6162                0x1620cd742a89f064,
6163                fidl::encoding::DynamicFlags::empty(),
6164            )
6165    }
6166}
6167
6168#[must_use = "FIDL methods require a response to be sent"]
6169#[derive(Debug)]
6170pub struct ManagerGetOutputResponder {
6171    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
6172    tx_id: u32,
6173}
6174
6175/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
6176/// if the responder is dropped without sending a response, so that the client
6177/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6178impl std::ops::Drop for ManagerGetOutputResponder {
6179    fn drop(&mut self) {
6180        self.control_handle.shutdown();
6181        // Safety: drops once, never accessed again
6182        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6183    }
6184}
6185
6186impl fidl::endpoints::Responder for ManagerGetOutputResponder {
6187    type ControlHandle = ManagerControlHandle;
6188
6189    fn control_handle(&self) -> &ManagerControlHandle {
6190        &self.control_handle
6191    }
6192
6193    fn drop_without_shutdown(mut self) {
6194        // Safety: drops once, never accessed again due to mem::forget
6195        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6196        // Prevent Drop from running (which would shut down the channel)
6197        std::mem::forget(self);
6198    }
6199}
6200
6201impl ManagerGetOutputResponder {
6202    /// Sends a response to the FIDL transaction.
6203    ///
6204    /// Sets the channel to shutdown if an error occurs.
6205    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6206        let _result = self.send_raw(result);
6207        if _result.is_err() {
6208            self.control_handle.shutdown();
6209        }
6210        self.drop_without_shutdown();
6211        _result
6212    }
6213
6214    /// Similar to "send" but does not shutdown the channel if an error occurs.
6215    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6216        let _result = self.send_raw(result);
6217        self.drop_without_shutdown();
6218        _result
6219    }
6220
6221    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6222        self.control_handle
6223            .inner
6224            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6225                result,
6226                self.tx_id,
6227                0x755c28eecf20a88d,
6228                fidl::encoding::DynamicFlags::empty(),
6229            )
6230    }
6231}
6232
6233#[must_use = "FIDL methods require a response to be sent"]
6234#[derive(Debug)]
6235pub struct ManagerStopResponder {
6236    control_handle: std::mem::ManuallyDrop<ManagerControlHandle>,
6237    tx_id: u32,
6238}
6239
6240/// Set the the channel to be shutdown (see [`ManagerControlHandle::shutdown`])
6241/// if the responder is dropped without sending a response, so that the client
6242/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6243impl std::ops::Drop for ManagerStopResponder {
6244    fn drop(&mut self) {
6245        self.control_handle.shutdown();
6246        // Safety: drops once, never accessed again
6247        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6248    }
6249}
6250
6251impl fidl::endpoints::Responder for ManagerStopResponder {
6252    type ControlHandle = ManagerControlHandle;
6253
6254    fn control_handle(&self) -> &ManagerControlHandle {
6255        &self.control_handle
6256    }
6257
6258    fn drop_without_shutdown(mut self) {
6259        // Safety: drops once, never accessed again due to mem::forget
6260        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6261        // Prevent Drop from running (which would shut down the channel)
6262        std::mem::forget(self);
6263    }
6264}
6265
6266impl ManagerStopResponder {
6267    /// Sends a response to the FIDL transaction.
6268    ///
6269    /// Sets the channel to shutdown if an error occurs.
6270    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6271        let _result = self.send_raw(result);
6272        if _result.is_err() {
6273            self.control_handle.shutdown();
6274        }
6275        self.drop_without_shutdown();
6276        _result
6277    }
6278
6279    /// Similar to "send" but does not shutdown the channel if an error occurs.
6280    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6281        let _result = self.send_raw(result);
6282        self.drop_without_shutdown();
6283        _result
6284    }
6285
6286    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6287        self.control_handle
6288            .inner
6289            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
6290                result,
6291                self.tx_id,
6292                0x27e53d86badd21f3,
6293                fidl::encoding::DynamicFlags::empty(),
6294            )
6295    }
6296}
6297
6298#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6299pub struct MonitorMarker;
6300
6301impl fidl::endpoints::ProtocolMarker for MonitorMarker {
6302    type Proxy = MonitorProxy;
6303    type RequestStream = MonitorRequestStream;
6304    #[cfg(target_os = "fuchsia")]
6305    type SynchronousProxy = MonitorSynchronousProxy;
6306
6307    const DEBUG_NAME: &'static str = "(anonymous) Monitor";
6308}
6309
6310pub trait MonitorProxyInterface: Send + Sync {
6311    type UpdateResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6312    fn r#update(&self, reason: UpdateReason, status: &Status) -> Self::UpdateResponseFut;
6313}
6314#[derive(Debug)]
6315#[cfg(target_os = "fuchsia")]
6316pub struct MonitorSynchronousProxy {
6317    client: fidl::client::sync::Client,
6318}
6319
6320#[cfg(target_os = "fuchsia")]
6321impl fidl::endpoints::SynchronousProxy for MonitorSynchronousProxy {
6322    type Proxy = MonitorProxy;
6323    type Protocol = MonitorMarker;
6324
6325    fn from_channel(inner: fidl::Channel) -> Self {
6326        Self::new(inner)
6327    }
6328
6329    fn into_channel(self) -> fidl::Channel {
6330        self.client.into_channel()
6331    }
6332
6333    fn as_channel(&self) -> &fidl::Channel {
6334        self.client.as_channel()
6335    }
6336}
6337
6338#[cfg(target_os = "fuchsia")]
6339impl MonitorSynchronousProxy {
6340    pub fn new(channel: fidl::Channel) -> Self {
6341        Self { client: fidl::client::sync::Client::new(channel) }
6342    }
6343
6344    pub fn into_channel(self) -> fidl::Channel {
6345        self.client.into_channel()
6346    }
6347
6348    /// Waits until an event arrives and returns it. It is safe for other
6349    /// threads to make concurrent requests while waiting for an event.
6350    pub fn wait_for_event(
6351        &self,
6352        deadline: zx::MonotonicInstant,
6353    ) -> Result<MonitorEvent, fidl::Error> {
6354        MonitorEvent::decode(self.client.wait_for_event::<MonitorMarker>(deadline)?)
6355    }
6356
6357    /// Sends the current status.
6358    ///
6359    /// + request `reason` the cause of a status change.
6360    /// + status `status` the reported fuzzing metrics.
6361    pub fn r#update(
6362        &self,
6363        mut reason: UpdateReason,
6364        mut status: &Status,
6365        ___deadline: zx::MonotonicInstant,
6366    ) -> Result<(), fidl::Error> {
6367        let _response = self
6368            .client
6369            .send_query::<MonitorUpdateRequest, fidl::encoding::EmptyPayload, MonitorMarker>(
6370                (reason, status),
6371                0x7c773b93c1e6080f,
6372                fidl::encoding::DynamicFlags::empty(),
6373                ___deadline,
6374            )?;
6375        Ok(_response)
6376    }
6377}
6378
6379#[cfg(target_os = "fuchsia")]
6380impl From<MonitorSynchronousProxy> for zx::NullableHandle {
6381    fn from(value: MonitorSynchronousProxy) -> Self {
6382        value.into_channel().into()
6383    }
6384}
6385
6386#[cfg(target_os = "fuchsia")]
6387impl From<fidl::Channel> for MonitorSynchronousProxy {
6388    fn from(value: fidl::Channel) -> Self {
6389        Self::new(value)
6390    }
6391}
6392
6393#[cfg(target_os = "fuchsia")]
6394impl fidl::endpoints::FromClient for MonitorSynchronousProxy {
6395    type Protocol = MonitorMarker;
6396
6397    fn from_client(value: fidl::endpoints::ClientEnd<MonitorMarker>) -> Self {
6398        Self::new(value.into_channel())
6399    }
6400}
6401
6402#[derive(Debug, Clone)]
6403pub struct MonitorProxy {
6404    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6405}
6406
6407impl fidl::endpoints::Proxy for MonitorProxy {
6408    type Protocol = MonitorMarker;
6409
6410    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6411        Self::new(inner)
6412    }
6413
6414    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6415        self.client.into_channel().map_err(|client| Self { client })
6416    }
6417
6418    fn as_channel(&self) -> &::fidl::AsyncChannel {
6419        self.client.as_channel()
6420    }
6421}
6422
6423impl MonitorProxy {
6424    /// Create a new Proxy for fuchsia.fuzzer/Monitor.
6425    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6426        let protocol_name = <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6427        Self { client: fidl::client::Client::new(channel, protocol_name) }
6428    }
6429
6430    /// Get a Stream of events from the remote end of the protocol.
6431    ///
6432    /// # Panics
6433    ///
6434    /// Panics if the event stream was already taken.
6435    pub fn take_event_stream(&self) -> MonitorEventStream {
6436        MonitorEventStream { event_receiver: self.client.take_event_receiver() }
6437    }
6438
6439    /// Sends the current status.
6440    ///
6441    /// + request `reason` the cause of a status change.
6442    /// + status `status` the reported fuzzing metrics.
6443    pub fn r#update(
6444        &self,
6445        mut reason: UpdateReason,
6446        mut status: &Status,
6447    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6448        MonitorProxyInterface::r#update(self, reason, status)
6449    }
6450}
6451
6452impl MonitorProxyInterface for MonitorProxy {
6453    type UpdateResponseFut =
6454        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6455    fn r#update(&self, mut reason: UpdateReason, mut status: &Status) -> Self::UpdateResponseFut {
6456        fn _decode(
6457            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6458        ) -> Result<(), fidl::Error> {
6459            let _response = fidl::client::decode_transaction_body::<
6460                fidl::encoding::EmptyPayload,
6461                fidl::encoding::DefaultFuchsiaResourceDialect,
6462                0x7c773b93c1e6080f,
6463            >(_buf?)?;
6464            Ok(_response)
6465        }
6466        self.client.send_query_and_decode::<MonitorUpdateRequest, ()>(
6467            (reason, status),
6468            0x7c773b93c1e6080f,
6469            fidl::encoding::DynamicFlags::empty(),
6470            _decode,
6471        )
6472    }
6473}
6474
6475pub struct MonitorEventStream {
6476    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6477}
6478
6479impl std::marker::Unpin for MonitorEventStream {}
6480
6481impl futures::stream::FusedStream for MonitorEventStream {
6482    fn is_terminated(&self) -> bool {
6483        self.event_receiver.is_terminated()
6484    }
6485}
6486
6487impl futures::Stream for MonitorEventStream {
6488    type Item = Result<MonitorEvent, fidl::Error>;
6489
6490    fn poll_next(
6491        mut self: std::pin::Pin<&mut Self>,
6492        cx: &mut std::task::Context<'_>,
6493    ) -> std::task::Poll<Option<Self::Item>> {
6494        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6495            &mut self.event_receiver,
6496            cx
6497        )?) {
6498            Some(buf) => std::task::Poll::Ready(Some(MonitorEvent::decode(buf))),
6499            None => std::task::Poll::Ready(None),
6500        }
6501    }
6502}
6503
6504#[derive(Debug)]
6505pub enum MonitorEvent {}
6506
6507impl MonitorEvent {
6508    /// Decodes a message buffer as a [`MonitorEvent`].
6509    fn decode(
6510        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6511    ) -> Result<MonitorEvent, fidl::Error> {
6512        let (bytes, _handles) = buf.split_mut();
6513        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6514        debug_assert_eq!(tx_header.tx_id, 0);
6515        match tx_header.ordinal {
6516            _ => Err(fidl::Error::UnknownOrdinal {
6517                ordinal: tx_header.ordinal,
6518                protocol_name: <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6519            }),
6520        }
6521    }
6522}
6523
6524/// A Stream of incoming requests for fuchsia.fuzzer/Monitor.
6525pub struct MonitorRequestStream {
6526    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6527    is_terminated: bool,
6528}
6529
6530impl std::marker::Unpin for MonitorRequestStream {}
6531
6532impl futures::stream::FusedStream for MonitorRequestStream {
6533    fn is_terminated(&self) -> bool {
6534        self.is_terminated
6535    }
6536}
6537
6538impl fidl::endpoints::RequestStream for MonitorRequestStream {
6539    type Protocol = MonitorMarker;
6540    type ControlHandle = MonitorControlHandle;
6541
6542    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6543        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6544    }
6545
6546    fn control_handle(&self) -> Self::ControlHandle {
6547        MonitorControlHandle { inner: self.inner.clone() }
6548    }
6549
6550    fn into_inner(
6551        self,
6552    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6553    {
6554        (self.inner, self.is_terminated)
6555    }
6556
6557    fn from_inner(
6558        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6559        is_terminated: bool,
6560    ) -> Self {
6561        Self { inner, is_terminated }
6562    }
6563}
6564
6565impl futures::Stream for MonitorRequestStream {
6566    type Item = Result<MonitorRequest, fidl::Error>;
6567
6568    fn poll_next(
6569        mut self: std::pin::Pin<&mut Self>,
6570        cx: &mut std::task::Context<'_>,
6571    ) -> std::task::Poll<Option<Self::Item>> {
6572        let this = &mut *self;
6573        if this.inner.check_shutdown(cx) {
6574            this.is_terminated = true;
6575            return std::task::Poll::Ready(None);
6576        }
6577        if this.is_terminated {
6578            panic!("polled MonitorRequestStream after completion");
6579        }
6580        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6581            |bytes, handles| {
6582                match this.inner.channel().read_etc(cx, bytes, handles) {
6583                    std::task::Poll::Ready(Ok(())) => {}
6584                    std::task::Poll::Pending => return std::task::Poll::Pending,
6585                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6586                        this.is_terminated = true;
6587                        return std::task::Poll::Ready(None);
6588                    }
6589                    std::task::Poll::Ready(Err(e)) => {
6590                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6591                            e.into(),
6592                        ))));
6593                    }
6594                }
6595
6596                // A message has been received from the channel
6597                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6598
6599                std::task::Poll::Ready(Some(match header.ordinal {
6600                    0x7c773b93c1e6080f => {
6601                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6602                        let mut req = fidl::new_empty!(
6603                            MonitorUpdateRequest,
6604                            fidl::encoding::DefaultFuchsiaResourceDialect
6605                        );
6606                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MonitorUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
6607                        let control_handle = MonitorControlHandle { inner: this.inner.clone() };
6608                        Ok(MonitorRequest::Update {
6609                            reason: req.reason,
6610                            status: req.status,
6611
6612                            responder: MonitorUpdateResponder {
6613                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6614                                tx_id: header.tx_id,
6615                            },
6616                        })
6617                    }
6618                    _ => Err(fidl::Error::UnknownOrdinal {
6619                        ordinal: header.ordinal,
6620                        protocol_name:
6621                            <MonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6622                    }),
6623                }))
6624            },
6625        )
6626    }
6627}
6628
6629/// See `Status`. This protocol is used to push status from the `Controller` to
6630/// callers.
6631#[derive(Debug)]
6632pub enum MonitorRequest {
6633    /// Sends the current status.
6634    ///
6635    /// + request `reason` the cause of a status change.
6636    /// + status `status` the reported fuzzing metrics.
6637    Update { reason: UpdateReason, status: Status, responder: MonitorUpdateResponder },
6638}
6639
6640impl MonitorRequest {
6641    #[allow(irrefutable_let_patterns)]
6642    pub fn into_update(self) -> Option<(UpdateReason, Status, MonitorUpdateResponder)> {
6643        if let MonitorRequest::Update { reason, status, responder } = self {
6644            Some((reason, status, responder))
6645        } else {
6646            None
6647        }
6648    }
6649
6650    /// Name of the method defined in FIDL
6651    pub fn method_name(&self) -> &'static str {
6652        match *self {
6653            MonitorRequest::Update { .. } => "update",
6654        }
6655    }
6656}
6657
6658#[derive(Debug, Clone)]
6659pub struct MonitorControlHandle {
6660    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6661}
6662
6663impl fidl::endpoints::ControlHandle for MonitorControlHandle {
6664    fn shutdown(&self) {
6665        self.inner.shutdown()
6666    }
6667
6668    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6669        self.inner.shutdown_with_epitaph(status)
6670    }
6671
6672    fn is_closed(&self) -> bool {
6673        self.inner.channel().is_closed()
6674    }
6675    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6676        self.inner.channel().on_closed()
6677    }
6678
6679    #[cfg(target_os = "fuchsia")]
6680    fn signal_peer(
6681        &self,
6682        clear_mask: zx::Signals,
6683        set_mask: zx::Signals,
6684    ) -> Result<(), zx_status::Status> {
6685        use fidl::Peered;
6686        self.inner.channel().signal_peer(clear_mask, set_mask)
6687    }
6688}
6689
6690impl MonitorControlHandle {}
6691
6692#[must_use = "FIDL methods require a response to be sent"]
6693#[derive(Debug)]
6694pub struct MonitorUpdateResponder {
6695    control_handle: std::mem::ManuallyDrop<MonitorControlHandle>,
6696    tx_id: u32,
6697}
6698
6699/// Set the the channel to be shutdown (see [`MonitorControlHandle::shutdown`])
6700/// if the responder is dropped without sending a response, so that the client
6701/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6702impl std::ops::Drop for MonitorUpdateResponder {
6703    fn drop(&mut self) {
6704        self.control_handle.shutdown();
6705        // Safety: drops once, never accessed again
6706        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6707    }
6708}
6709
6710impl fidl::endpoints::Responder for MonitorUpdateResponder {
6711    type ControlHandle = MonitorControlHandle;
6712
6713    fn control_handle(&self) -> &MonitorControlHandle {
6714        &self.control_handle
6715    }
6716
6717    fn drop_without_shutdown(mut self) {
6718        // Safety: drops once, never accessed again due to mem::forget
6719        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6720        // Prevent Drop from running (which would shut down the channel)
6721        std::mem::forget(self);
6722    }
6723}
6724
6725impl MonitorUpdateResponder {
6726    /// Sends a response to the FIDL transaction.
6727    ///
6728    /// Sets the channel to shutdown if an error occurs.
6729    pub fn send(self) -> Result<(), fidl::Error> {
6730        let _result = self.send_raw();
6731        if _result.is_err() {
6732            self.control_handle.shutdown();
6733        }
6734        self.drop_without_shutdown();
6735        _result
6736    }
6737
6738    /// Similar to "send" but does not shutdown the channel if an error occurs.
6739    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6740        let _result = self.send_raw();
6741        self.drop_without_shutdown();
6742        _result
6743    }
6744
6745    fn send_raw(&self) -> Result<(), fidl::Error> {
6746        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6747            (),
6748            self.tx_id,
6749            0x7c773b93c1e6080f,
6750            fidl::encoding::DynamicFlags::empty(),
6751        )
6752    }
6753}
6754
6755#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6756pub struct RegistrarMarker;
6757
6758impl fidl::endpoints::ProtocolMarker for RegistrarMarker {
6759    type Proxy = RegistrarProxy;
6760    type RequestStream = RegistrarRequestStream;
6761    #[cfg(target_os = "fuchsia")]
6762    type SynchronousProxy = RegistrarSynchronousProxy;
6763
6764    const DEBUG_NAME: &'static str = "fuchsia.fuzzer.Registrar";
6765}
6766impl fidl::endpoints::DiscoverableProtocolMarker for RegistrarMarker {}
6767
6768pub trait RegistrarProxyInterface: Send + Sync {
6769    type RegisterResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6770    fn r#register(
6771        &self,
6772        fuzzer_url: &str,
6773        provider: fidl::endpoints::ClientEnd<ControllerProviderMarker>,
6774    ) -> Self::RegisterResponseFut;
6775}
6776#[derive(Debug)]
6777#[cfg(target_os = "fuchsia")]
6778pub struct RegistrarSynchronousProxy {
6779    client: fidl::client::sync::Client,
6780}
6781
6782#[cfg(target_os = "fuchsia")]
6783impl fidl::endpoints::SynchronousProxy for RegistrarSynchronousProxy {
6784    type Proxy = RegistrarProxy;
6785    type Protocol = RegistrarMarker;
6786
6787    fn from_channel(inner: fidl::Channel) -> Self {
6788        Self::new(inner)
6789    }
6790
6791    fn into_channel(self) -> fidl::Channel {
6792        self.client.into_channel()
6793    }
6794
6795    fn as_channel(&self) -> &fidl::Channel {
6796        self.client.as_channel()
6797    }
6798}
6799
6800#[cfg(target_os = "fuchsia")]
6801impl RegistrarSynchronousProxy {
6802    pub fn new(channel: fidl::Channel) -> Self {
6803        Self { client: fidl::client::sync::Client::new(channel) }
6804    }
6805
6806    pub fn into_channel(self) -> fidl::Channel {
6807        self.client.into_channel()
6808    }
6809
6810    /// Waits until an event arrives and returns it. It is safe for other
6811    /// threads to make concurrent requests while waiting for an event.
6812    pub fn wait_for_event(
6813        &self,
6814        deadline: zx::MonotonicInstant,
6815    ) -> Result<RegistrarEvent, fidl::Error> {
6816        RegistrarEvent::decode(self.client.wait_for_event::<RegistrarMarker>(deadline)?)
6817    }
6818
6819    /// Adds a `ControllerProvider`. This should be called by the fuzzer itself,
6820    /// using the channel provided by the `fuzz_test_runner`, and in response to
6821    /// being started by the `fuzz_manager`.
6822    ///
6823    /// The registry will close the channel to the fuzzer on error, on a
6824    ///  corresponding call to `Registry.Disconnect`, or on exit. The fuzzer
6825    /// should exit when the channel closes.
6826    ///
6827    /// + request `fuzzer_url` the package URL for the fuzzer.
6828    /// + request `provider` the connection to a `ControllerProvider`.
6829    pub fn r#register(
6830        &self,
6831        mut fuzzer_url: &str,
6832        mut provider: fidl::endpoints::ClientEnd<ControllerProviderMarker>,
6833        ___deadline: zx::MonotonicInstant,
6834    ) -> Result<(), fidl::Error> {
6835        let _response = self
6836            .client
6837            .send_query::<RegistrarRegisterRequest, fidl::encoding::EmptyPayload, RegistrarMarker>(
6838                (fuzzer_url, provider),
6839                0x1716ac38e74b2840,
6840                fidl::encoding::DynamicFlags::empty(),
6841                ___deadline,
6842            )?;
6843        Ok(_response)
6844    }
6845}
6846
6847#[cfg(target_os = "fuchsia")]
6848impl From<RegistrarSynchronousProxy> for zx::NullableHandle {
6849    fn from(value: RegistrarSynchronousProxy) -> Self {
6850        value.into_channel().into()
6851    }
6852}
6853
6854#[cfg(target_os = "fuchsia")]
6855impl From<fidl::Channel> for RegistrarSynchronousProxy {
6856    fn from(value: fidl::Channel) -> Self {
6857        Self::new(value)
6858    }
6859}
6860
6861#[cfg(target_os = "fuchsia")]
6862impl fidl::endpoints::FromClient for RegistrarSynchronousProxy {
6863    type Protocol = RegistrarMarker;
6864
6865    fn from_client(value: fidl::endpoints::ClientEnd<RegistrarMarker>) -> Self {
6866        Self::new(value.into_channel())
6867    }
6868}
6869
6870#[derive(Debug, Clone)]
6871pub struct RegistrarProxy {
6872    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6873}
6874
6875impl fidl::endpoints::Proxy for RegistrarProxy {
6876    type Protocol = RegistrarMarker;
6877
6878    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6879        Self::new(inner)
6880    }
6881
6882    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6883        self.client.into_channel().map_err(|client| Self { client })
6884    }
6885
6886    fn as_channel(&self) -> &::fidl::AsyncChannel {
6887        self.client.as_channel()
6888    }
6889}
6890
6891impl RegistrarProxy {
6892    /// Create a new Proxy for fuchsia.fuzzer/Registrar.
6893    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6894        let protocol_name = <RegistrarMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6895        Self { client: fidl::client::Client::new(channel, protocol_name) }
6896    }
6897
6898    /// Get a Stream of events from the remote end of the protocol.
6899    ///
6900    /// # Panics
6901    ///
6902    /// Panics if the event stream was already taken.
6903    pub fn take_event_stream(&self) -> RegistrarEventStream {
6904        RegistrarEventStream { event_receiver: self.client.take_event_receiver() }
6905    }
6906
6907    /// Adds a `ControllerProvider`. This should be called by the fuzzer itself,
6908    /// using the channel provided by the `fuzz_test_runner`, and in response to
6909    /// being started by the `fuzz_manager`.
6910    ///
6911    /// The registry will close the channel to the fuzzer on error, on a
6912    ///  corresponding call to `Registry.Disconnect`, or on exit. The fuzzer
6913    /// should exit when the channel closes.
6914    ///
6915    /// + request `fuzzer_url` the package URL for the fuzzer.
6916    /// + request `provider` the connection to a `ControllerProvider`.
6917    pub fn r#register(
6918        &self,
6919        mut fuzzer_url: &str,
6920        mut provider: fidl::endpoints::ClientEnd<ControllerProviderMarker>,
6921    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6922        RegistrarProxyInterface::r#register(self, fuzzer_url, provider)
6923    }
6924}
6925
6926impl RegistrarProxyInterface for RegistrarProxy {
6927    type RegisterResponseFut =
6928        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6929    fn r#register(
6930        &self,
6931        mut fuzzer_url: &str,
6932        mut provider: fidl::endpoints::ClientEnd<ControllerProviderMarker>,
6933    ) -> Self::RegisterResponseFut {
6934        fn _decode(
6935            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6936        ) -> Result<(), fidl::Error> {
6937            let _response = fidl::client::decode_transaction_body::<
6938                fidl::encoding::EmptyPayload,
6939                fidl::encoding::DefaultFuchsiaResourceDialect,
6940                0x1716ac38e74b2840,
6941            >(_buf?)?;
6942            Ok(_response)
6943        }
6944        self.client.send_query_and_decode::<RegistrarRegisterRequest, ()>(
6945            (fuzzer_url, provider),
6946            0x1716ac38e74b2840,
6947            fidl::encoding::DynamicFlags::empty(),
6948            _decode,
6949        )
6950    }
6951}
6952
6953pub struct RegistrarEventStream {
6954    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6955}
6956
6957impl std::marker::Unpin for RegistrarEventStream {}
6958
6959impl futures::stream::FusedStream for RegistrarEventStream {
6960    fn is_terminated(&self) -> bool {
6961        self.event_receiver.is_terminated()
6962    }
6963}
6964
6965impl futures::Stream for RegistrarEventStream {
6966    type Item = Result<RegistrarEvent, fidl::Error>;
6967
6968    fn poll_next(
6969        mut self: std::pin::Pin<&mut Self>,
6970        cx: &mut std::task::Context<'_>,
6971    ) -> std::task::Poll<Option<Self::Item>> {
6972        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6973            &mut self.event_receiver,
6974            cx
6975        )?) {
6976            Some(buf) => std::task::Poll::Ready(Some(RegistrarEvent::decode(buf))),
6977            None => std::task::Poll::Ready(None),
6978        }
6979    }
6980}
6981
6982#[derive(Debug)]
6983pub enum RegistrarEvent {}
6984
6985impl RegistrarEvent {
6986    /// Decodes a message buffer as a [`RegistrarEvent`].
6987    fn decode(
6988        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6989    ) -> Result<RegistrarEvent, fidl::Error> {
6990        let (bytes, _handles) = buf.split_mut();
6991        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6992        debug_assert_eq!(tx_header.tx_id, 0);
6993        match tx_header.ordinal {
6994            _ => Err(fidl::Error::UnknownOrdinal {
6995                ordinal: tx_header.ordinal,
6996                protocol_name: <RegistrarMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6997            }),
6998        }
6999    }
7000}
7001
7002/// A Stream of incoming requests for fuchsia.fuzzer/Registrar.
7003pub struct RegistrarRequestStream {
7004    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7005    is_terminated: bool,
7006}
7007
7008impl std::marker::Unpin for RegistrarRequestStream {}
7009
7010impl futures::stream::FusedStream for RegistrarRequestStream {
7011    fn is_terminated(&self) -> bool {
7012        self.is_terminated
7013    }
7014}
7015
7016impl fidl::endpoints::RequestStream for RegistrarRequestStream {
7017    type Protocol = RegistrarMarker;
7018    type ControlHandle = RegistrarControlHandle;
7019
7020    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7021        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7022    }
7023
7024    fn control_handle(&self) -> Self::ControlHandle {
7025        RegistrarControlHandle { inner: self.inner.clone() }
7026    }
7027
7028    fn into_inner(
7029        self,
7030    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7031    {
7032        (self.inner, self.is_terminated)
7033    }
7034
7035    fn from_inner(
7036        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7037        is_terminated: bool,
7038    ) -> Self {
7039        Self { inner, is_terminated }
7040    }
7041}
7042
7043impl futures::Stream for RegistrarRequestStream {
7044    type Item = Result<RegistrarRequest, fidl::Error>;
7045
7046    fn poll_next(
7047        mut self: std::pin::Pin<&mut Self>,
7048        cx: &mut std::task::Context<'_>,
7049    ) -> std::task::Poll<Option<Self::Item>> {
7050        let this = &mut *self;
7051        if this.inner.check_shutdown(cx) {
7052            this.is_terminated = true;
7053            return std::task::Poll::Ready(None);
7054        }
7055        if this.is_terminated {
7056            panic!("polled RegistrarRequestStream after completion");
7057        }
7058        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7059            |bytes, handles| {
7060                match this.inner.channel().read_etc(cx, bytes, handles) {
7061                    std::task::Poll::Ready(Ok(())) => {}
7062                    std::task::Poll::Pending => return std::task::Poll::Pending,
7063                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7064                        this.is_terminated = true;
7065                        return std::task::Poll::Ready(None);
7066                    }
7067                    std::task::Poll::Ready(Err(e)) => {
7068                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7069                            e.into(),
7070                        ))));
7071                    }
7072                }
7073
7074                // A message has been received from the channel
7075                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7076
7077                std::task::Poll::Ready(Some(match header.ordinal {
7078                    0x1716ac38e74b2840 => {
7079                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7080                        let mut req = fidl::new_empty!(
7081                            RegistrarRegisterRequest,
7082                            fidl::encoding::DefaultFuchsiaResourceDialect
7083                        );
7084                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistrarRegisterRequest>(&header, _body_bytes, handles, &mut req)?;
7085                        let control_handle = RegistrarControlHandle { inner: this.inner.clone() };
7086                        Ok(RegistrarRequest::Register {
7087                            fuzzer_url: req.fuzzer_url,
7088                            provider: req.provider,
7089
7090                            responder: RegistrarRegisterResponder {
7091                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7092                                tx_id: header.tx_id,
7093                            },
7094                        })
7095                    }
7096                    _ => Err(fidl::Error::UnknownOrdinal {
7097                        ordinal: header.ordinal,
7098                        protocol_name:
7099                            <RegistrarMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7100                    }),
7101                }))
7102            },
7103        )
7104    }
7105}
7106
7107/// Entry point for the `fuzz_test_runner`. It uses this protocol to transfer
7108/// one end of a channel it creates to the `fuzz_manager`. The other end is
7109/// passed as a startup handle to the fuzzer component itself, which is used to
7110/// provide `Controller`s on request.
7111#[derive(Debug)]
7112pub enum RegistrarRequest {
7113    /// Adds a `ControllerProvider`. This should be called by the fuzzer itself,
7114    /// using the channel provided by the `fuzz_test_runner`, and in response to
7115    /// being started by the `fuzz_manager`.
7116    ///
7117    /// The registry will close the channel to the fuzzer on error, on a
7118    ///  corresponding call to `Registry.Disconnect`, or on exit. The fuzzer
7119    /// should exit when the channel closes.
7120    ///
7121    /// + request `fuzzer_url` the package URL for the fuzzer.
7122    /// + request `provider` the connection to a `ControllerProvider`.
7123    Register {
7124        fuzzer_url: String,
7125        provider: fidl::endpoints::ClientEnd<ControllerProviderMarker>,
7126        responder: RegistrarRegisterResponder,
7127    },
7128}
7129
7130impl RegistrarRequest {
7131    #[allow(irrefutable_let_patterns)]
7132    pub fn into_register(
7133        self,
7134    ) -> Option<(
7135        String,
7136        fidl::endpoints::ClientEnd<ControllerProviderMarker>,
7137        RegistrarRegisterResponder,
7138    )> {
7139        if let RegistrarRequest::Register { fuzzer_url, provider, responder } = self {
7140            Some((fuzzer_url, provider, responder))
7141        } else {
7142            None
7143        }
7144    }
7145
7146    /// Name of the method defined in FIDL
7147    pub fn method_name(&self) -> &'static str {
7148        match *self {
7149            RegistrarRequest::Register { .. } => "register",
7150        }
7151    }
7152}
7153
7154#[derive(Debug, Clone)]
7155pub struct RegistrarControlHandle {
7156    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7157}
7158
7159impl fidl::endpoints::ControlHandle for RegistrarControlHandle {
7160    fn shutdown(&self) {
7161        self.inner.shutdown()
7162    }
7163
7164    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7165        self.inner.shutdown_with_epitaph(status)
7166    }
7167
7168    fn is_closed(&self) -> bool {
7169        self.inner.channel().is_closed()
7170    }
7171    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7172        self.inner.channel().on_closed()
7173    }
7174
7175    #[cfg(target_os = "fuchsia")]
7176    fn signal_peer(
7177        &self,
7178        clear_mask: zx::Signals,
7179        set_mask: zx::Signals,
7180    ) -> Result<(), zx_status::Status> {
7181        use fidl::Peered;
7182        self.inner.channel().signal_peer(clear_mask, set_mask)
7183    }
7184}
7185
7186impl RegistrarControlHandle {}
7187
7188#[must_use = "FIDL methods require a response to be sent"]
7189#[derive(Debug)]
7190pub struct RegistrarRegisterResponder {
7191    control_handle: std::mem::ManuallyDrop<RegistrarControlHandle>,
7192    tx_id: u32,
7193}
7194
7195/// Set the the channel to be shutdown (see [`RegistrarControlHandle::shutdown`])
7196/// if the responder is dropped without sending a response, so that the client
7197/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7198impl std::ops::Drop for RegistrarRegisterResponder {
7199    fn drop(&mut self) {
7200        self.control_handle.shutdown();
7201        // Safety: drops once, never accessed again
7202        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7203    }
7204}
7205
7206impl fidl::endpoints::Responder for RegistrarRegisterResponder {
7207    type ControlHandle = RegistrarControlHandle;
7208
7209    fn control_handle(&self) -> &RegistrarControlHandle {
7210        &self.control_handle
7211    }
7212
7213    fn drop_without_shutdown(mut self) {
7214        // Safety: drops once, never accessed again due to mem::forget
7215        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7216        // Prevent Drop from running (which would shut down the channel)
7217        std::mem::forget(self);
7218    }
7219}
7220
7221impl RegistrarRegisterResponder {
7222    /// Sends a response to the FIDL transaction.
7223    ///
7224    /// Sets the channel to shutdown if an error occurs.
7225    pub fn send(self) -> Result<(), fidl::Error> {
7226        let _result = self.send_raw();
7227        if _result.is_err() {
7228            self.control_handle.shutdown();
7229        }
7230        self.drop_without_shutdown();
7231        _result
7232    }
7233
7234    /// Similar to "send" but does not shutdown the channel if an error occurs.
7235    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7236        let _result = self.send_raw();
7237        self.drop_without_shutdown();
7238        _result
7239    }
7240
7241    fn send_raw(&self) -> Result<(), fidl::Error> {
7242        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7243            (),
7244            self.tx_id,
7245            0x1716ac38e74b2840,
7246            fidl::encoding::DynamicFlags::empty(),
7247        )
7248    }
7249}
7250
7251#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7252pub struct RegistryMarker;
7253
7254impl fidl::endpoints::ProtocolMarker for RegistryMarker {
7255    type Proxy = RegistryProxy;
7256    type RequestStream = RegistryRequestStream;
7257    #[cfg(target_os = "fuchsia")]
7258    type SynchronousProxy = RegistrySynchronousProxy;
7259
7260    const DEBUG_NAME: &'static str = "fuchsia.fuzzer.Registry";
7261}
7262impl fidl::endpoints::DiscoverableProtocolMarker for RegistryMarker {}
7263pub type RegistryConnectResult = Result<(), i32>;
7264pub type RegistryDisconnectResult = Result<(), i32>;
7265
7266pub trait RegistryProxyInterface: Send + Sync {
7267    type ConnectResponseFut: std::future::Future<Output = Result<RegistryConnectResult, fidl::Error>>
7268        + Send;
7269    fn r#connect(
7270        &self,
7271        fuzzer_url: &str,
7272        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
7273        timeout: i64,
7274    ) -> Self::ConnectResponseFut;
7275    type DisconnectResponseFut: std::future::Future<Output = Result<RegistryDisconnectResult, fidl::Error>>
7276        + Send;
7277    fn r#disconnect(&self, fuzzer_url: &str) -> Self::DisconnectResponseFut;
7278}
7279#[derive(Debug)]
7280#[cfg(target_os = "fuchsia")]
7281pub struct RegistrySynchronousProxy {
7282    client: fidl::client::sync::Client,
7283}
7284
7285#[cfg(target_os = "fuchsia")]
7286impl fidl::endpoints::SynchronousProxy for RegistrySynchronousProxy {
7287    type Proxy = RegistryProxy;
7288    type Protocol = RegistryMarker;
7289
7290    fn from_channel(inner: fidl::Channel) -> Self {
7291        Self::new(inner)
7292    }
7293
7294    fn into_channel(self) -> fidl::Channel {
7295        self.client.into_channel()
7296    }
7297
7298    fn as_channel(&self) -> &fidl::Channel {
7299        self.client.as_channel()
7300    }
7301}
7302
7303#[cfg(target_os = "fuchsia")]
7304impl RegistrySynchronousProxy {
7305    pub fn new(channel: fidl::Channel) -> Self {
7306        Self { client: fidl::client::sync::Client::new(channel) }
7307    }
7308
7309    pub fn into_channel(self) -> fidl::Channel {
7310        self.client.into_channel()
7311    }
7312
7313    /// Waits until an event arrives and returns it. It is safe for other
7314    /// threads to make concurrent requests while waiting for an event.
7315    pub fn wait_for_event(
7316        &self,
7317        deadline: zx::MonotonicInstant,
7318    ) -> Result<RegistryEvent, fidl::Error> {
7319        RegistryEvent::decode(self.client.wait_for_event::<RegistryMarker>(deadline)?)
7320    }
7321
7322    /// Connects the `Controller` to a registered fuzzer.
7323    ///
7324    /// Uses a `ControllerProvider` that has been `Register`ed with the given
7325    /// URL to connect. If the associated provider is not available, it assumes
7326    /// it is starting and blocks until the fuzzer calls `Registrar.Register`,
7327    /// or the given `timeout` elapses. At most one call to `Connect` will block
7328    /// in this manner at a time.
7329    ///
7330    /// + request `fuzzer_url` the package URL for the fuzzer.
7331    /// + request `provider` the connection to a `Controller` client.
7332    /// + request `tiemout` maximum duration to wait for a connection.
7333    /// * error one of the following:
7334    ///     * `ZX_ERR_TIMED_OUT` if the `timeout` elapses without the provider
7335    ///       becoming available.
7336    ///     * `ZX_ERR_SHOULD_WAIT` if already waiting for a fuzzer to start.
7337    pub fn r#connect(
7338        &self,
7339        mut fuzzer_url: &str,
7340        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
7341        mut timeout: i64,
7342        ___deadline: zx::MonotonicInstant,
7343    ) -> Result<RegistryConnectResult, fidl::Error> {
7344        let _response = self.client.send_query::<
7345            RegistryConnectRequest,
7346            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7347            RegistryMarker,
7348        >(
7349            (fuzzer_url, controller, timeout,),
7350            0x5128cb31967a446f,
7351            fidl::encoding::DynamicFlags::empty(),
7352            ___deadline,
7353        )?;
7354        Ok(_response.map(|x| x))
7355    }
7356
7357    /// Removes the provider associated with the given URL from the registry and
7358    /// closes its channel. The associated fuzzer should exit upon channel
7359    /// closure.
7360    ///
7361    /// + request `fuzzer_url` the package URL for the fuzzer.
7362    /// * error `ZX_ERR_NOT_FOUND` if no such provider exists in the registry.
7363    pub fn r#disconnect(
7364        &self,
7365        mut fuzzer_url: &str,
7366        ___deadline: zx::MonotonicInstant,
7367    ) -> Result<RegistryDisconnectResult, fidl::Error> {
7368        let _response = self.client.send_query::<
7369            RegistryDisconnectRequest,
7370            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7371            RegistryMarker,
7372        >(
7373            (fuzzer_url,),
7374            0x7bb4b7591146d4cb,
7375            fidl::encoding::DynamicFlags::empty(),
7376            ___deadline,
7377        )?;
7378        Ok(_response.map(|x| x))
7379    }
7380}
7381
7382#[cfg(target_os = "fuchsia")]
7383impl From<RegistrySynchronousProxy> for zx::NullableHandle {
7384    fn from(value: RegistrySynchronousProxy) -> Self {
7385        value.into_channel().into()
7386    }
7387}
7388
7389#[cfg(target_os = "fuchsia")]
7390impl From<fidl::Channel> for RegistrySynchronousProxy {
7391    fn from(value: fidl::Channel) -> Self {
7392        Self::new(value)
7393    }
7394}
7395
7396#[cfg(target_os = "fuchsia")]
7397impl fidl::endpoints::FromClient for RegistrySynchronousProxy {
7398    type Protocol = RegistryMarker;
7399
7400    fn from_client(value: fidl::endpoints::ClientEnd<RegistryMarker>) -> Self {
7401        Self::new(value.into_channel())
7402    }
7403}
7404
7405#[derive(Debug, Clone)]
7406pub struct RegistryProxy {
7407    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7408}
7409
7410impl fidl::endpoints::Proxy for RegistryProxy {
7411    type Protocol = RegistryMarker;
7412
7413    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7414        Self::new(inner)
7415    }
7416
7417    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7418        self.client.into_channel().map_err(|client| Self { client })
7419    }
7420
7421    fn as_channel(&self) -> &::fidl::AsyncChannel {
7422        self.client.as_channel()
7423    }
7424}
7425
7426impl RegistryProxy {
7427    /// Create a new Proxy for fuchsia.fuzzer/Registry.
7428    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7429        let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7430        Self { client: fidl::client::Client::new(channel, protocol_name) }
7431    }
7432
7433    /// Get a Stream of events from the remote end of the protocol.
7434    ///
7435    /// # Panics
7436    ///
7437    /// Panics if the event stream was already taken.
7438    pub fn take_event_stream(&self) -> RegistryEventStream {
7439        RegistryEventStream { event_receiver: self.client.take_event_receiver() }
7440    }
7441
7442    /// Connects the `Controller` to a registered fuzzer.
7443    ///
7444    /// Uses a `ControllerProvider` that has been `Register`ed with the given
7445    /// URL to connect. If the associated provider is not available, it assumes
7446    /// it is starting and blocks until the fuzzer calls `Registrar.Register`,
7447    /// or the given `timeout` elapses. At most one call to `Connect` will block
7448    /// in this manner at a time.
7449    ///
7450    /// + request `fuzzer_url` the package URL for the fuzzer.
7451    /// + request `provider` the connection to a `Controller` client.
7452    /// + request `tiemout` maximum duration to wait for a connection.
7453    /// * error one of the following:
7454    ///     * `ZX_ERR_TIMED_OUT` if the `timeout` elapses without the provider
7455    ///       becoming available.
7456    ///     * `ZX_ERR_SHOULD_WAIT` if already waiting for a fuzzer to start.
7457    pub fn r#connect(
7458        &self,
7459        mut fuzzer_url: &str,
7460        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
7461        mut timeout: i64,
7462    ) -> fidl::client::QueryResponseFut<
7463        RegistryConnectResult,
7464        fidl::encoding::DefaultFuchsiaResourceDialect,
7465    > {
7466        RegistryProxyInterface::r#connect(self, fuzzer_url, controller, timeout)
7467    }
7468
7469    /// Removes the provider associated with the given URL from the registry and
7470    /// closes its channel. The associated fuzzer should exit upon channel
7471    /// closure.
7472    ///
7473    /// + request `fuzzer_url` the package URL for the fuzzer.
7474    /// * error `ZX_ERR_NOT_FOUND` if no such provider exists in the registry.
7475    pub fn r#disconnect(
7476        &self,
7477        mut fuzzer_url: &str,
7478    ) -> fidl::client::QueryResponseFut<
7479        RegistryDisconnectResult,
7480        fidl::encoding::DefaultFuchsiaResourceDialect,
7481    > {
7482        RegistryProxyInterface::r#disconnect(self, fuzzer_url)
7483    }
7484}
7485
7486impl RegistryProxyInterface for RegistryProxy {
7487    type ConnectResponseFut = fidl::client::QueryResponseFut<
7488        RegistryConnectResult,
7489        fidl::encoding::DefaultFuchsiaResourceDialect,
7490    >;
7491    fn r#connect(
7492        &self,
7493        mut fuzzer_url: &str,
7494        mut controller: fidl::endpoints::ServerEnd<ControllerMarker>,
7495        mut timeout: i64,
7496    ) -> Self::ConnectResponseFut {
7497        fn _decode(
7498            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7499        ) -> Result<RegistryConnectResult, fidl::Error> {
7500            let _response = fidl::client::decode_transaction_body::<
7501                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7502                fidl::encoding::DefaultFuchsiaResourceDialect,
7503                0x5128cb31967a446f,
7504            >(_buf?)?;
7505            Ok(_response.map(|x| x))
7506        }
7507        self.client.send_query_and_decode::<RegistryConnectRequest, RegistryConnectResult>(
7508            (fuzzer_url, controller, timeout),
7509            0x5128cb31967a446f,
7510            fidl::encoding::DynamicFlags::empty(),
7511            _decode,
7512        )
7513    }
7514
7515    type DisconnectResponseFut = fidl::client::QueryResponseFut<
7516        RegistryDisconnectResult,
7517        fidl::encoding::DefaultFuchsiaResourceDialect,
7518    >;
7519    fn r#disconnect(&self, mut fuzzer_url: &str) -> Self::DisconnectResponseFut {
7520        fn _decode(
7521            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7522        ) -> Result<RegistryDisconnectResult, fidl::Error> {
7523            let _response = fidl::client::decode_transaction_body::<
7524                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
7525                fidl::encoding::DefaultFuchsiaResourceDialect,
7526                0x7bb4b7591146d4cb,
7527            >(_buf?)?;
7528            Ok(_response.map(|x| x))
7529        }
7530        self.client.send_query_and_decode::<RegistryDisconnectRequest, RegistryDisconnectResult>(
7531            (fuzzer_url,),
7532            0x7bb4b7591146d4cb,
7533            fidl::encoding::DynamicFlags::empty(),
7534            _decode,
7535        )
7536    }
7537}
7538
7539pub struct RegistryEventStream {
7540    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7541}
7542
7543impl std::marker::Unpin for RegistryEventStream {}
7544
7545impl futures::stream::FusedStream for RegistryEventStream {
7546    fn is_terminated(&self) -> bool {
7547        self.event_receiver.is_terminated()
7548    }
7549}
7550
7551impl futures::Stream for RegistryEventStream {
7552    type Item = Result<RegistryEvent, fidl::Error>;
7553
7554    fn poll_next(
7555        mut self: std::pin::Pin<&mut Self>,
7556        cx: &mut std::task::Context<'_>,
7557    ) -> std::task::Poll<Option<Self::Item>> {
7558        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7559            &mut self.event_receiver,
7560            cx
7561        )?) {
7562            Some(buf) => std::task::Poll::Ready(Some(RegistryEvent::decode(buf))),
7563            None => std::task::Poll::Ready(None),
7564        }
7565    }
7566}
7567
7568#[derive(Debug)]
7569pub enum RegistryEvent {}
7570
7571impl RegistryEvent {
7572    /// Decodes a message buffer as a [`RegistryEvent`].
7573    fn decode(
7574        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7575    ) -> Result<RegistryEvent, fidl::Error> {
7576        let (bytes, _handles) = buf.split_mut();
7577        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7578        debug_assert_eq!(tx_header.tx_id, 0);
7579        match tx_header.ordinal {
7580            _ => Err(fidl::Error::UnknownOrdinal {
7581                ordinal: tx_header.ordinal,
7582                protocol_name: <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7583            }),
7584        }
7585    }
7586}
7587
7588/// A Stream of incoming requests for fuchsia.fuzzer/Registry.
7589pub struct RegistryRequestStream {
7590    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7591    is_terminated: bool,
7592}
7593
7594impl std::marker::Unpin for RegistryRequestStream {}
7595
7596impl futures::stream::FusedStream for RegistryRequestStream {
7597    fn is_terminated(&self) -> bool {
7598        self.is_terminated
7599    }
7600}
7601
7602impl fidl::endpoints::RequestStream for RegistryRequestStream {
7603    type Protocol = RegistryMarker;
7604    type ControlHandle = RegistryControlHandle;
7605
7606    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7607        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7608    }
7609
7610    fn control_handle(&self) -> Self::ControlHandle {
7611        RegistryControlHandle { inner: self.inner.clone() }
7612    }
7613
7614    fn into_inner(
7615        self,
7616    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7617    {
7618        (self.inner, self.is_terminated)
7619    }
7620
7621    fn from_inner(
7622        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7623        is_terminated: bool,
7624    ) -> Self {
7625        Self { inner, is_terminated }
7626    }
7627}
7628
7629impl futures::Stream for RegistryRequestStream {
7630    type Item = Result<RegistryRequest, fidl::Error>;
7631
7632    fn poll_next(
7633        mut self: std::pin::Pin<&mut Self>,
7634        cx: &mut std::task::Context<'_>,
7635    ) -> std::task::Poll<Option<Self::Item>> {
7636        let this = &mut *self;
7637        if this.inner.check_shutdown(cx) {
7638            this.is_terminated = true;
7639            return std::task::Poll::Ready(None);
7640        }
7641        if this.is_terminated {
7642            panic!("polled RegistryRequestStream after completion");
7643        }
7644        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7645            |bytes, handles| {
7646                match this.inner.channel().read_etc(cx, bytes, handles) {
7647                    std::task::Poll::Ready(Ok(())) => {}
7648                    std::task::Poll::Pending => return std::task::Poll::Pending,
7649                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7650                        this.is_terminated = true;
7651                        return std::task::Poll::Ready(None);
7652                    }
7653                    std::task::Poll::Ready(Err(e)) => {
7654                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7655                            e.into(),
7656                        ))));
7657                    }
7658                }
7659
7660                // A message has been received from the channel
7661                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7662
7663                std::task::Poll::Ready(Some(match header.ordinal {
7664                    0x5128cb31967a446f => {
7665                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7666                        let mut req = fidl::new_empty!(
7667                            RegistryConnectRequest,
7668                            fidl::encoding::DefaultFuchsiaResourceDialect
7669                        );
7670                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryConnectRequest>(&header, _body_bytes, handles, &mut req)?;
7671                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
7672                        Ok(RegistryRequest::Connect {
7673                            fuzzer_url: req.fuzzer_url,
7674                            controller: req.controller,
7675                            timeout: req.timeout,
7676
7677                            responder: RegistryConnectResponder {
7678                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7679                                tx_id: header.tx_id,
7680                            },
7681                        })
7682                    }
7683                    0x7bb4b7591146d4cb => {
7684                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7685                        let mut req = fidl::new_empty!(
7686                            RegistryDisconnectRequest,
7687                            fidl::encoding::DefaultFuchsiaResourceDialect
7688                        );
7689                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryDisconnectRequest>(&header, _body_bytes, handles, &mut req)?;
7690                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
7691                        Ok(RegistryRequest::Disconnect {
7692                            fuzzer_url: req.fuzzer_url,
7693
7694                            responder: RegistryDisconnectResponder {
7695                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7696                                tx_id: header.tx_id,
7697                            },
7698                        })
7699                    }
7700                    _ => Err(fidl::Error::UnknownOrdinal {
7701                        ordinal: header.ordinal,
7702                        protocol_name:
7703                            <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7704                    }),
7705                }))
7706            },
7707        )
7708    }
7709}
7710
7711/// Entry point for the `fuzz_manager`. It uses this protocol to wait for fuzz
7712/// tests started within the test runner framework to register a
7713/// `ControllerProvider`, and to stop those fuzzers upon request.
7714#[derive(Debug)]
7715pub enum RegistryRequest {
7716    /// Connects the `Controller` to a registered fuzzer.
7717    ///
7718    /// Uses a `ControllerProvider` that has been `Register`ed with the given
7719    /// URL to connect. If the associated provider is not available, it assumes
7720    /// it is starting and blocks until the fuzzer calls `Registrar.Register`,
7721    /// or the given `timeout` elapses. At most one call to `Connect` will block
7722    /// in this manner at a time.
7723    ///
7724    /// + request `fuzzer_url` the package URL for the fuzzer.
7725    /// + request `provider` the connection to a `Controller` client.
7726    /// + request `tiemout` maximum duration to wait for a connection.
7727    /// * error one of the following:
7728    ///     * `ZX_ERR_TIMED_OUT` if the `timeout` elapses without the provider
7729    ///       becoming available.
7730    ///     * `ZX_ERR_SHOULD_WAIT` if already waiting for a fuzzer to start.
7731    Connect {
7732        fuzzer_url: String,
7733        controller: fidl::endpoints::ServerEnd<ControllerMarker>,
7734        timeout: i64,
7735        responder: RegistryConnectResponder,
7736    },
7737    /// Removes the provider associated with the given URL from the registry and
7738    /// closes its channel. The associated fuzzer should exit upon channel
7739    /// closure.
7740    ///
7741    /// + request `fuzzer_url` the package URL for the fuzzer.
7742    /// * error `ZX_ERR_NOT_FOUND` if no such provider exists in the registry.
7743    Disconnect { fuzzer_url: String, responder: RegistryDisconnectResponder },
7744}
7745
7746impl RegistryRequest {
7747    #[allow(irrefutable_let_patterns)]
7748    pub fn into_connect(
7749        self,
7750    ) -> Option<(String, fidl::endpoints::ServerEnd<ControllerMarker>, i64, RegistryConnectResponder)>
7751    {
7752        if let RegistryRequest::Connect { fuzzer_url, controller, timeout, responder } = self {
7753            Some((fuzzer_url, controller, timeout, responder))
7754        } else {
7755            None
7756        }
7757    }
7758
7759    #[allow(irrefutable_let_patterns)]
7760    pub fn into_disconnect(self) -> Option<(String, RegistryDisconnectResponder)> {
7761        if let RegistryRequest::Disconnect { fuzzer_url, responder } = self {
7762            Some((fuzzer_url, responder))
7763        } else {
7764            None
7765        }
7766    }
7767
7768    /// Name of the method defined in FIDL
7769    pub fn method_name(&self) -> &'static str {
7770        match *self {
7771            RegistryRequest::Connect { .. } => "connect",
7772            RegistryRequest::Disconnect { .. } => "disconnect",
7773        }
7774    }
7775}
7776
7777#[derive(Debug, Clone)]
7778pub struct RegistryControlHandle {
7779    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7780}
7781
7782impl fidl::endpoints::ControlHandle for RegistryControlHandle {
7783    fn shutdown(&self) {
7784        self.inner.shutdown()
7785    }
7786
7787    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7788        self.inner.shutdown_with_epitaph(status)
7789    }
7790
7791    fn is_closed(&self) -> bool {
7792        self.inner.channel().is_closed()
7793    }
7794    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7795        self.inner.channel().on_closed()
7796    }
7797
7798    #[cfg(target_os = "fuchsia")]
7799    fn signal_peer(
7800        &self,
7801        clear_mask: zx::Signals,
7802        set_mask: zx::Signals,
7803    ) -> Result<(), zx_status::Status> {
7804        use fidl::Peered;
7805        self.inner.channel().signal_peer(clear_mask, set_mask)
7806    }
7807}
7808
7809impl RegistryControlHandle {}
7810
7811#[must_use = "FIDL methods require a response to be sent"]
7812#[derive(Debug)]
7813pub struct RegistryConnectResponder {
7814    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
7815    tx_id: u32,
7816}
7817
7818/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
7819/// if the responder is dropped without sending a response, so that the client
7820/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7821impl std::ops::Drop for RegistryConnectResponder {
7822    fn drop(&mut self) {
7823        self.control_handle.shutdown();
7824        // Safety: drops once, never accessed again
7825        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7826    }
7827}
7828
7829impl fidl::endpoints::Responder for RegistryConnectResponder {
7830    type ControlHandle = RegistryControlHandle;
7831
7832    fn control_handle(&self) -> &RegistryControlHandle {
7833        &self.control_handle
7834    }
7835
7836    fn drop_without_shutdown(mut self) {
7837        // Safety: drops once, never accessed again due to mem::forget
7838        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7839        // Prevent Drop from running (which would shut down the channel)
7840        std::mem::forget(self);
7841    }
7842}
7843
7844impl RegistryConnectResponder {
7845    /// Sends a response to the FIDL transaction.
7846    ///
7847    /// Sets the channel to shutdown if an error occurs.
7848    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7849        let _result = self.send_raw(result);
7850        if _result.is_err() {
7851            self.control_handle.shutdown();
7852        }
7853        self.drop_without_shutdown();
7854        _result
7855    }
7856
7857    /// Similar to "send" but does not shutdown the channel if an error occurs.
7858    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7859        let _result = self.send_raw(result);
7860        self.drop_without_shutdown();
7861        _result
7862    }
7863
7864    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7865        self.control_handle
7866            .inner
7867            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7868                result,
7869                self.tx_id,
7870                0x5128cb31967a446f,
7871                fidl::encoding::DynamicFlags::empty(),
7872            )
7873    }
7874}
7875
7876#[must_use = "FIDL methods require a response to be sent"]
7877#[derive(Debug)]
7878pub struct RegistryDisconnectResponder {
7879    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
7880    tx_id: u32,
7881}
7882
7883/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
7884/// if the responder is dropped without sending a response, so that the client
7885/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7886impl std::ops::Drop for RegistryDisconnectResponder {
7887    fn drop(&mut self) {
7888        self.control_handle.shutdown();
7889        // Safety: drops once, never accessed again
7890        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7891    }
7892}
7893
7894impl fidl::endpoints::Responder for RegistryDisconnectResponder {
7895    type ControlHandle = RegistryControlHandle;
7896
7897    fn control_handle(&self) -> &RegistryControlHandle {
7898        &self.control_handle
7899    }
7900
7901    fn drop_without_shutdown(mut self) {
7902        // Safety: drops once, never accessed again due to mem::forget
7903        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7904        // Prevent Drop from running (which would shut down the channel)
7905        std::mem::forget(self);
7906    }
7907}
7908
7909impl RegistryDisconnectResponder {
7910    /// Sends a response to the FIDL transaction.
7911    ///
7912    /// Sets the channel to shutdown if an error occurs.
7913    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7914        let _result = self.send_raw(result);
7915        if _result.is_err() {
7916            self.control_handle.shutdown();
7917        }
7918        self.drop_without_shutdown();
7919        _result
7920    }
7921
7922    /// Similar to "send" but does not shutdown the channel if an error occurs.
7923    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7924        let _result = self.send_raw(result);
7925        self.drop_without_shutdown();
7926        _result
7927    }
7928
7929    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7930        self.control_handle
7931            .inner
7932            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
7933                result,
7934                self.tx_id,
7935                0x7bb4b7591146d4cb,
7936                fidl::encoding::DynamicFlags::empty(),
7937            )
7938    }
7939}
7940
7941#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7942pub struct TargetAdapterMarker;
7943
7944impl fidl::endpoints::ProtocolMarker for TargetAdapterMarker {
7945    type Proxy = TargetAdapterProxy;
7946    type RequestStream = TargetAdapterRequestStream;
7947    #[cfg(target_os = "fuchsia")]
7948    type SynchronousProxy = TargetAdapterSynchronousProxy;
7949
7950    const DEBUG_NAME: &'static str = "fuchsia.fuzzer.TargetAdapter";
7951}
7952impl fidl::endpoints::DiscoverableProtocolMarker for TargetAdapterMarker {}
7953
7954pub trait TargetAdapterProxyInterface: Send + Sync {
7955    type GetParametersResponseFut: std::future::Future<Output = Result<Vec<String>, fidl::Error>>
7956        + Send;
7957    fn r#get_parameters(&self) -> Self::GetParametersResponseFut;
7958    type ConnectResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
7959    fn r#connect(
7960        &self,
7961        eventpair: fidl::EventPair,
7962        test_input: fidl::Vmo,
7963    ) -> Self::ConnectResponseFut;
7964}
7965#[derive(Debug)]
7966#[cfg(target_os = "fuchsia")]
7967pub struct TargetAdapterSynchronousProxy {
7968    client: fidl::client::sync::Client,
7969}
7970
7971#[cfg(target_os = "fuchsia")]
7972impl fidl::endpoints::SynchronousProxy for TargetAdapterSynchronousProxy {
7973    type Proxy = TargetAdapterProxy;
7974    type Protocol = TargetAdapterMarker;
7975
7976    fn from_channel(inner: fidl::Channel) -> Self {
7977        Self::new(inner)
7978    }
7979
7980    fn into_channel(self) -> fidl::Channel {
7981        self.client.into_channel()
7982    }
7983
7984    fn as_channel(&self) -> &fidl::Channel {
7985        self.client.as_channel()
7986    }
7987}
7988
7989#[cfg(target_os = "fuchsia")]
7990impl TargetAdapterSynchronousProxy {
7991    pub fn new(channel: fidl::Channel) -> Self {
7992        Self { client: fidl::client::sync::Client::new(channel) }
7993    }
7994
7995    pub fn into_channel(self) -> fidl::Channel {
7996        self.client.into_channel()
7997    }
7998
7999    /// Waits until an event arrives and returns it. It is safe for other
8000    /// threads to make concurrent requests while waiting for an event.
8001    pub fn wait_for_event(
8002        &self,
8003        deadline: zx::MonotonicInstant,
8004    ) -> Result<TargetAdapterEvent, fidl::Error> {
8005        TargetAdapterEvent::decode(self.client.wait_for_event::<TargetAdapterMarker>(deadline)?)
8006    }
8007
8008    /// Retrieves the target-specific fuzzer parameters, e.g. the package-
8009    /// relative location of seed corpora. These parameters are specific to
8010    /// individual fuzzers, and are used by both the fuzzing engine and the
8011    /// "test-engine" used to create fuzzer unit tests. For these reasons, it is
8012    /// most convenient for fuzzer authors to specify them as part of the
8013    /// (fuzzer-specific) target adapter's component manifest file, and have the
8014    /// engine and test-engine retrieve them via this method.
8015    ///
8016    /// - response `parameters` the command line parameters from a specific
8017    ///   fuzzer's component manifest.
8018    pub fn r#get_parameters(
8019        &self,
8020        ___deadline: zx::MonotonicInstant,
8021    ) -> Result<Vec<String>, fidl::Error> {
8022        let _response = self.client.send_query::<
8023            fidl::encoding::EmptyPayload,
8024            TargetAdapterGetParametersResponse,
8025            TargetAdapterMarker,
8026        >(
8027            (),
8028            0x5c7e40a47f753e3e,
8029            fidl::encoding::DynamicFlags::empty(),
8030            ___deadline,
8031        )?;
8032        Ok(_response.parameters)
8033    }
8034
8035    /// Provides the eventpair used by driver and adapter to signal each other,
8036    /// and the shared VMO used to provide test inputs to the adapter. The VMO
8037    /// must have the `ZX_PROP_VMO_CONTENT_SIZE` property set.
8038    ///
8039    /// + request `eventpair` the eventpair used to signal when fuzzing runs
8040    ///   start and stop.
8041    /// + request `test_input` the shared VMO used by the engine to provide byte
8042    ///   sequences to test.
8043    pub fn r#connect(
8044        &self,
8045        mut eventpair: fidl::EventPair,
8046        mut test_input: fidl::Vmo,
8047        ___deadline: zx::MonotonicInstant,
8048    ) -> Result<(), fidl::Error> {
8049        let _response = self.client.send_query::<
8050            TargetAdapterConnectRequest,
8051            fidl::encoding::EmptyPayload,
8052            TargetAdapterMarker,
8053        >(
8054            (eventpair, test_input,),
8055            0x7ea603a119866618,
8056            fidl::encoding::DynamicFlags::empty(),
8057            ___deadline,
8058        )?;
8059        Ok(_response)
8060    }
8061}
8062
8063#[cfg(target_os = "fuchsia")]
8064impl From<TargetAdapterSynchronousProxy> for zx::NullableHandle {
8065    fn from(value: TargetAdapterSynchronousProxy) -> Self {
8066        value.into_channel().into()
8067    }
8068}
8069
8070#[cfg(target_os = "fuchsia")]
8071impl From<fidl::Channel> for TargetAdapterSynchronousProxy {
8072    fn from(value: fidl::Channel) -> Self {
8073        Self::new(value)
8074    }
8075}
8076
8077#[cfg(target_os = "fuchsia")]
8078impl fidl::endpoints::FromClient for TargetAdapterSynchronousProxy {
8079    type Protocol = TargetAdapterMarker;
8080
8081    fn from_client(value: fidl::endpoints::ClientEnd<TargetAdapterMarker>) -> Self {
8082        Self::new(value.into_channel())
8083    }
8084}
8085
8086#[derive(Debug, Clone)]
8087pub struct TargetAdapterProxy {
8088    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8089}
8090
8091impl fidl::endpoints::Proxy for TargetAdapterProxy {
8092    type Protocol = TargetAdapterMarker;
8093
8094    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8095        Self::new(inner)
8096    }
8097
8098    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8099        self.client.into_channel().map_err(|client| Self { client })
8100    }
8101
8102    fn as_channel(&self) -> &::fidl::AsyncChannel {
8103        self.client.as_channel()
8104    }
8105}
8106
8107impl TargetAdapterProxy {
8108    /// Create a new Proxy for fuchsia.fuzzer/TargetAdapter.
8109    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8110        let protocol_name = <TargetAdapterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8111        Self { client: fidl::client::Client::new(channel, protocol_name) }
8112    }
8113
8114    /// Get a Stream of events from the remote end of the protocol.
8115    ///
8116    /// # Panics
8117    ///
8118    /// Panics if the event stream was already taken.
8119    pub fn take_event_stream(&self) -> TargetAdapterEventStream {
8120        TargetAdapterEventStream { event_receiver: self.client.take_event_receiver() }
8121    }
8122
8123    /// Retrieves the target-specific fuzzer parameters, e.g. the package-
8124    /// relative location of seed corpora. These parameters are specific to
8125    /// individual fuzzers, and are used by both the fuzzing engine and the
8126    /// "test-engine" used to create fuzzer unit tests. For these reasons, it is
8127    /// most convenient for fuzzer authors to specify them as part of the
8128    /// (fuzzer-specific) target adapter's component manifest file, and have the
8129    /// engine and test-engine retrieve them via this method.
8130    ///
8131    /// - response `parameters` the command line parameters from a specific
8132    ///   fuzzer's component manifest.
8133    pub fn r#get_parameters(
8134        &self,
8135    ) -> fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>
8136    {
8137        TargetAdapterProxyInterface::r#get_parameters(self)
8138    }
8139
8140    /// Provides the eventpair used by driver and adapter to signal each other,
8141    /// and the shared VMO used to provide test inputs to the adapter. The VMO
8142    /// must have the `ZX_PROP_VMO_CONTENT_SIZE` property set.
8143    ///
8144    /// + request `eventpair` the eventpair used to signal when fuzzing runs
8145    ///   start and stop.
8146    /// + request `test_input` the shared VMO used by the engine to provide byte
8147    ///   sequences to test.
8148    pub fn r#connect(
8149        &self,
8150        mut eventpair: fidl::EventPair,
8151        mut test_input: fidl::Vmo,
8152    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
8153        TargetAdapterProxyInterface::r#connect(self, eventpair, test_input)
8154    }
8155}
8156
8157impl TargetAdapterProxyInterface for TargetAdapterProxy {
8158    type GetParametersResponseFut =
8159        fidl::client::QueryResponseFut<Vec<String>, fidl::encoding::DefaultFuchsiaResourceDialect>;
8160    fn r#get_parameters(&self) -> Self::GetParametersResponseFut {
8161        fn _decode(
8162            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8163        ) -> Result<Vec<String>, fidl::Error> {
8164            let _response = fidl::client::decode_transaction_body::<
8165                TargetAdapterGetParametersResponse,
8166                fidl::encoding::DefaultFuchsiaResourceDialect,
8167                0x5c7e40a47f753e3e,
8168            >(_buf?)?;
8169            Ok(_response.parameters)
8170        }
8171        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<String>>(
8172            (),
8173            0x5c7e40a47f753e3e,
8174            fidl::encoding::DynamicFlags::empty(),
8175            _decode,
8176        )
8177    }
8178
8179    type ConnectResponseFut =
8180        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
8181    fn r#connect(
8182        &self,
8183        mut eventpair: fidl::EventPair,
8184        mut test_input: fidl::Vmo,
8185    ) -> Self::ConnectResponseFut {
8186        fn _decode(
8187            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8188        ) -> Result<(), fidl::Error> {
8189            let _response = fidl::client::decode_transaction_body::<
8190                fidl::encoding::EmptyPayload,
8191                fidl::encoding::DefaultFuchsiaResourceDialect,
8192                0x7ea603a119866618,
8193            >(_buf?)?;
8194            Ok(_response)
8195        }
8196        self.client.send_query_and_decode::<TargetAdapterConnectRequest, ()>(
8197            (eventpair, test_input),
8198            0x7ea603a119866618,
8199            fidl::encoding::DynamicFlags::empty(),
8200            _decode,
8201        )
8202    }
8203}
8204
8205pub struct TargetAdapterEventStream {
8206    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8207}
8208
8209impl std::marker::Unpin for TargetAdapterEventStream {}
8210
8211impl futures::stream::FusedStream for TargetAdapterEventStream {
8212    fn is_terminated(&self) -> bool {
8213        self.event_receiver.is_terminated()
8214    }
8215}
8216
8217impl futures::Stream for TargetAdapterEventStream {
8218    type Item = Result<TargetAdapterEvent, fidl::Error>;
8219
8220    fn poll_next(
8221        mut self: std::pin::Pin<&mut Self>,
8222        cx: &mut std::task::Context<'_>,
8223    ) -> std::task::Poll<Option<Self::Item>> {
8224        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8225            &mut self.event_receiver,
8226            cx
8227        )?) {
8228            Some(buf) => std::task::Poll::Ready(Some(TargetAdapterEvent::decode(buf))),
8229            None => std::task::Poll::Ready(None),
8230        }
8231    }
8232}
8233
8234#[derive(Debug)]
8235pub enum TargetAdapterEvent {}
8236
8237impl TargetAdapterEvent {
8238    /// Decodes a message buffer as a [`TargetAdapterEvent`].
8239    fn decode(
8240        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8241    ) -> Result<TargetAdapterEvent, fidl::Error> {
8242        let (bytes, _handles) = buf.split_mut();
8243        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8244        debug_assert_eq!(tx_header.tx_id, 0);
8245        match tx_header.ordinal {
8246            _ => Err(fidl::Error::UnknownOrdinal {
8247                ordinal: tx_header.ordinal,
8248                protocol_name: <TargetAdapterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8249            }),
8250        }
8251    }
8252}
8253
8254/// A Stream of incoming requests for fuchsia.fuzzer/TargetAdapter.
8255pub struct TargetAdapterRequestStream {
8256    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8257    is_terminated: bool,
8258}
8259
8260impl std::marker::Unpin for TargetAdapterRequestStream {}
8261
8262impl futures::stream::FusedStream for TargetAdapterRequestStream {
8263    fn is_terminated(&self) -> bool {
8264        self.is_terminated
8265    }
8266}
8267
8268impl fidl::endpoints::RequestStream for TargetAdapterRequestStream {
8269    type Protocol = TargetAdapterMarker;
8270    type ControlHandle = TargetAdapterControlHandle;
8271
8272    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8273        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8274    }
8275
8276    fn control_handle(&self) -> Self::ControlHandle {
8277        TargetAdapterControlHandle { inner: self.inner.clone() }
8278    }
8279
8280    fn into_inner(
8281        self,
8282    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8283    {
8284        (self.inner, self.is_terminated)
8285    }
8286
8287    fn from_inner(
8288        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8289        is_terminated: bool,
8290    ) -> Self {
8291        Self { inner, is_terminated }
8292    }
8293}
8294
8295impl futures::Stream for TargetAdapterRequestStream {
8296    type Item = Result<TargetAdapterRequest, fidl::Error>;
8297
8298    fn poll_next(
8299        mut self: std::pin::Pin<&mut Self>,
8300        cx: &mut std::task::Context<'_>,
8301    ) -> std::task::Poll<Option<Self::Item>> {
8302        let this = &mut *self;
8303        if this.inner.check_shutdown(cx) {
8304            this.is_terminated = true;
8305            return std::task::Poll::Ready(None);
8306        }
8307        if this.is_terminated {
8308            panic!("polled TargetAdapterRequestStream after completion");
8309        }
8310        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8311            |bytes, handles| {
8312                match this.inner.channel().read_etc(cx, bytes, handles) {
8313                    std::task::Poll::Ready(Ok(())) => {}
8314                    std::task::Poll::Pending => return std::task::Poll::Pending,
8315                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8316                        this.is_terminated = true;
8317                        return std::task::Poll::Ready(None);
8318                    }
8319                    std::task::Poll::Ready(Err(e)) => {
8320                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8321                            e.into(),
8322                        ))));
8323                    }
8324                }
8325
8326                // A message has been received from the channel
8327                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8328
8329                std::task::Poll::Ready(Some(match header.ordinal {
8330                    0x5c7e40a47f753e3e => {
8331                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8332                        let mut req = fidl::new_empty!(
8333                            fidl::encoding::EmptyPayload,
8334                            fidl::encoding::DefaultFuchsiaResourceDialect
8335                        );
8336                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8337                        let control_handle =
8338                            TargetAdapterControlHandle { inner: this.inner.clone() };
8339                        Ok(TargetAdapterRequest::GetParameters {
8340                            responder: TargetAdapterGetParametersResponder {
8341                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8342                                tx_id: header.tx_id,
8343                            },
8344                        })
8345                    }
8346                    0x7ea603a119866618 => {
8347                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8348                        let mut req = fidl::new_empty!(
8349                            TargetAdapterConnectRequest,
8350                            fidl::encoding::DefaultFuchsiaResourceDialect
8351                        );
8352                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TargetAdapterConnectRequest>(&header, _body_bytes, handles, &mut req)?;
8353                        let control_handle =
8354                            TargetAdapterControlHandle { inner: this.inner.clone() };
8355                        Ok(TargetAdapterRequest::Connect {
8356                            eventpair: req.eventpair,
8357                            test_input: req.test_input,
8358
8359                            responder: TargetAdapterConnectResponder {
8360                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8361                                tx_id: header.tx_id,
8362                            },
8363                        })
8364                    }
8365                    _ => Err(fidl::Error::UnknownOrdinal {
8366                        ordinal: header.ordinal,
8367                        protocol_name:
8368                            <TargetAdapterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8369                    }),
8370                }))
8371            },
8372        )
8373    }
8374}
8375
8376/// Maps test inputs to specific behaviors in the target code, e.g. by invoking
8377/// APIs, making FIDL calls. etc. The adapter includes the target-specific code
8378/// often referred to as the "fuzz target function".
8379///
8380/// See also:
8381///
8382/// * https://llvm.org/docs/LibFuzzer.html#fuzz-target
8383#[derive(Debug)]
8384pub enum TargetAdapterRequest {
8385    /// Retrieves the target-specific fuzzer parameters, e.g. the package-
8386    /// relative location of seed corpora. These parameters are specific to
8387    /// individual fuzzers, and are used by both the fuzzing engine and the
8388    /// "test-engine" used to create fuzzer unit tests. For these reasons, it is
8389    /// most convenient for fuzzer authors to specify them as part of the
8390    /// (fuzzer-specific) target adapter's component manifest file, and have the
8391    /// engine and test-engine retrieve them via this method.
8392    ///
8393    /// - response `parameters` the command line parameters from a specific
8394    ///   fuzzer's component manifest.
8395    GetParameters { responder: TargetAdapterGetParametersResponder },
8396    /// Provides the eventpair used by driver and adapter to signal each other,
8397    /// and the shared VMO used to provide test inputs to the adapter. The VMO
8398    /// must have the `ZX_PROP_VMO_CONTENT_SIZE` property set.
8399    ///
8400    /// + request `eventpair` the eventpair used to signal when fuzzing runs
8401    ///   start and stop.
8402    /// + request `test_input` the shared VMO used by the engine to provide byte
8403    ///   sequences to test.
8404    Connect {
8405        eventpair: fidl::EventPair,
8406        test_input: fidl::Vmo,
8407        responder: TargetAdapterConnectResponder,
8408    },
8409}
8410
8411impl TargetAdapterRequest {
8412    #[allow(irrefutable_let_patterns)]
8413    pub fn into_get_parameters(self) -> Option<(TargetAdapterGetParametersResponder)> {
8414        if let TargetAdapterRequest::GetParameters { responder } = self {
8415            Some((responder))
8416        } else {
8417            None
8418        }
8419    }
8420
8421    #[allow(irrefutable_let_patterns)]
8422    pub fn into_connect(
8423        self,
8424    ) -> Option<(fidl::EventPair, fidl::Vmo, TargetAdapterConnectResponder)> {
8425        if let TargetAdapterRequest::Connect { eventpair, test_input, responder } = self {
8426            Some((eventpair, test_input, responder))
8427        } else {
8428            None
8429        }
8430    }
8431
8432    /// Name of the method defined in FIDL
8433    pub fn method_name(&self) -> &'static str {
8434        match *self {
8435            TargetAdapterRequest::GetParameters { .. } => "get_parameters",
8436            TargetAdapterRequest::Connect { .. } => "connect",
8437        }
8438    }
8439}
8440
8441#[derive(Debug, Clone)]
8442pub struct TargetAdapterControlHandle {
8443    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8444}
8445
8446impl fidl::endpoints::ControlHandle for TargetAdapterControlHandle {
8447    fn shutdown(&self) {
8448        self.inner.shutdown()
8449    }
8450
8451    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8452        self.inner.shutdown_with_epitaph(status)
8453    }
8454
8455    fn is_closed(&self) -> bool {
8456        self.inner.channel().is_closed()
8457    }
8458    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8459        self.inner.channel().on_closed()
8460    }
8461
8462    #[cfg(target_os = "fuchsia")]
8463    fn signal_peer(
8464        &self,
8465        clear_mask: zx::Signals,
8466        set_mask: zx::Signals,
8467    ) -> Result<(), zx_status::Status> {
8468        use fidl::Peered;
8469        self.inner.channel().signal_peer(clear_mask, set_mask)
8470    }
8471}
8472
8473impl TargetAdapterControlHandle {}
8474
8475#[must_use = "FIDL methods require a response to be sent"]
8476#[derive(Debug)]
8477pub struct TargetAdapterGetParametersResponder {
8478    control_handle: std::mem::ManuallyDrop<TargetAdapterControlHandle>,
8479    tx_id: u32,
8480}
8481
8482/// Set the the channel to be shutdown (see [`TargetAdapterControlHandle::shutdown`])
8483/// if the responder is dropped without sending a response, so that the client
8484/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8485impl std::ops::Drop for TargetAdapterGetParametersResponder {
8486    fn drop(&mut self) {
8487        self.control_handle.shutdown();
8488        // Safety: drops once, never accessed again
8489        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8490    }
8491}
8492
8493impl fidl::endpoints::Responder for TargetAdapterGetParametersResponder {
8494    type ControlHandle = TargetAdapterControlHandle;
8495
8496    fn control_handle(&self) -> &TargetAdapterControlHandle {
8497        &self.control_handle
8498    }
8499
8500    fn drop_without_shutdown(mut self) {
8501        // Safety: drops once, never accessed again due to mem::forget
8502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8503        // Prevent Drop from running (which would shut down the channel)
8504        std::mem::forget(self);
8505    }
8506}
8507
8508impl TargetAdapterGetParametersResponder {
8509    /// Sends a response to the FIDL transaction.
8510    ///
8511    /// Sets the channel to shutdown if an error occurs.
8512    pub fn send(self, mut parameters: &[String]) -> Result<(), fidl::Error> {
8513        let _result = self.send_raw(parameters);
8514        if _result.is_err() {
8515            self.control_handle.shutdown();
8516        }
8517        self.drop_without_shutdown();
8518        _result
8519    }
8520
8521    /// Similar to "send" but does not shutdown the channel if an error occurs.
8522    pub fn send_no_shutdown_on_err(self, mut parameters: &[String]) -> Result<(), fidl::Error> {
8523        let _result = self.send_raw(parameters);
8524        self.drop_without_shutdown();
8525        _result
8526    }
8527
8528    fn send_raw(&self, mut parameters: &[String]) -> Result<(), fidl::Error> {
8529        self.control_handle.inner.send::<TargetAdapterGetParametersResponse>(
8530            (parameters,),
8531            self.tx_id,
8532            0x5c7e40a47f753e3e,
8533            fidl::encoding::DynamicFlags::empty(),
8534        )
8535    }
8536}
8537
8538#[must_use = "FIDL methods require a response to be sent"]
8539#[derive(Debug)]
8540pub struct TargetAdapterConnectResponder {
8541    control_handle: std::mem::ManuallyDrop<TargetAdapterControlHandle>,
8542    tx_id: u32,
8543}
8544
8545/// Set the the channel to be shutdown (see [`TargetAdapterControlHandle::shutdown`])
8546/// if the responder is dropped without sending a response, so that the client
8547/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8548impl std::ops::Drop for TargetAdapterConnectResponder {
8549    fn drop(&mut self) {
8550        self.control_handle.shutdown();
8551        // Safety: drops once, never accessed again
8552        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8553    }
8554}
8555
8556impl fidl::endpoints::Responder for TargetAdapterConnectResponder {
8557    type ControlHandle = TargetAdapterControlHandle;
8558
8559    fn control_handle(&self) -> &TargetAdapterControlHandle {
8560        &self.control_handle
8561    }
8562
8563    fn drop_without_shutdown(mut self) {
8564        // Safety: drops once, never accessed again due to mem::forget
8565        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8566        // Prevent Drop from running (which would shut down the channel)
8567        std::mem::forget(self);
8568    }
8569}
8570
8571impl TargetAdapterConnectResponder {
8572    /// Sends a response to the FIDL transaction.
8573    ///
8574    /// Sets the channel to shutdown if an error occurs.
8575    pub fn send(self) -> Result<(), fidl::Error> {
8576        let _result = self.send_raw();
8577        if _result.is_err() {
8578            self.control_handle.shutdown();
8579        }
8580        self.drop_without_shutdown();
8581        _result
8582    }
8583
8584    /// Similar to "send" but does not shutdown the channel if an error occurs.
8585    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8586        let _result = self.send_raw();
8587        self.drop_without_shutdown();
8588        _result
8589    }
8590
8591    fn send_raw(&self) -> Result<(), fidl::Error> {
8592        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
8593            (),
8594            self.tx_id,
8595            0x7ea603a119866618,
8596            fidl::encoding::DynamicFlags::empty(),
8597        )
8598    }
8599}
8600
8601mod internal {
8602    use super::*;
8603
8604    impl fidl::encoding::ResourceTypeMarker for ControllerAddMonitorRequest {
8605        type Borrowed<'a> = &'a mut Self;
8606        fn take_or_borrow<'a>(
8607            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8608        ) -> Self::Borrowed<'a> {
8609            value
8610        }
8611    }
8612
8613    unsafe impl fidl::encoding::TypeMarker for ControllerAddMonitorRequest {
8614        type Owned = Self;
8615
8616        #[inline(always)]
8617        fn inline_align(_context: fidl::encoding::Context) -> usize {
8618            4
8619        }
8620
8621        #[inline(always)]
8622        fn inline_size(_context: fidl::encoding::Context) -> usize {
8623            4
8624        }
8625    }
8626
8627    unsafe impl
8628        fidl::encoding::Encode<
8629            ControllerAddMonitorRequest,
8630            fidl::encoding::DefaultFuchsiaResourceDialect,
8631        > for &mut ControllerAddMonitorRequest
8632    {
8633        #[inline]
8634        unsafe fn encode(
8635            self,
8636            encoder: &mut fidl::encoding::Encoder<
8637                '_,
8638                fidl::encoding::DefaultFuchsiaResourceDialect,
8639            >,
8640            offset: usize,
8641            _depth: fidl::encoding::Depth,
8642        ) -> fidl::Result<()> {
8643            encoder.debug_check_bounds::<ControllerAddMonitorRequest>(offset);
8644            // Delegate to tuple encoding.
8645            fidl::encoding::Encode::<ControllerAddMonitorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8646                (
8647                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.monitor),
8648                ),
8649                encoder, offset, _depth
8650            )
8651        }
8652    }
8653    unsafe impl<
8654        T0: fidl::encoding::Encode<
8655                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
8656                fidl::encoding::DefaultFuchsiaResourceDialect,
8657            >,
8658    >
8659        fidl::encoding::Encode<
8660            ControllerAddMonitorRequest,
8661            fidl::encoding::DefaultFuchsiaResourceDialect,
8662        > for (T0,)
8663    {
8664        #[inline]
8665        unsafe fn encode(
8666            self,
8667            encoder: &mut fidl::encoding::Encoder<
8668                '_,
8669                fidl::encoding::DefaultFuchsiaResourceDialect,
8670            >,
8671            offset: usize,
8672            depth: fidl::encoding::Depth,
8673        ) -> fidl::Result<()> {
8674            encoder.debug_check_bounds::<ControllerAddMonitorRequest>(offset);
8675            // Zero out padding regions. There's no need to apply masks
8676            // because the unmasked parts will be overwritten by fields.
8677            // Write the fields.
8678            self.0.encode(encoder, offset + 0, depth)?;
8679            Ok(())
8680        }
8681    }
8682
8683    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8684        for ControllerAddMonitorRequest
8685    {
8686        #[inline(always)]
8687        fn new_empty() -> Self {
8688            Self {
8689                monitor: fidl::new_empty!(
8690                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
8691                    fidl::encoding::DefaultFuchsiaResourceDialect
8692                ),
8693            }
8694        }
8695
8696        #[inline]
8697        unsafe fn decode(
8698            &mut self,
8699            decoder: &mut fidl::encoding::Decoder<
8700                '_,
8701                fidl::encoding::DefaultFuchsiaResourceDialect,
8702            >,
8703            offset: usize,
8704            _depth: fidl::encoding::Depth,
8705        ) -> fidl::Result<()> {
8706            decoder.debug_check_bounds::<Self>(offset);
8707            // Verify that padding bytes are zero.
8708            fidl::decode!(
8709                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<MonitorMarker>>,
8710                fidl::encoding::DefaultFuchsiaResourceDialect,
8711                &mut self.monitor,
8712                decoder,
8713                offset + 0,
8714                _depth
8715            )?;
8716            Ok(())
8717        }
8718    }
8719
8720    impl fidl::encoding::ResourceTypeMarker for ControllerAddToCorpusRequest {
8721        type Borrowed<'a> = &'a mut Self;
8722        fn take_or_borrow<'a>(
8723            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8724        ) -> Self::Borrowed<'a> {
8725            value
8726        }
8727    }
8728
8729    unsafe impl fidl::encoding::TypeMarker for ControllerAddToCorpusRequest {
8730        type Owned = Self;
8731
8732        #[inline(always)]
8733        fn inline_align(_context: fidl::encoding::Context) -> usize {
8734            8
8735        }
8736
8737        #[inline(always)]
8738        fn inline_size(_context: fidl::encoding::Context) -> usize {
8739            24
8740        }
8741    }
8742
8743    unsafe impl
8744        fidl::encoding::Encode<
8745            ControllerAddToCorpusRequest,
8746            fidl::encoding::DefaultFuchsiaResourceDialect,
8747        > for &mut ControllerAddToCorpusRequest
8748    {
8749        #[inline]
8750        unsafe fn encode(
8751            self,
8752            encoder: &mut fidl::encoding::Encoder<
8753                '_,
8754                fidl::encoding::DefaultFuchsiaResourceDialect,
8755            >,
8756            offset: usize,
8757            _depth: fidl::encoding::Depth,
8758        ) -> fidl::Result<()> {
8759            encoder.debug_check_bounds::<ControllerAddToCorpusRequest>(offset);
8760            // Delegate to tuple encoding.
8761            fidl::encoding::Encode::<
8762                ControllerAddToCorpusRequest,
8763                fidl::encoding::DefaultFuchsiaResourceDialect,
8764            >::encode(
8765                (
8766                    <Corpus as fidl::encoding::ValueTypeMarker>::borrow(&self.corpus),
8767                    <Input as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.input),
8768                ),
8769                encoder,
8770                offset,
8771                _depth,
8772            )
8773        }
8774    }
8775    unsafe impl<
8776        T0: fidl::encoding::Encode<Corpus, fidl::encoding::DefaultFuchsiaResourceDialect>,
8777        T1: fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect>,
8778    >
8779        fidl::encoding::Encode<
8780            ControllerAddToCorpusRequest,
8781            fidl::encoding::DefaultFuchsiaResourceDialect,
8782        > for (T0, T1)
8783    {
8784        #[inline]
8785        unsafe fn encode(
8786            self,
8787            encoder: &mut fidl::encoding::Encoder<
8788                '_,
8789                fidl::encoding::DefaultFuchsiaResourceDialect,
8790            >,
8791            offset: usize,
8792            depth: fidl::encoding::Depth,
8793        ) -> fidl::Result<()> {
8794            encoder.debug_check_bounds::<ControllerAddToCorpusRequest>(offset);
8795            // Zero out padding regions. There's no need to apply masks
8796            // because the unmasked parts will be overwritten by fields.
8797            unsafe {
8798                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
8799                (ptr as *mut u64).write_unaligned(0);
8800            }
8801            // Write the fields.
8802            self.0.encode(encoder, offset + 0, depth)?;
8803            self.1.encode(encoder, offset + 8, depth)?;
8804            Ok(())
8805        }
8806    }
8807
8808    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8809        for ControllerAddToCorpusRequest
8810    {
8811        #[inline(always)]
8812        fn new_empty() -> Self {
8813            Self {
8814                corpus: fidl::new_empty!(Corpus, fidl::encoding::DefaultFuchsiaResourceDialect),
8815                input: fidl::new_empty!(Input, fidl::encoding::DefaultFuchsiaResourceDialect),
8816            }
8817        }
8818
8819        #[inline]
8820        unsafe fn decode(
8821            &mut self,
8822            decoder: &mut fidl::encoding::Decoder<
8823                '_,
8824                fidl::encoding::DefaultFuchsiaResourceDialect,
8825            >,
8826            offset: usize,
8827            _depth: fidl::encoding::Depth,
8828        ) -> fidl::Result<()> {
8829            decoder.debug_check_bounds::<Self>(offset);
8830            // Verify that padding bytes are zero.
8831            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
8832            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8833            let mask = 0xffffffffffffff00u64;
8834            let maskedval = padval & mask;
8835            if maskedval != 0 {
8836                return Err(fidl::Error::NonZeroPadding {
8837                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
8838                });
8839            }
8840            fidl::decode!(
8841                Corpus,
8842                fidl::encoding::DefaultFuchsiaResourceDialect,
8843                &mut self.corpus,
8844                decoder,
8845                offset + 0,
8846                _depth
8847            )?;
8848            fidl::decode!(
8849                Input,
8850                fidl::encoding::DefaultFuchsiaResourceDialect,
8851                &mut self.input,
8852                decoder,
8853                offset + 8,
8854                _depth
8855            )?;
8856            Ok(())
8857        }
8858    }
8859
8860    impl fidl::encoding::ResourceTypeMarker for ControllerCleanseRequest {
8861        type Borrowed<'a> = &'a mut Self;
8862        fn take_or_borrow<'a>(
8863            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8864        ) -> Self::Borrowed<'a> {
8865            value
8866        }
8867    }
8868
8869    unsafe impl fidl::encoding::TypeMarker for ControllerCleanseRequest {
8870        type Owned = Self;
8871
8872        #[inline(always)]
8873        fn inline_align(_context: fidl::encoding::Context) -> usize {
8874            8
8875        }
8876
8877        #[inline(always)]
8878        fn inline_size(_context: fidl::encoding::Context) -> usize {
8879            16
8880        }
8881    }
8882
8883    unsafe impl
8884        fidl::encoding::Encode<
8885            ControllerCleanseRequest,
8886            fidl::encoding::DefaultFuchsiaResourceDialect,
8887        > for &mut ControllerCleanseRequest
8888    {
8889        #[inline]
8890        unsafe fn encode(
8891            self,
8892            encoder: &mut fidl::encoding::Encoder<
8893                '_,
8894                fidl::encoding::DefaultFuchsiaResourceDialect,
8895            >,
8896            offset: usize,
8897            _depth: fidl::encoding::Depth,
8898        ) -> fidl::Result<()> {
8899            encoder.debug_check_bounds::<ControllerCleanseRequest>(offset);
8900            // Delegate to tuple encoding.
8901            fidl::encoding::Encode::<
8902                ControllerCleanseRequest,
8903                fidl::encoding::DefaultFuchsiaResourceDialect,
8904            >::encode(
8905                (<Input as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8906                    &mut self.test_input,
8907                ),),
8908                encoder,
8909                offset,
8910                _depth,
8911            )
8912        }
8913    }
8914    unsafe impl<T0: fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect>>
8915        fidl::encoding::Encode<
8916            ControllerCleanseRequest,
8917            fidl::encoding::DefaultFuchsiaResourceDialect,
8918        > for (T0,)
8919    {
8920        #[inline]
8921        unsafe fn encode(
8922            self,
8923            encoder: &mut fidl::encoding::Encoder<
8924                '_,
8925                fidl::encoding::DefaultFuchsiaResourceDialect,
8926            >,
8927            offset: usize,
8928            depth: fidl::encoding::Depth,
8929        ) -> fidl::Result<()> {
8930            encoder.debug_check_bounds::<ControllerCleanseRequest>(offset);
8931            // Zero out padding regions. There's no need to apply masks
8932            // because the unmasked parts will be overwritten by fields.
8933            // Write the fields.
8934            self.0.encode(encoder, offset + 0, depth)?;
8935            Ok(())
8936        }
8937    }
8938
8939    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8940        for ControllerCleanseRequest
8941    {
8942        #[inline(always)]
8943        fn new_empty() -> Self {
8944            Self {
8945                test_input: fidl::new_empty!(Input, fidl::encoding::DefaultFuchsiaResourceDialect),
8946            }
8947        }
8948
8949        #[inline]
8950        unsafe fn decode(
8951            &mut self,
8952            decoder: &mut fidl::encoding::Decoder<
8953                '_,
8954                fidl::encoding::DefaultFuchsiaResourceDialect,
8955            >,
8956            offset: usize,
8957            _depth: fidl::encoding::Depth,
8958        ) -> fidl::Result<()> {
8959            decoder.debug_check_bounds::<Self>(offset);
8960            // Verify that padding bytes are zero.
8961            fidl::decode!(
8962                Input,
8963                fidl::encoding::DefaultFuchsiaResourceDialect,
8964                &mut self.test_input,
8965                decoder,
8966                offset + 0,
8967                _depth
8968            )?;
8969            Ok(())
8970        }
8971    }
8972
8973    impl fidl::encoding::ResourceTypeMarker for ControllerMinimizeRequest {
8974        type Borrowed<'a> = &'a mut Self;
8975        fn take_or_borrow<'a>(
8976            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8977        ) -> Self::Borrowed<'a> {
8978            value
8979        }
8980    }
8981
8982    unsafe impl fidl::encoding::TypeMarker for ControllerMinimizeRequest {
8983        type Owned = Self;
8984
8985        #[inline(always)]
8986        fn inline_align(_context: fidl::encoding::Context) -> usize {
8987            8
8988        }
8989
8990        #[inline(always)]
8991        fn inline_size(_context: fidl::encoding::Context) -> usize {
8992            16
8993        }
8994    }
8995
8996    unsafe impl
8997        fidl::encoding::Encode<
8998            ControllerMinimizeRequest,
8999            fidl::encoding::DefaultFuchsiaResourceDialect,
9000        > for &mut ControllerMinimizeRequest
9001    {
9002        #[inline]
9003        unsafe fn encode(
9004            self,
9005            encoder: &mut fidl::encoding::Encoder<
9006                '_,
9007                fidl::encoding::DefaultFuchsiaResourceDialect,
9008            >,
9009            offset: usize,
9010            _depth: fidl::encoding::Depth,
9011        ) -> fidl::Result<()> {
9012            encoder.debug_check_bounds::<ControllerMinimizeRequest>(offset);
9013            // Delegate to tuple encoding.
9014            fidl::encoding::Encode::<
9015                ControllerMinimizeRequest,
9016                fidl::encoding::DefaultFuchsiaResourceDialect,
9017            >::encode(
9018                (<Input as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9019                    &mut self.test_input,
9020                ),),
9021                encoder,
9022                offset,
9023                _depth,
9024            )
9025        }
9026    }
9027    unsafe impl<T0: fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect>>
9028        fidl::encoding::Encode<
9029            ControllerMinimizeRequest,
9030            fidl::encoding::DefaultFuchsiaResourceDialect,
9031        > for (T0,)
9032    {
9033        #[inline]
9034        unsafe fn encode(
9035            self,
9036            encoder: &mut fidl::encoding::Encoder<
9037                '_,
9038                fidl::encoding::DefaultFuchsiaResourceDialect,
9039            >,
9040            offset: usize,
9041            depth: fidl::encoding::Depth,
9042        ) -> fidl::Result<()> {
9043            encoder.debug_check_bounds::<ControllerMinimizeRequest>(offset);
9044            // Zero out padding regions. There's no need to apply masks
9045            // because the unmasked parts will be overwritten by fields.
9046            // Write the fields.
9047            self.0.encode(encoder, offset + 0, depth)?;
9048            Ok(())
9049        }
9050    }
9051
9052    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9053        for ControllerMinimizeRequest
9054    {
9055        #[inline(always)]
9056        fn new_empty() -> Self {
9057            Self {
9058                test_input: fidl::new_empty!(Input, fidl::encoding::DefaultFuchsiaResourceDialect),
9059            }
9060        }
9061
9062        #[inline]
9063        unsafe fn decode(
9064            &mut self,
9065            decoder: &mut fidl::encoding::Decoder<
9066                '_,
9067                fidl::encoding::DefaultFuchsiaResourceDialect,
9068            >,
9069            offset: usize,
9070            _depth: fidl::encoding::Depth,
9071        ) -> fidl::Result<()> {
9072            decoder.debug_check_bounds::<Self>(offset);
9073            // Verify that padding bytes are zero.
9074            fidl::decode!(
9075                Input,
9076                fidl::encoding::DefaultFuchsiaResourceDialect,
9077                &mut self.test_input,
9078                decoder,
9079                offset + 0,
9080                _depth
9081            )?;
9082            Ok(())
9083        }
9084    }
9085
9086    impl fidl::encoding::ResourceTypeMarker for ControllerProviderConnectRequest {
9087        type Borrowed<'a> = &'a mut Self;
9088        fn take_or_borrow<'a>(
9089            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9090        ) -> Self::Borrowed<'a> {
9091            value
9092        }
9093    }
9094
9095    unsafe impl fidl::encoding::TypeMarker for ControllerProviderConnectRequest {
9096        type Owned = Self;
9097
9098        #[inline(always)]
9099        fn inline_align(_context: fidl::encoding::Context) -> usize {
9100            4
9101        }
9102
9103        #[inline(always)]
9104        fn inline_size(_context: fidl::encoding::Context) -> usize {
9105            4
9106        }
9107    }
9108
9109    unsafe impl
9110        fidl::encoding::Encode<
9111            ControllerProviderConnectRequest,
9112            fidl::encoding::DefaultFuchsiaResourceDialect,
9113        > for &mut ControllerProviderConnectRequest
9114    {
9115        #[inline]
9116        unsafe fn encode(
9117            self,
9118            encoder: &mut fidl::encoding::Encoder<
9119                '_,
9120                fidl::encoding::DefaultFuchsiaResourceDialect,
9121            >,
9122            offset: usize,
9123            _depth: fidl::encoding::Depth,
9124        ) -> fidl::Result<()> {
9125            encoder.debug_check_bounds::<ControllerProviderConnectRequest>(offset);
9126            // Delegate to tuple encoding.
9127            fidl::encoding::Encode::<ControllerProviderConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9128                (
9129                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
9130                ),
9131                encoder, offset, _depth
9132            )
9133        }
9134    }
9135    unsafe impl<
9136        T0: fidl::encoding::Encode<
9137                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9138                fidl::encoding::DefaultFuchsiaResourceDialect,
9139            >,
9140    >
9141        fidl::encoding::Encode<
9142            ControllerProviderConnectRequest,
9143            fidl::encoding::DefaultFuchsiaResourceDialect,
9144        > for (T0,)
9145    {
9146        #[inline]
9147        unsafe fn encode(
9148            self,
9149            encoder: &mut fidl::encoding::Encoder<
9150                '_,
9151                fidl::encoding::DefaultFuchsiaResourceDialect,
9152            >,
9153            offset: usize,
9154            depth: fidl::encoding::Depth,
9155        ) -> fidl::Result<()> {
9156            encoder.debug_check_bounds::<ControllerProviderConnectRequest>(offset);
9157            // Zero out padding regions. There's no need to apply masks
9158            // because the unmasked parts will be overwritten by fields.
9159            // Write the fields.
9160            self.0.encode(encoder, offset + 0, depth)?;
9161            Ok(())
9162        }
9163    }
9164
9165    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9166        for ControllerProviderConnectRequest
9167    {
9168        #[inline(always)]
9169        fn new_empty() -> Self {
9170            Self {
9171                controller: fidl::new_empty!(
9172                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9173                    fidl::encoding::DefaultFuchsiaResourceDialect
9174                ),
9175            }
9176        }
9177
9178        #[inline]
9179        unsafe fn decode(
9180            &mut self,
9181            decoder: &mut fidl::encoding::Decoder<
9182                '_,
9183                fidl::encoding::DefaultFuchsiaResourceDialect,
9184            >,
9185            offset: usize,
9186            _depth: fidl::encoding::Depth,
9187        ) -> fidl::Result<()> {
9188            decoder.debug_check_bounds::<Self>(offset);
9189            // Verify that padding bytes are zero.
9190            fidl::decode!(
9191                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
9192                fidl::encoding::DefaultFuchsiaResourceDialect,
9193                &mut self.controller,
9194                decoder,
9195                offset + 0,
9196                _depth
9197            )?;
9198            Ok(())
9199        }
9200    }
9201
9202    impl fidl::encoding::ResourceTypeMarker for ControllerReadCorpusRequest {
9203        type Borrowed<'a> = &'a mut Self;
9204        fn take_or_borrow<'a>(
9205            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9206        ) -> Self::Borrowed<'a> {
9207            value
9208        }
9209    }
9210
9211    unsafe impl fidl::encoding::TypeMarker for ControllerReadCorpusRequest {
9212        type Owned = Self;
9213
9214        #[inline(always)]
9215        fn inline_align(_context: fidl::encoding::Context) -> usize {
9216            4
9217        }
9218
9219        #[inline(always)]
9220        fn inline_size(_context: fidl::encoding::Context) -> usize {
9221            8
9222        }
9223    }
9224
9225    unsafe impl
9226        fidl::encoding::Encode<
9227            ControllerReadCorpusRequest,
9228            fidl::encoding::DefaultFuchsiaResourceDialect,
9229        > for &mut ControllerReadCorpusRequest
9230    {
9231        #[inline]
9232        unsafe fn encode(
9233            self,
9234            encoder: &mut fidl::encoding::Encoder<
9235                '_,
9236                fidl::encoding::DefaultFuchsiaResourceDialect,
9237            >,
9238            offset: usize,
9239            _depth: fidl::encoding::Depth,
9240        ) -> fidl::Result<()> {
9241            encoder.debug_check_bounds::<ControllerReadCorpusRequest>(offset);
9242            // Delegate to tuple encoding.
9243            fidl::encoding::Encode::<ControllerReadCorpusRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9244                (
9245                    <Corpus as fidl::encoding::ValueTypeMarker>::borrow(&self.corpus),
9246                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CorpusReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.corpus_reader),
9247                ),
9248                encoder, offset, _depth
9249            )
9250        }
9251    }
9252    unsafe impl<
9253        T0: fidl::encoding::Encode<Corpus, fidl::encoding::DefaultFuchsiaResourceDialect>,
9254        T1: fidl::encoding::Encode<
9255                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CorpusReaderMarker>>,
9256                fidl::encoding::DefaultFuchsiaResourceDialect,
9257            >,
9258    >
9259        fidl::encoding::Encode<
9260            ControllerReadCorpusRequest,
9261            fidl::encoding::DefaultFuchsiaResourceDialect,
9262        > for (T0, T1)
9263    {
9264        #[inline]
9265        unsafe fn encode(
9266            self,
9267            encoder: &mut fidl::encoding::Encoder<
9268                '_,
9269                fidl::encoding::DefaultFuchsiaResourceDialect,
9270            >,
9271            offset: usize,
9272            depth: fidl::encoding::Depth,
9273        ) -> fidl::Result<()> {
9274            encoder.debug_check_bounds::<ControllerReadCorpusRequest>(offset);
9275            // Zero out padding regions. There's no need to apply masks
9276            // because the unmasked parts will be overwritten by fields.
9277            unsafe {
9278                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
9279                (ptr as *mut u32).write_unaligned(0);
9280            }
9281            // Write the fields.
9282            self.0.encode(encoder, offset + 0, depth)?;
9283            self.1.encode(encoder, offset + 4, depth)?;
9284            Ok(())
9285        }
9286    }
9287
9288    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9289        for ControllerReadCorpusRequest
9290    {
9291        #[inline(always)]
9292        fn new_empty() -> Self {
9293            Self {
9294                corpus: fidl::new_empty!(Corpus, fidl::encoding::DefaultFuchsiaResourceDialect),
9295                corpus_reader: fidl::new_empty!(
9296                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CorpusReaderMarker>>,
9297                    fidl::encoding::DefaultFuchsiaResourceDialect
9298                ),
9299            }
9300        }
9301
9302        #[inline]
9303        unsafe fn decode(
9304            &mut self,
9305            decoder: &mut fidl::encoding::Decoder<
9306                '_,
9307                fidl::encoding::DefaultFuchsiaResourceDialect,
9308            >,
9309            offset: usize,
9310            _depth: fidl::encoding::Depth,
9311        ) -> fidl::Result<()> {
9312            decoder.debug_check_bounds::<Self>(offset);
9313            // Verify that padding bytes are zero.
9314            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
9315            let padval = unsafe { (ptr as *const u32).read_unaligned() };
9316            let mask = 0xffffff00u32;
9317            let maskedval = padval & mask;
9318            if maskedval != 0 {
9319                return Err(fidl::Error::NonZeroPadding {
9320                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
9321                });
9322            }
9323            fidl::decode!(
9324                Corpus,
9325                fidl::encoding::DefaultFuchsiaResourceDialect,
9326                &mut self.corpus,
9327                decoder,
9328                offset + 0,
9329                _depth
9330            )?;
9331            fidl::decode!(
9332                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CorpusReaderMarker>>,
9333                fidl::encoding::DefaultFuchsiaResourceDialect,
9334                &mut self.corpus_reader,
9335                decoder,
9336                offset + 4,
9337                _depth
9338            )?;
9339            Ok(())
9340        }
9341    }
9342
9343    impl fidl::encoding::ResourceTypeMarker for ControllerReadDictionaryResponse {
9344        type Borrowed<'a> = &'a mut Self;
9345        fn take_or_borrow<'a>(
9346            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9347        ) -> Self::Borrowed<'a> {
9348            value
9349        }
9350    }
9351
9352    unsafe impl fidl::encoding::TypeMarker for ControllerReadDictionaryResponse {
9353        type Owned = Self;
9354
9355        #[inline(always)]
9356        fn inline_align(_context: fidl::encoding::Context) -> usize {
9357            8
9358        }
9359
9360        #[inline(always)]
9361        fn inline_size(_context: fidl::encoding::Context) -> usize {
9362            16
9363        }
9364    }
9365
9366    unsafe impl
9367        fidl::encoding::Encode<
9368            ControllerReadDictionaryResponse,
9369            fidl::encoding::DefaultFuchsiaResourceDialect,
9370        > for &mut ControllerReadDictionaryResponse
9371    {
9372        #[inline]
9373        unsafe fn encode(
9374            self,
9375            encoder: &mut fidl::encoding::Encoder<
9376                '_,
9377                fidl::encoding::DefaultFuchsiaResourceDialect,
9378            >,
9379            offset: usize,
9380            _depth: fidl::encoding::Depth,
9381        ) -> fidl::Result<()> {
9382            encoder.debug_check_bounds::<ControllerReadDictionaryResponse>(offset);
9383            // Delegate to tuple encoding.
9384            fidl::encoding::Encode::<
9385                ControllerReadDictionaryResponse,
9386                fidl::encoding::DefaultFuchsiaResourceDialect,
9387            >::encode(
9388                (<Input as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9389                    &mut self.dictionary,
9390                ),),
9391                encoder,
9392                offset,
9393                _depth,
9394            )
9395        }
9396    }
9397    unsafe impl<T0: fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect>>
9398        fidl::encoding::Encode<
9399            ControllerReadDictionaryResponse,
9400            fidl::encoding::DefaultFuchsiaResourceDialect,
9401        > for (T0,)
9402    {
9403        #[inline]
9404        unsafe fn encode(
9405            self,
9406            encoder: &mut fidl::encoding::Encoder<
9407                '_,
9408                fidl::encoding::DefaultFuchsiaResourceDialect,
9409            >,
9410            offset: usize,
9411            depth: fidl::encoding::Depth,
9412        ) -> fidl::Result<()> {
9413            encoder.debug_check_bounds::<ControllerReadDictionaryResponse>(offset);
9414            // Zero out padding regions. There's no need to apply masks
9415            // because the unmasked parts will be overwritten by fields.
9416            // Write the fields.
9417            self.0.encode(encoder, offset + 0, depth)?;
9418            Ok(())
9419        }
9420    }
9421
9422    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9423        for ControllerReadDictionaryResponse
9424    {
9425        #[inline(always)]
9426        fn new_empty() -> Self {
9427            Self {
9428                dictionary: fidl::new_empty!(Input, fidl::encoding::DefaultFuchsiaResourceDialect),
9429            }
9430        }
9431
9432        #[inline]
9433        unsafe fn decode(
9434            &mut self,
9435            decoder: &mut fidl::encoding::Decoder<
9436                '_,
9437                fidl::encoding::DefaultFuchsiaResourceDialect,
9438            >,
9439            offset: usize,
9440            _depth: fidl::encoding::Depth,
9441        ) -> fidl::Result<()> {
9442            decoder.debug_check_bounds::<Self>(offset);
9443            // Verify that padding bytes are zero.
9444            fidl::decode!(
9445                Input,
9446                fidl::encoding::DefaultFuchsiaResourceDialect,
9447                &mut self.dictionary,
9448                decoder,
9449                offset + 0,
9450                _depth
9451            )?;
9452            Ok(())
9453        }
9454    }
9455
9456    impl fidl::encoding::ResourceTypeMarker for ControllerTryOneRequest {
9457        type Borrowed<'a> = &'a mut Self;
9458        fn take_or_borrow<'a>(
9459            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9460        ) -> Self::Borrowed<'a> {
9461            value
9462        }
9463    }
9464
9465    unsafe impl fidl::encoding::TypeMarker for ControllerTryOneRequest {
9466        type Owned = Self;
9467
9468        #[inline(always)]
9469        fn inline_align(_context: fidl::encoding::Context) -> usize {
9470            8
9471        }
9472
9473        #[inline(always)]
9474        fn inline_size(_context: fidl::encoding::Context) -> usize {
9475            16
9476        }
9477    }
9478
9479    unsafe impl
9480        fidl::encoding::Encode<
9481            ControllerTryOneRequest,
9482            fidl::encoding::DefaultFuchsiaResourceDialect,
9483        > for &mut ControllerTryOneRequest
9484    {
9485        #[inline]
9486        unsafe fn encode(
9487            self,
9488            encoder: &mut fidl::encoding::Encoder<
9489                '_,
9490                fidl::encoding::DefaultFuchsiaResourceDialect,
9491            >,
9492            offset: usize,
9493            _depth: fidl::encoding::Depth,
9494        ) -> fidl::Result<()> {
9495            encoder.debug_check_bounds::<ControllerTryOneRequest>(offset);
9496            // Delegate to tuple encoding.
9497            fidl::encoding::Encode::<
9498                ControllerTryOneRequest,
9499                fidl::encoding::DefaultFuchsiaResourceDialect,
9500            >::encode(
9501                (<Input as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9502                    &mut self.test_input,
9503                ),),
9504                encoder,
9505                offset,
9506                _depth,
9507            )
9508        }
9509    }
9510    unsafe impl<T0: fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect>>
9511        fidl::encoding::Encode<
9512            ControllerTryOneRequest,
9513            fidl::encoding::DefaultFuchsiaResourceDialect,
9514        > for (T0,)
9515    {
9516        #[inline]
9517        unsafe fn encode(
9518            self,
9519            encoder: &mut fidl::encoding::Encoder<
9520                '_,
9521                fidl::encoding::DefaultFuchsiaResourceDialect,
9522            >,
9523            offset: usize,
9524            depth: fidl::encoding::Depth,
9525        ) -> fidl::Result<()> {
9526            encoder.debug_check_bounds::<ControllerTryOneRequest>(offset);
9527            // Zero out padding regions. There's no need to apply masks
9528            // because the unmasked parts will be overwritten by fields.
9529            // Write the fields.
9530            self.0.encode(encoder, offset + 0, depth)?;
9531            Ok(())
9532        }
9533    }
9534
9535    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9536        for ControllerTryOneRequest
9537    {
9538        #[inline(always)]
9539        fn new_empty() -> Self {
9540            Self {
9541                test_input: fidl::new_empty!(Input, fidl::encoding::DefaultFuchsiaResourceDialect),
9542            }
9543        }
9544
9545        #[inline]
9546        unsafe fn decode(
9547            &mut self,
9548            decoder: &mut fidl::encoding::Decoder<
9549                '_,
9550                fidl::encoding::DefaultFuchsiaResourceDialect,
9551            >,
9552            offset: usize,
9553            _depth: fidl::encoding::Depth,
9554        ) -> fidl::Result<()> {
9555            decoder.debug_check_bounds::<Self>(offset);
9556            // Verify that padding bytes are zero.
9557            fidl::decode!(
9558                Input,
9559                fidl::encoding::DefaultFuchsiaResourceDialect,
9560                &mut self.test_input,
9561                decoder,
9562                offset + 0,
9563                _depth
9564            )?;
9565            Ok(())
9566        }
9567    }
9568
9569    impl fidl::encoding::ResourceTypeMarker for ControllerWatchArtifactResponse {
9570        type Borrowed<'a> = &'a mut Self;
9571        fn take_or_borrow<'a>(
9572            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9573        ) -> Self::Borrowed<'a> {
9574            value
9575        }
9576    }
9577
9578    unsafe impl fidl::encoding::TypeMarker for ControllerWatchArtifactResponse {
9579        type Owned = Self;
9580
9581        #[inline(always)]
9582        fn inline_align(_context: fidl::encoding::Context) -> usize {
9583            8
9584        }
9585
9586        #[inline(always)]
9587        fn inline_size(_context: fidl::encoding::Context) -> usize {
9588            16
9589        }
9590    }
9591
9592    unsafe impl
9593        fidl::encoding::Encode<
9594            ControllerWatchArtifactResponse,
9595            fidl::encoding::DefaultFuchsiaResourceDialect,
9596        > for &mut ControllerWatchArtifactResponse
9597    {
9598        #[inline]
9599        unsafe fn encode(
9600            self,
9601            encoder: &mut fidl::encoding::Encoder<
9602                '_,
9603                fidl::encoding::DefaultFuchsiaResourceDialect,
9604            >,
9605            offset: usize,
9606            _depth: fidl::encoding::Depth,
9607        ) -> fidl::Result<()> {
9608            encoder.debug_check_bounds::<ControllerWatchArtifactResponse>(offset);
9609            // Delegate to tuple encoding.
9610            fidl::encoding::Encode::<
9611                ControllerWatchArtifactResponse,
9612                fidl::encoding::DefaultFuchsiaResourceDialect,
9613            >::encode(
9614                (<Artifact as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9615                    &mut self.artifact,
9616                ),),
9617                encoder,
9618                offset,
9619                _depth,
9620            )
9621        }
9622    }
9623    unsafe impl<T0: fidl::encoding::Encode<Artifact, fidl::encoding::DefaultFuchsiaResourceDialect>>
9624        fidl::encoding::Encode<
9625            ControllerWatchArtifactResponse,
9626            fidl::encoding::DefaultFuchsiaResourceDialect,
9627        > for (T0,)
9628    {
9629        #[inline]
9630        unsafe fn encode(
9631            self,
9632            encoder: &mut fidl::encoding::Encoder<
9633                '_,
9634                fidl::encoding::DefaultFuchsiaResourceDialect,
9635            >,
9636            offset: usize,
9637            depth: fidl::encoding::Depth,
9638        ) -> fidl::Result<()> {
9639            encoder.debug_check_bounds::<ControllerWatchArtifactResponse>(offset);
9640            // Zero out padding regions. There's no need to apply masks
9641            // because the unmasked parts will be overwritten by fields.
9642            // Write the fields.
9643            self.0.encode(encoder, offset + 0, depth)?;
9644            Ok(())
9645        }
9646    }
9647
9648    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9649        for ControllerWatchArtifactResponse
9650    {
9651        #[inline(always)]
9652        fn new_empty() -> Self {
9653            Self {
9654                artifact: fidl::new_empty!(Artifact, fidl::encoding::DefaultFuchsiaResourceDialect),
9655            }
9656        }
9657
9658        #[inline]
9659        unsafe fn decode(
9660            &mut self,
9661            decoder: &mut fidl::encoding::Decoder<
9662                '_,
9663                fidl::encoding::DefaultFuchsiaResourceDialect,
9664            >,
9665            offset: usize,
9666            _depth: fidl::encoding::Depth,
9667        ) -> fidl::Result<()> {
9668            decoder.debug_check_bounds::<Self>(offset);
9669            // Verify that padding bytes are zero.
9670            fidl::decode!(
9671                Artifact,
9672                fidl::encoding::DefaultFuchsiaResourceDialect,
9673                &mut self.artifact,
9674                decoder,
9675                offset + 0,
9676                _depth
9677            )?;
9678            Ok(())
9679        }
9680    }
9681
9682    impl fidl::encoding::ResourceTypeMarker for ControllerWriteDictionaryRequest {
9683        type Borrowed<'a> = &'a mut Self;
9684        fn take_or_borrow<'a>(
9685            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9686        ) -> Self::Borrowed<'a> {
9687            value
9688        }
9689    }
9690
9691    unsafe impl fidl::encoding::TypeMarker for ControllerWriteDictionaryRequest {
9692        type Owned = Self;
9693
9694        #[inline(always)]
9695        fn inline_align(_context: fidl::encoding::Context) -> usize {
9696            8
9697        }
9698
9699        #[inline(always)]
9700        fn inline_size(_context: fidl::encoding::Context) -> usize {
9701            16
9702        }
9703    }
9704
9705    unsafe impl
9706        fidl::encoding::Encode<
9707            ControllerWriteDictionaryRequest,
9708            fidl::encoding::DefaultFuchsiaResourceDialect,
9709        > for &mut ControllerWriteDictionaryRequest
9710    {
9711        #[inline]
9712        unsafe fn encode(
9713            self,
9714            encoder: &mut fidl::encoding::Encoder<
9715                '_,
9716                fidl::encoding::DefaultFuchsiaResourceDialect,
9717            >,
9718            offset: usize,
9719            _depth: fidl::encoding::Depth,
9720        ) -> fidl::Result<()> {
9721            encoder.debug_check_bounds::<ControllerWriteDictionaryRequest>(offset);
9722            // Delegate to tuple encoding.
9723            fidl::encoding::Encode::<
9724                ControllerWriteDictionaryRequest,
9725                fidl::encoding::DefaultFuchsiaResourceDialect,
9726            >::encode(
9727                (<Input as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9728                    &mut self.dictionary,
9729                ),),
9730                encoder,
9731                offset,
9732                _depth,
9733            )
9734        }
9735    }
9736    unsafe impl<T0: fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect>>
9737        fidl::encoding::Encode<
9738            ControllerWriteDictionaryRequest,
9739            fidl::encoding::DefaultFuchsiaResourceDialect,
9740        > for (T0,)
9741    {
9742        #[inline]
9743        unsafe fn encode(
9744            self,
9745            encoder: &mut fidl::encoding::Encoder<
9746                '_,
9747                fidl::encoding::DefaultFuchsiaResourceDialect,
9748            >,
9749            offset: usize,
9750            depth: fidl::encoding::Depth,
9751        ) -> fidl::Result<()> {
9752            encoder.debug_check_bounds::<ControllerWriteDictionaryRequest>(offset);
9753            // Zero out padding regions. There's no need to apply masks
9754            // because the unmasked parts will be overwritten by fields.
9755            // Write the fields.
9756            self.0.encode(encoder, offset + 0, depth)?;
9757            Ok(())
9758        }
9759    }
9760
9761    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9762        for ControllerWriteDictionaryRequest
9763    {
9764        #[inline(always)]
9765        fn new_empty() -> Self {
9766            Self {
9767                dictionary: fidl::new_empty!(Input, fidl::encoding::DefaultFuchsiaResourceDialect),
9768            }
9769        }
9770
9771        #[inline]
9772        unsafe fn decode(
9773            &mut self,
9774            decoder: &mut fidl::encoding::Decoder<
9775                '_,
9776                fidl::encoding::DefaultFuchsiaResourceDialect,
9777            >,
9778            offset: usize,
9779            _depth: fidl::encoding::Depth,
9780        ) -> fidl::Result<()> {
9781            decoder.debug_check_bounds::<Self>(offset);
9782            // Verify that padding bytes are zero.
9783            fidl::decode!(
9784                Input,
9785                fidl::encoding::DefaultFuchsiaResourceDialect,
9786                &mut self.dictionary,
9787                decoder,
9788                offset + 0,
9789                _depth
9790            )?;
9791            Ok(())
9792        }
9793    }
9794
9795    impl fidl::encoding::ResourceTypeMarker for CorpusReaderNextRequest {
9796        type Borrowed<'a> = &'a mut Self;
9797        fn take_or_borrow<'a>(
9798            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9799        ) -> Self::Borrowed<'a> {
9800            value
9801        }
9802    }
9803
9804    unsafe impl fidl::encoding::TypeMarker for CorpusReaderNextRequest {
9805        type Owned = Self;
9806
9807        #[inline(always)]
9808        fn inline_align(_context: fidl::encoding::Context) -> usize {
9809            8
9810        }
9811
9812        #[inline(always)]
9813        fn inline_size(_context: fidl::encoding::Context) -> usize {
9814            16
9815        }
9816    }
9817
9818    unsafe impl
9819        fidl::encoding::Encode<
9820            CorpusReaderNextRequest,
9821            fidl::encoding::DefaultFuchsiaResourceDialect,
9822        > for &mut CorpusReaderNextRequest
9823    {
9824        #[inline]
9825        unsafe fn encode(
9826            self,
9827            encoder: &mut fidl::encoding::Encoder<
9828                '_,
9829                fidl::encoding::DefaultFuchsiaResourceDialect,
9830            >,
9831            offset: usize,
9832            _depth: fidl::encoding::Depth,
9833        ) -> fidl::Result<()> {
9834            encoder.debug_check_bounds::<CorpusReaderNextRequest>(offset);
9835            // Delegate to tuple encoding.
9836            fidl::encoding::Encode::<
9837                CorpusReaderNextRequest,
9838                fidl::encoding::DefaultFuchsiaResourceDialect,
9839            >::encode(
9840                (<Input as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9841                    &mut self.test_input,
9842                ),),
9843                encoder,
9844                offset,
9845                _depth,
9846            )
9847        }
9848    }
9849    unsafe impl<T0: fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect>>
9850        fidl::encoding::Encode<
9851            CorpusReaderNextRequest,
9852            fidl::encoding::DefaultFuchsiaResourceDialect,
9853        > for (T0,)
9854    {
9855        #[inline]
9856        unsafe fn encode(
9857            self,
9858            encoder: &mut fidl::encoding::Encoder<
9859                '_,
9860                fidl::encoding::DefaultFuchsiaResourceDialect,
9861            >,
9862            offset: usize,
9863            depth: fidl::encoding::Depth,
9864        ) -> fidl::Result<()> {
9865            encoder.debug_check_bounds::<CorpusReaderNextRequest>(offset);
9866            // Zero out padding regions. There's no need to apply masks
9867            // because the unmasked parts will be overwritten by fields.
9868            // Write the fields.
9869            self.0.encode(encoder, offset + 0, depth)?;
9870            Ok(())
9871        }
9872    }
9873
9874    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9875        for CorpusReaderNextRequest
9876    {
9877        #[inline(always)]
9878        fn new_empty() -> Self {
9879            Self {
9880                test_input: fidl::new_empty!(Input, fidl::encoding::DefaultFuchsiaResourceDialect),
9881            }
9882        }
9883
9884        #[inline]
9885        unsafe fn decode(
9886            &mut self,
9887            decoder: &mut fidl::encoding::Decoder<
9888                '_,
9889                fidl::encoding::DefaultFuchsiaResourceDialect,
9890            >,
9891            offset: usize,
9892            _depth: fidl::encoding::Depth,
9893        ) -> fidl::Result<()> {
9894            decoder.debug_check_bounds::<Self>(offset);
9895            // Verify that padding bytes are zero.
9896            fidl::decode!(
9897                Input,
9898                fidl::encoding::DefaultFuchsiaResourceDialect,
9899                &mut self.test_input,
9900                decoder,
9901                offset + 0,
9902                _depth
9903            )?;
9904            Ok(())
9905        }
9906    }
9907
9908    impl fidl::encoding::ResourceTypeMarker for CoverageData {
9909        type Borrowed<'a> = &'a mut Self;
9910        fn take_or_borrow<'a>(
9911            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9912        ) -> Self::Borrowed<'a> {
9913            value
9914        }
9915    }
9916
9917    unsafe impl fidl::encoding::TypeMarker for CoverageData {
9918        type Owned = Self;
9919
9920        #[inline(always)]
9921        fn inline_align(_context: fidl::encoding::Context) -> usize {
9922            8
9923        }
9924
9925        #[inline(always)]
9926        fn inline_size(_context: fidl::encoding::Context) -> usize {
9927            24
9928        }
9929    }
9930
9931    unsafe impl fidl::encoding::Encode<CoverageData, fidl::encoding::DefaultFuchsiaResourceDialect>
9932        for &mut CoverageData
9933    {
9934        #[inline]
9935        unsafe fn encode(
9936            self,
9937            encoder: &mut fidl::encoding::Encoder<
9938                '_,
9939                fidl::encoding::DefaultFuchsiaResourceDialect,
9940            >,
9941            offset: usize,
9942            _depth: fidl::encoding::Depth,
9943        ) -> fidl::Result<()> {
9944            encoder.debug_check_bounds::<CoverageData>(offset);
9945            // Delegate to tuple encoding.
9946            fidl::encoding::Encode::<CoverageData, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9947                (
9948                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.target_id),
9949                    <Data as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.data),
9950                ),
9951                encoder, offset, _depth
9952            )
9953        }
9954    }
9955    unsafe impl<
9956        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
9957        T1: fidl::encoding::Encode<Data, fidl::encoding::DefaultFuchsiaResourceDialect>,
9958    > fidl::encoding::Encode<CoverageData, fidl::encoding::DefaultFuchsiaResourceDialect>
9959        for (T0, T1)
9960    {
9961        #[inline]
9962        unsafe fn encode(
9963            self,
9964            encoder: &mut fidl::encoding::Encoder<
9965                '_,
9966                fidl::encoding::DefaultFuchsiaResourceDialect,
9967            >,
9968            offset: usize,
9969            depth: fidl::encoding::Depth,
9970        ) -> fidl::Result<()> {
9971            encoder.debug_check_bounds::<CoverageData>(offset);
9972            // Zero out padding regions. There's no need to apply masks
9973            // because the unmasked parts will be overwritten by fields.
9974            // Write the fields.
9975            self.0.encode(encoder, offset + 0, depth)?;
9976            self.1.encode(encoder, offset + 8, depth)?;
9977            Ok(())
9978        }
9979    }
9980
9981    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for CoverageData {
9982        #[inline(always)]
9983        fn new_empty() -> Self {
9984            Self {
9985                target_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
9986                data: fidl::new_empty!(Data, fidl::encoding::DefaultFuchsiaResourceDialect),
9987            }
9988        }
9989
9990        #[inline]
9991        unsafe fn decode(
9992            &mut self,
9993            decoder: &mut fidl::encoding::Decoder<
9994                '_,
9995                fidl::encoding::DefaultFuchsiaResourceDialect,
9996            >,
9997            offset: usize,
9998            _depth: fidl::encoding::Depth,
9999        ) -> fidl::Result<()> {
10000            decoder.debug_check_bounds::<Self>(offset);
10001            // Verify that padding bytes are zero.
10002            fidl::decode!(
10003                u64,
10004                fidl::encoding::DefaultFuchsiaResourceDialect,
10005                &mut self.target_id,
10006                decoder,
10007                offset + 0,
10008                _depth
10009            )?;
10010            fidl::decode!(
10011                Data,
10012                fidl::encoding::DefaultFuchsiaResourceDialect,
10013                &mut self.data,
10014                decoder,
10015                offset + 8,
10016                _depth
10017            )?;
10018            Ok(())
10019        }
10020    }
10021
10022    impl fidl::encoding::ResourceTypeMarker for CoverageDataCollectorAddInline8bitCountersRequest {
10023        type Borrowed<'a> = &'a mut Self;
10024        fn take_or_borrow<'a>(
10025            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10026        ) -> Self::Borrowed<'a> {
10027            value
10028        }
10029    }
10030
10031    unsafe impl fidl::encoding::TypeMarker for CoverageDataCollectorAddInline8bitCountersRequest {
10032        type Owned = Self;
10033
10034        #[inline(always)]
10035        fn inline_align(_context: fidl::encoding::Context) -> usize {
10036            4
10037        }
10038
10039        #[inline(always)]
10040        fn inline_size(_context: fidl::encoding::Context) -> usize {
10041            4
10042        }
10043    }
10044
10045    unsafe impl
10046        fidl::encoding::Encode<
10047            CoverageDataCollectorAddInline8bitCountersRequest,
10048            fidl::encoding::DefaultFuchsiaResourceDialect,
10049        > for &mut CoverageDataCollectorAddInline8bitCountersRequest
10050    {
10051        #[inline]
10052        unsafe fn encode(
10053            self,
10054            encoder: &mut fidl::encoding::Encoder<
10055                '_,
10056                fidl::encoding::DefaultFuchsiaResourceDialect,
10057            >,
10058            offset: usize,
10059            _depth: fidl::encoding::Depth,
10060        ) -> fidl::Result<()> {
10061            encoder.debug_check_bounds::<CoverageDataCollectorAddInline8bitCountersRequest>(offset);
10062            // Delegate to tuple encoding.
10063            fidl::encoding::Encode::<
10064                CoverageDataCollectorAddInline8bitCountersRequest,
10065                fidl::encoding::DefaultFuchsiaResourceDialect,
10066            >::encode(
10067                (<fidl::encoding::HandleType<
10068                    fidl::Vmo,
10069                    { fidl::ObjectType::VMO.into_raw() },
10070                    2147483648,
10071                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10072                    &mut self.inline_8bit_counters,
10073                ),),
10074                encoder,
10075                offset,
10076                _depth,
10077            )
10078        }
10079    }
10080    unsafe impl<
10081        T0: fidl::encoding::Encode<
10082                fidl::encoding::HandleType<
10083                    fidl::Vmo,
10084                    { fidl::ObjectType::VMO.into_raw() },
10085                    2147483648,
10086                >,
10087                fidl::encoding::DefaultFuchsiaResourceDialect,
10088            >,
10089    >
10090        fidl::encoding::Encode<
10091            CoverageDataCollectorAddInline8bitCountersRequest,
10092            fidl::encoding::DefaultFuchsiaResourceDialect,
10093        > for (T0,)
10094    {
10095        #[inline]
10096        unsafe fn encode(
10097            self,
10098            encoder: &mut fidl::encoding::Encoder<
10099                '_,
10100                fidl::encoding::DefaultFuchsiaResourceDialect,
10101            >,
10102            offset: usize,
10103            depth: fidl::encoding::Depth,
10104        ) -> fidl::Result<()> {
10105            encoder.debug_check_bounds::<CoverageDataCollectorAddInline8bitCountersRequest>(offset);
10106            // Zero out padding regions. There's no need to apply masks
10107            // because the unmasked parts will be overwritten by fields.
10108            // Write the fields.
10109            self.0.encode(encoder, offset + 0, depth)?;
10110            Ok(())
10111        }
10112    }
10113
10114    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10115        for CoverageDataCollectorAddInline8bitCountersRequest
10116    {
10117        #[inline(always)]
10118        fn new_empty() -> Self {
10119            Self {
10120                inline_8bit_counters: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10121            }
10122        }
10123
10124        #[inline]
10125        unsafe fn decode(
10126            &mut self,
10127            decoder: &mut fidl::encoding::Decoder<
10128                '_,
10129                fidl::encoding::DefaultFuchsiaResourceDialect,
10130            >,
10131            offset: usize,
10132            _depth: fidl::encoding::Depth,
10133        ) -> fidl::Result<()> {
10134            decoder.debug_check_bounds::<Self>(offset);
10135            // Verify that padding bytes are zero.
10136            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.inline_8bit_counters, decoder, offset + 0, _depth)?;
10137            Ok(())
10138        }
10139    }
10140
10141    impl fidl::encoding::ResourceTypeMarker for CoverageDataCollectorInitializeRequest {
10142        type Borrowed<'a> = &'a mut Self;
10143        fn take_or_borrow<'a>(
10144            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10145        ) -> Self::Borrowed<'a> {
10146            value
10147        }
10148    }
10149
10150    unsafe impl fidl::encoding::TypeMarker for CoverageDataCollectorInitializeRequest {
10151        type Owned = Self;
10152
10153        #[inline(always)]
10154        fn inline_align(_context: fidl::encoding::Context) -> usize {
10155            4
10156        }
10157
10158        #[inline(always)]
10159        fn inline_size(_context: fidl::encoding::Context) -> usize {
10160            8
10161        }
10162    }
10163
10164    unsafe impl
10165        fidl::encoding::Encode<
10166            CoverageDataCollectorInitializeRequest,
10167            fidl::encoding::DefaultFuchsiaResourceDialect,
10168        > for &mut CoverageDataCollectorInitializeRequest
10169    {
10170        #[inline]
10171        unsafe fn encode(
10172            self,
10173            encoder: &mut fidl::encoding::Encoder<
10174                '_,
10175                fidl::encoding::DefaultFuchsiaResourceDialect,
10176            >,
10177            offset: usize,
10178            _depth: fidl::encoding::Depth,
10179        ) -> fidl::Result<()> {
10180            encoder.debug_check_bounds::<CoverageDataCollectorInitializeRequest>(offset);
10181            // Delegate to tuple encoding.
10182            fidl::encoding::Encode::<
10183                CoverageDataCollectorInitializeRequest,
10184                fidl::encoding::DefaultFuchsiaResourceDialect,
10185            >::encode(
10186                (
10187                    <fidl::encoding::HandleType<
10188                        fidl::EventPair,
10189                        { fidl::ObjectType::EVENTPAIR.into_raw() },
10190                        2147483648,
10191                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10192                        &mut self.eventpair
10193                    ),
10194                    <fidl::encoding::HandleType<
10195                        fidl::Process,
10196                        { fidl::ObjectType::PROCESS.into_raw() },
10197                        2147483648,
10198                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10199                        &mut self.process
10200                    ),
10201                ),
10202                encoder,
10203                offset,
10204                _depth,
10205            )
10206        }
10207    }
10208    unsafe impl<
10209        T0: fidl::encoding::Encode<
10210                fidl::encoding::HandleType<
10211                    fidl::EventPair,
10212                    { fidl::ObjectType::EVENTPAIR.into_raw() },
10213                    2147483648,
10214                >,
10215                fidl::encoding::DefaultFuchsiaResourceDialect,
10216            >,
10217        T1: fidl::encoding::Encode<
10218                fidl::encoding::HandleType<
10219                    fidl::Process,
10220                    { fidl::ObjectType::PROCESS.into_raw() },
10221                    2147483648,
10222                >,
10223                fidl::encoding::DefaultFuchsiaResourceDialect,
10224            >,
10225    >
10226        fidl::encoding::Encode<
10227            CoverageDataCollectorInitializeRequest,
10228            fidl::encoding::DefaultFuchsiaResourceDialect,
10229        > for (T0, T1)
10230    {
10231        #[inline]
10232        unsafe fn encode(
10233            self,
10234            encoder: &mut fidl::encoding::Encoder<
10235                '_,
10236                fidl::encoding::DefaultFuchsiaResourceDialect,
10237            >,
10238            offset: usize,
10239            depth: fidl::encoding::Depth,
10240        ) -> fidl::Result<()> {
10241            encoder.debug_check_bounds::<CoverageDataCollectorInitializeRequest>(offset);
10242            // Zero out padding regions. There's no need to apply masks
10243            // because the unmasked parts will be overwritten by fields.
10244            // Write the fields.
10245            self.0.encode(encoder, offset + 0, depth)?;
10246            self.1.encode(encoder, offset + 4, depth)?;
10247            Ok(())
10248        }
10249    }
10250
10251    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10252        for CoverageDataCollectorInitializeRequest
10253    {
10254        #[inline(always)]
10255        fn new_empty() -> Self {
10256            Self {
10257                eventpair: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10258                process: fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10259            }
10260        }
10261
10262        #[inline]
10263        unsafe fn decode(
10264            &mut self,
10265            decoder: &mut fidl::encoding::Decoder<
10266                '_,
10267                fidl::encoding::DefaultFuchsiaResourceDialect,
10268            >,
10269            offset: usize,
10270            _depth: fidl::encoding::Depth,
10271        ) -> fidl::Result<()> {
10272            decoder.debug_check_bounds::<Self>(offset);
10273            // Verify that padding bytes are zero.
10274            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.eventpair, decoder, offset + 0, _depth)?;
10275            fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.process, decoder, offset + 4, _depth)?;
10276            Ok(())
10277        }
10278    }
10279
10280    impl fidl::encoding::ResourceTypeMarker for CoverageDataProviderWatchCoverageDataResponse {
10281        type Borrowed<'a> = &'a mut Self;
10282        fn take_or_borrow<'a>(
10283            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10284        ) -> Self::Borrowed<'a> {
10285            value
10286        }
10287    }
10288
10289    unsafe impl fidl::encoding::TypeMarker for CoverageDataProviderWatchCoverageDataResponse {
10290        type Owned = Self;
10291
10292        #[inline(always)]
10293        fn inline_align(_context: fidl::encoding::Context) -> usize {
10294            8
10295        }
10296
10297        #[inline(always)]
10298        fn inline_size(_context: fidl::encoding::Context) -> usize {
10299            16
10300        }
10301    }
10302
10303    unsafe impl
10304        fidl::encoding::Encode<
10305            CoverageDataProviderWatchCoverageDataResponse,
10306            fidl::encoding::DefaultFuchsiaResourceDialect,
10307        > for &mut CoverageDataProviderWatchCoverageDataResponse
10308    {
10309        #[inline]
10310        unsafe fn encode(
10311            self,
10312            encoder: &mut fidl::encoding::Encoder<
10313                '_,
10314                fidl::encoding::DefaultFuchsiaResourceDialect,
10315            >,
10316            offset: usize,
10317            _depth: fidl::encoding::Depth,
10318        ) -> fidl::Result<()> {
10319            encoder.debug_check_bounds::<CoverageDataProviderWatchCoverageDataResponse>(offset);
10320            // Delegate to tuple encoding.
10321            fidl::encoding::Encode::<CoverageDataProviderWatchCoverageDataResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10322                (
10323                    <fidl::encoding::Vector<CoverageData, 4096> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.coverage_data),
10324                ),
10325                encoder, offset, _depth
10326            )
10327        }
10328    }
10329    unsafe impl<
10330        T0: fidl::encoding::Encode<
10331                fidl::encoding::Vector<CoverageData, 4096>,
10332                fidl::encoding::DefaultFuchsiaResourceDialect,
10333            >,
10334    >
10335        fidl::encoding::Encode<
10336            CoverageDataProviderWatchCoverageDataResponse,
10337            fidl::encoding::DefaultFuchsiaResourceDialect,
10338        > for (T0,)
10339    {
10340        #[inline]
10341        unsafe fn encode(
10342            self,
10343            encoder: &mut fidl::encoding::Encoder<
10344                '_,
10345                fidl::encoding::DefaultFuchsiaResourceDialect,
10346            >,
10347            offset: usize,
10348            depth: fidl::encoding::Depth,
10349        ) -> fidl::Result<()> {
10350            encoder.debug_check_bounds::<CoverageDataProviderWatchCoverageDataResponse>(offset);
10351            // Zero out padding regions. There's no need to apply masks
10352            // because the unmasked parts will be overwritten by fields.
10353            // Write the fields.
10354            self.0.encode(encoder, offset + 0, depth)?;
10355            Ok(())
10356        }
10357    }
10358
10359    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10360        for CoverageDataProviderWatchCoverageDataResponse
10361    {
10362        #[inline(always)]
10363        fn new_empty() -> Self {
10364            Self {
10365                coverage_data: fidl::new_empty!(fidl::encoding::Vector<CoverageData, 4096>, fidl::encoding::DefaultFuchsiaResourceDialect),
10366            }
10367        }
10368
10369        #[inline]
10370        unsafe fn decode(
10371            &mut self,
10372            decoder: &mut fidl::encoding::Decoder<
10373                '_,
10374                fidl::encoding::DefaultFuchsiaResourceDialect,
10375            >,
10376            offset: usize,
10377            _depth: fidl::encoding::Depth,
10378        ) -> fidl::Result<()> {
10379            decoder.debug_check_bounds::<Self>(offset);
10380            // Verify that padding bytes are zero.
10381            fidl::decode!(fidl::encoding::Vector<CoverageData, 4096>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.coverage_data, decoder, offset + 0, _depth)?;
10382            Ok(())
10383        }
10384    }
10385
10386    impl fidl::encoding::ResourceTypeMarker for Input {
10387        type Borrowed<'a> = &'a mut Self;
10388        fn take_or_borrow<'a>(
10389            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10390        ) -> Self::Borrowed<'a> {
10391            value
10392        }
10393    }
10394
10395    unsafe impl fidl::encoding::TypeMarker for Input {
10396        type Owned = Self;
10397
10398        #[inline(always)]
10399        fn inline_align(_context: fidl::encoding::Context) -> usize {
10400            8
10401        }
10402
10403        #[inline(always)]
10404        fn inline_size(_context: fidl::encoding::Context) -> usize {
10405            16
10406        }
10407    }
10408
10409    unsafe impl fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect>
10410        for &mut Input
10411    {
10412        #[inline]
10413        unsafe fn encode(
10414            self,
10415            encoder: &mut fidl::encoding::Encoder<
10416                '_,
10417                fidl::encoding::DefaultFuchsiaResourceDialect,
10418            >,
10419            offset: usize,
10420            _depth: fidl::encoding::Depth,
10421        ) -> fidl::Result<()> {
10422            encoder.debug_check_bounds::<Input>(offset);
10423            // Delegate to tuple encoding.
10424            fidl::encoding::Encode::<Input, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10425                (
10426                    <fidl::encoding::HandleType<
10427                        fidl::Socket,
10428                        { fidl::ObjectType::SOCKET.into_raw() },
10429                        2147483648,
10430                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10431                        &mut self.socket
10432                    ),
10433                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
10434                ),
10435                encoder,
10436                offset,
10437                _depth,
10438            )
10439        }
10440    }
10441    unsafe impl<
10442        T0: fidl::encoding::Encode<
10443                fidl::encoding::HandleType<
10444                    fidl::Socket,
10445                    { fidl::ObjectType::SOCKET.into_raw() },
10446                    2147483648,
10447                >,
10448                fidl::encoding::DefaultFuchsiaResourceDialect,
10449            >,
10450        T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
10451    > fidl::encoding::Encode<Input, fidl::encoding::DefaultFuchsiaResourceDialect> for (T0, T1)
10452    {
10453        #[inline]
10454        unsafe fn encode(
10455            self,
10456            encoder: &mut fidl::encoding::Encoder<
10457                '_,
10458                fidl::encoding::DefaultFuchsiaResourceDialect,
10459            >,
10460            offset: usize,
10461            depth: fidl::encoding::Depth,
10462        ) -> fidl::Result<()> {
10463            encoder.debug_check_bounds::<Input>(offset);
10464            // Zero out padding regions. There's no need to apply masks
10465            // because the unmasked parts will be overwritten by fields.
10466            unsafe {
10467                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10468                (ptr as *mut u64).write_unaligned(0);
10469            }
10470            // Write the fields.
10471            self.0.encode(encoder, offset + 0, depth)?;
10472            self.1.encode(encoder, offset + 8, depth)?;
10473            Ok(())
10474        }
10475    }
10476
10477    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Input {
10478        #[inline(always)]
10479        fn new_empty() -> Self {
10480            Self {
10481                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10482                size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
10483            }
10484        }
10485
10486        #[inline]
10487        unsafe fn decode(
10488            &mut self,
10489            decoder: &mut fidl::encoding::Decoder<
10490                '_,
10491                fidl::encoding::DefaultFuchsiaResourceDialect,
10492            >,
10493            offset: usize,
10494            _depth: fidl::encoding::Depth,
10495        ) -> fidl::Result<()> {
10496            decoder.debug_check_bounds::<Self>(offset);
10497            // Verify that padding bytes are zero.
10498            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10499            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10500            let mask = 0xffffffff00000000u64;
10501            let maskedval = padval & mask;
10502            if maskedval != 0 {
10503                return Err(fidl::Error::NonZeroPadding {
10504                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10505                });
10506            }
10507            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 0, _depth)?;
10508            fidl::decode!(
10509                u64,
10510                fidl::encoding::DefaultFuchsiaResourceDialect,
10511                &mut self.size,
10512                decoder,
10513                offset + 8,
10514                _depth
10515            )?;
10516            Ok(())
10517        }
10518    }
10519
10520    impl fidl::encoding::ResourceTypeMarker for InstrumentedProcess {
10521        type Borrowed<'a> = &'a mut Self;
10522        fn take_or_borrow<'a>(
10523            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10524        ) -> Self::Borrowed<'a> {
10525            value
10526        }
10527    }
10528
10529    unsafe impl fidl::encoding::TypeMarker for InstrumentedProcess {
10530        type Owned = Self;
10531
10532        #[inline(always)]
10533        fn inline_align(_context: fidl::encoding::Context) -> usize {
10534            4
10535        }
10536
10537        #[inline(always)]
10538        fn inline_size(_context: fidl::encoding::Context) -> usize {
10539            8
10540        }
10541    }
10542
10543    unsafe impl
10544        fidl::encoding::Encode<InstrumentedProcess, fidl::encoding::DefaultFuchsiaResourceDialect>
10545        for &mut InstrumentedProcess
10546    {
10547        #[inline]
10548        unsafe fn encode(
10549            self,
10550            encoder: &mut fidl::encoding::Encoder<
10551                '_,
10552                fidl::encoding::DefaultFuchsiaResourceDialect,
10553            >,
10554            offset: usize,
10555            _depth: fidl::encoding::Depth,
10556        ) -> fidl::Result<()> {
10557            encoder.debug_check_bounds::<InstrumentedProcess>(offset);
10558            // Delegate to tuple encoding.
10559            fidl::encoding::Encode::<
10560                InstrumentedProcess,
10561                fidl::encoding::DefaultFuchsiaResourceDialect,
10562            >::encode(
10563                (
10564                    <fidl::encoding::HandleType<
10565                        fidl::EventPair,
10566                        { fidl::ObjectType::EVENTPAIR.into_raw() },
10567                        2147483648,
10568                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10569                        &mut self.eventpair
10570                    ),
10571                    <fidl::encoding::HandleType<
10572                        fidl::Process,
10573                        { fidl::ObjectType::PROCESS.into_raw() },
10574                        2147483648,
10575                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10576                        &mut self.process
10577                    ),
10578                ),
10579                encoder,
10580                offset,
10581                _depth,
10582            )
10583        }
10584    }
10585    unsafe impl<
10586        T0: fidl::encoding::Encode<
10587                fidl::encoding::HandleType<
10588                    fidl::EventPair,
10589                    { fidl::ObjectType::EVENTPAIR.into_raw() },
10590                    2147483648,
10591                >,
10592                fidl::encoding::DefaultFuchsiaResourceDialect,
10593            >,
10594        T1: fidl::encoding::Encode<
10595                fidl::encoding::HandleType<
10596                    fidl::Process,
10597                    { fidl::ObjectType::PROCESS.into_raw() },
10598                    2147483648,
10599                >,
10600                fidl::encoding::DefaultFuchsiaResourceDialect,
10601            >,
10602    > fidl::encoding::Encode<InstrumentedProcess, fidl::encoding::DefaultFuchsiaResourceDialect>
10603        for (T0, T1)
10604    {
10605        #[inline]
10606        unsafe fn encode(
10607            self,
10608            encoder: &mut fidl::encoding::Encoder<
10609                '_,
10610                fidl::encoding::DefaultFuchsiaResourceDialect,
10611            >,
10612            offset: usize,
10613            depth: fidl::encoding::Depth,
10614        ) -> fidl::Result<()> {
10615            encoder.debug_check_bounds::<InstrumentedProcess>(offset);
10616            // Zero out padding regions. There's no need to apply masks
10617            // because the unmasked parts will be overwritten by fields.
10618            // Write the fields.
10619            self.0.encode(encoder, offset + 0, depth)?;
10620            self.1.encode(encoder, offset + 4, depth)?;
10621            Ok(())
10622        }
10623    }
10624
10625    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10626        for InstrumentedProcess
10627    {
10628        #[inline(always)]
10629        fn new_empty() -> Self {
10630            Self {
10631                eventpair: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10632                process: fidl::new_empty!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10633            }
10634        }
10635
10636        #[inline]
10637        unsafe fn decode(
10638            &mut self,
10639            decoder: &mut fidl::encoding::Decoder<
10640                '_,
10641                fidl::encoding::DefaultFuchsiaResourceDialect,
10642            >,
10643            offset: usize,
10644            _depth: fidl::encoding::Depth,
10645        ) -> fidl::Result<()> {
10646            decoder.debug_check_bounds::<Self>(offset);
10647            // Verify that padding bytes are zero.
10648            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.eventpair, decoder, offset + 0, _depth)?;
10649            fidl::decode!(fidl::encoding::HandleType<fidl::Process, { fidl::ObjectType::PROCESS.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.process, decoder, offset + 4, _depth)?;
10650            Ok(())
10651        }
10652    }
10653
10654    impl fidl::encoding::ResourceTypeMarker for ManagerConnectRequest {
10655        type Borrowed<'a> = &'a mut Self;
10656        fn take_or_borrow<'a>(
10657            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10658        ) -> Self::Borrowed<'a> {
10659            value
10660        }
10661    }
10662
10663    unsafe impl fidl::encoding::TypeMarker for ManagerConnectRequest {
10664        type Owned = Self;
10665
10666        #[inline(always)]
10667        fn inline_align(_context: fidl::encoding::Context) -> usize {
10668            8
10669        }
10670
10671        #[inline(always)]
10672        fn inline_size(_context: fidl::encoding::Context) -> usize {
10673            24
10674        }
10675    }
10676
10677    unsafe impl
10678        fidl::encoding::Encode<ManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10679        for &mut ManagerConnectRequest
10680    {
10681        #[inline]
10682        unsafe fn encode(
10683            self,
10684            encoder: &mut fidl::encoding::Encoder<
10685                '_,
10686                fidl::encoding::DefaultFuchsiaResourceDialect,
10687            >,
10688            offset: usize,
10689            _depth: fidl::encoding::Depth,
10690        ) -> fidl::Result<()> {
10691            encoder.debug_check_bounds::<ManagerConnectRequest>(offset);
10692            // Delegate to tuple encoding.
10693            fidl::encoding::Encode::<ManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10694                (
10695                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.fuzzer_url),
10696                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
10697                ),
10698                encoder, offset, _depth
10699            )
10700        }
10701    }
10702    unsafe impl<
10703        T0: fidl::encoding::Encode<
10704                fidl::encoding::BoundedString<4096>,
10705                fidl::encoding::DefaultFuchsiaResourceDialect,
10706            >,
10707        T1: fidl::encoding::Encode<
10708                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10709                fidl::encoding::DefaultFuchsiaResourceDialect,
10710            >,
10711    >
10712        fidl::encoding::Encode<ManagerConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
10713        for (T0, T1)
10714    {
10715        #[inline]
10716        unsafe fn encode(
10717            self,
10718            encoder: &mut fidl::encoding::Encoder<
10719                '_,
10720                fidl::encoding::DefaultFuchsiaResourceDialect,
10721            >,
10722            offset: usize,
10723            depth: fidl::encoding::Depth,
10724        ) -> fidl::Result<()> {
10725            encoder.debug_check_bounds::<ManagerConnectRequest>(offset);
10726            // Zero out padding regions. There's no need to apply masks
10727            // because the unmasked parts will be overwritten by fields.
10728            unsafe {
10729                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
10730                (ptr as *mut u64).write_unaligned(0);
10731            }
10732            // Write the fields.
10733            self.0.encode(encoder, offset + 0, depth)?;
10734            self.1.encode(encoder, offset + 16, depth)?;
10735            Ok(())
10736        }
10737    }
10738
10739    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10740        for ManagerConnectRequest
10741    {
10742        #[inline(always)]
10743        fn new_empty() -> Self {
10744            Self {
10745                fuzzer_url: fidl::new_empty!(
10746                    fidl::encoding::BoundedString<4096>,
10747                    fidl::encoding::DefaultFuchsiaResourceDialect
10748                ),
10749                controller: fidl::new_empty!(
10750                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10751                    fidl::encoding::DefaultFuchsiaResourceDialect
10752                ),
10753            }
10754        }
10755
10756        #[inline]
10757        unsafe fn decode(
10758            &mut self,
10759            decoder: &mut fidl::encoding::Decoder<
10760                '_,
10761                fidl::encoding::DefaultFuchsiaResourceDialect,
10762            >,
10763            offset: usize,
10764            _depth: fidl::encoding::Depth,
10765        ) -> fidl::Result<()> {
10766            decoder.debug_check_bounds::<Self>(offset);
10767            // Verify that padding bytes are zero.
10768            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
10769            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10770            let mask = 0xffffffff00000000u64;
10771            let maskedval = padval & mask;
10772            if maskedval != 0 {
10773                return Err(fidl::Error::NonZeroPadding {
10774                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
10775                });
10776            }
10777            fidl::decode!(
10778                fidl::encoding::BoundedString<4096>,
10779                fidl::encoding::DefaultFuchsiaResourceDialect,
10780                &mut self.fuzzer_url,
10781                decoder,
10782                offset + 0,
10783                _depth
10784            )?;
10785            fidl::decode!(
10786                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
10787                fidl::encoding::DefaultFuchsiaResourceDialect,
10788                &mut self.controller,
10789                decoder,
10790                offset + 16,
10791                _depth
10792            )?;
10793            Ok(())
10794        }
10795    }
10796
10797    impl fidl::encoding::ResourceTypeMarker for ManagerGetOutputRequest {
10798        type Borrowed<'a> = &'a mut Self;
10799        fn take_or_borrow<'a>(
10800            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10801        ) -> Self::Borrowed<'a> {
10802            value
10803        }
10804    }
10805
10806    unsafe impl fidl::encoding::TypeMarker for ManagerGetOutputRequest {
10807        type Owned = Self;
10808
10809        #[inline(always)]
10810        fn inline_align(_context: fidl::encoding::Context) -> usize {
10811            8
10812        }
10813
10814        #[inline(always)]
10815        fn inline_size(_context: fidl::encoding::Context) -> usize {
10816            24
10817        }
10818    }
10819
10820    unsafe impl
10821        fidl::encoding::Encode<
10822            ManagerGetOutputRequest,
10823            fidl::encoding::DefaultFuchsiaResourceDialect,
10824        > for &mut ManagerGetOutputRequest
10825    {
10826        #[inline]
10827        unsafe fn encode(
10828            self,
10829            encoder: &mut fidl::encoding::Encoder<
10830                '_,
10831                fidl::encoding::DefaultFuchsiaResourceDialect,
10832            >,
10833            offset: usize,
10834            _depth: fidl::encoding::Depth,
10835        ) -> fidl::Result<()> {
10836            encoder.debug_check_bounds::<ManagerGetOutputRequest>(offset);
10837            // Delegate to tuple encoding.
10838            fidl::encoding::Encode::<ManagerGetOutputRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10839                (
10840                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.fuzzer_url),
10841                    <TestOutput as fidl::encoding::ValueTypeMarker>::borrow(&self.output),
10842                    <fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.socket),
10843                ),
10844                encoder, offset, _depth
10845            )
10846        }
10847    }
10848    unsafe impl<
10849        T0: fidl::encoding::Encode<
10850                fidl::encoding::BoundedString<4096>,
10851                fidl::encoding::DefaultFuchsiaResourceDialect,
10852            >,
10853        T1: fidl::encoding::Encode<TestOutput, fidl::encoding::DefaultFuchsiaResourceDialect>,
10854        T2: fidl::encoding::Encode<
10855                fidl::encoding::HandleType<
10856                    fidl::Socket,
10857                    { fidl::ObjectType::SOCKET.into_raw() },
10858                    2147483648,
10859                >,
10860                fidl::encoding::DefaultFuchsiaResourceDialect,
10861            >,
10862    >
10863        fidl::encoding::Encode<
10864            ManagerGetOutputRequest,
10865            fidl::encoding::DefaultFuchsiaResourceDialect,
10866        > for (T0, T1, T2)
10867    {
10868        #[inline]
10869        unsafe fn encode(
10870            self,
10871            encoder: &mut fidl::encoding::Encoder<
10872                '_,
10873                fidl::encoding::DefaultFuchsiaResourceDialect,
10874            >,
10875            offset: usize,
10876            depth: fidl::encoding::Depth,
10877        ) -> fidl::Result<()> {
10878            encoder.debug_check_bounds::<ManagerGetOutputRequest>(offset);
10879            // Zero out padding regions. There's no need to apply masks
10880            // because the unmasked parts will be overwritten by fields.
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 + 20, depth)?;
10885            Ok(())
10886        }
10887    }
10888
10889    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10890        for ManagerGetOutputRequest
10891    {
10892        #[inline(always)]
10893        fn new_empty() -> Self {
10894            Self {
10895                fuzzer_url: fidl::new_empty!(
10896                    fidl::encoding::BoundedString<4096>,
10897                    fidl::encoding::DefaultFuchsiaResourceDialect
10898                ),
10899                output: fidl::new_empty!(TestOutput, fidl::encoding::DefaultFuchsiaResourceDialect),
10900                socket: fidl::new_empty!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10901            }
10902        }
10903
10904        #[inline]
10905        unsafe fn decode(
10906            &mut self,
10907            decoder: &mut fidl::encoding::Decoder<
10908                '_,
10909                fidl::encoding::DefaultFuchsiaResourceDialect,
10910            >,
10911            offset: usize,
10912            _depth: fidl::encoding::Depth,
10913        ) -> fidl::Result<()> {
10914            decoder.debug_check_bounds::<Self>(offset);
10915            // Verify that padding bytes are zero.
10916            fidl::decode!(
10917                fidl::encoding::BoundedString<4096>,
10918                fidl::encoding::DefaultFuchsiaResourceDialect,
10919                &mut self.fuzzer_url,
10920                decoder,
10921                offset + 0,
10922                _depth
10923            )?;
10924            fidl::decode!(
10925                TestOutput,
10926                fidl::encoding::DefaultFuchsiaResourceDialect,
10927                &mut self.output,
10928                decoder,
10929                offset + 16,
10930                _depth
10931            )?;
10932            fidl::decode!(fidl::encoding::HandleType<fidl::Socket, { fidl::ObjectType::SOCKET.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.socket, decoder, offset + 20, _depth)?;
10933            Ok(())
10934        }
10935    }
10936
10937    impl fidl::encoding::ResourceTypeMarker for RegistrarRegisterRequest {
10938        type Borrowed<'a> = &'a mut Self;
10939        fn take_or_borrow<'a>(
10940            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10941        ) -> Self::Borrowed<'a> {
10942            value
10943        }
10944    }
10945
10946    unsafe impl fidl::encoding::TypeMarker for RegistrarRegisterRequest {
10947        type Owned = Self;
10948
10949        #[inline(always)]
10950        fn inline_align(_context: fidl::encoding::Context) -> usize {
10951            8
10952        }
10953
10954        #[inline(always)]
10955        fn inline_size(_context: fidl::encoding::Context) -> usize {
10956            24
10957        }
10958    }
10959
10960    unsafe impl
10961        fidl::encoding::Encode<
10962            RegistrarRegisterRequest,
10963            fidl::encoding::DefaultFuchsiaResourceDialect,
10964        > for &mut RegistrarRegisterRequest
10965    {
10966        #[inline]
10967        unsafe fn encode(
10968            self,
10969            encoder: &mut fidl::encoding::Encoder<
10970                '_,
10971                fidl::encoding::DefaultFuchsiaResourceDialect,
10972            >,
10973            offset: usize,
10974            _depth: fidl::encoding::Depth,
10975        ) -> fidl::Result<()> {
10976            encoder.debug_check_bounds::<RegistrarRegisterRequest>(offset);
10977            // Delegate to tuple encoding.
10978            fidl::encoding::Encode::<RegistrarRegisterRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10979                (
10980                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.fuzzer_url),
10981                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ControllerProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
10982                ),
10983                encoder, offset, _depth
10984            )
10985        }
10986    }
10987    unsafe impl<
10988        T0: fidl::encoding::Encode<
10989                fidl::encoding::BoundedString<4096>,
10990                fidl::encoding::DefaultFuchsiaResourceDialect,
10991            >,
10992        T1: fidl::encoding::Encode<
10993                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ControllerProviderMarker>>,
10994                fidl::encoding::DefaultFuchsiaResourceDialect,
10995            >,
10996    >
10997        fidl::encoding::Encode<
10998            RegistrarRegisterRequest,
10999            fidl::encoding::DefaultFuchsiaResourceDialect,
11000        > for (T0, T1)
11001    {
11002        #[inline]
11003        unsafe fn encode(
11004            self,
11005            encoder: &mut fidl::encoding::Encoder<
11006                '_,
11007                fidl::encoding::DefaultFuchsiaResourceDialect,
11008            >,
11009            offset: usize,
11010            depth: fidl::encoding::Depth,
11011        ) -> fidl::Result<()> {
11012            encoder.debug_check_bounds::<RegistrarRegisterRequest>(offset);
11013            // Zero out padding regions. There's no need to apply masks
11014            // because the unmasked parts will be overwritten by fields.
11015            unsafe {
11016                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11017                (ptr as *mut u64).write_unaligned(0);
11018            }
11019            // Write the fields.
11020            self.0.encode(encoder, offset + 0, depth)?;
11021            self.1.encode(encoder, offset + 16, depth)?;
11022            Ok(())
11023        }
11024    }
11025
11026    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11027        for RegistrarRegisterRequest
11028    {
11029        #[inline(always)]
11030        fn new_empty() -> Self {
11031            Self {
11032                fuzzer_url: fidl::new_empty!(
11033                    fidl::encoding::BoundedString<4096>,
11034                    fidl::encoding::DefaultFuchsiaResourceDialect
11035                ),
11036                provider: fidl::new_empty!(
11037                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ControllerProviderMarker>>,
11038                    fidl::encoding::DefaultFuchsiaResourceDialect
11039                ),
11040            }
11041        }
11042
11043        #[inline]
11044        unsafe fn decode(
11045            &mut self,
11046            decoder: &mut fidl::encoding::Decoder<
11047                '_,
11048                fidl::encoding::DefaultFuchsiaResourceDialect,
11049            >,
11050            offset: usize,
11051            _depth: fidl::encoding::Depth,
11052        ) -> fidl::Result<()> {
11053            decoder.debug_check_bounds::<Self>(offset);
11054            // Verify that padding bytes are zero.
11055            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11056            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11057            let mask = 0xffffffff00000000u64;
11058            let maskedval = padval & mask;
11059            if maskedval != 0 {
11060                return Err(fidl::Error::NonZeroPadding {
11061                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11062                });
11063            }
11064            fidl::decode!(
11065                fidl::encoding::BoundedString<4096>,
11066                fidl::encoding::DefaultFuchsiaResourceDialect,
11067                &mut self.fuzzer_url,
11068                decoder,
11069                offset + 0,
11070                _depth
11071            )?;
11072            fidl::decode!(
11073                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ControllerProviderMarker>>,
11074                fidl::encoding::DefaultFuchsiaResourceDialect,
11075                &mut self.provider,
11076                decoder,
11077                offset + 16,
11078                _depth
11079            )?;
11080            Ok(())
11081        }
11082    }
11083
11084    impl fidl::encoding::ResourceTypeMarker for RegistryConnectRequest {
11085        type Borrowed<'a> = &'a mut Self;
11086        fn take_or_borrow<'a>(
11087            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11088        ) -> Self::Borrowed<'a> {
11089            value
11090        }
11091    }
11092
11093    unsafe impl fidl::encoding::TypeMarker for RegistryConnectRequest {
11094        type Owned = Self;
11095
11096        #[inline(always)]
11097        fn inline_align(_context: fidl::encoding::Context) -> usize {
11098            8
11099        }
11100
11101        #[inline(always)]
11102        fn inline_size(_context: fidl::encoding::Context) -> usize {
11103            32
11104        }
11105    }
11106
11107    unsafe impl
11108        fidl::encoding::Encode<
11109            RegistryConnectRequest,
11110            fidl::encoding::DefaultFuchsiaResourceDialect,
11111        > for &mut RegistryConnectRequest
11112    {
11113        #[inline]
11114        unsafe fn encode(
11115            self,
11116            encoder: &mut fidl::encoding::Encoder<
11117                '_,
11118                fidl::encoding::DefaultFuchsiaResourceDialect,
11119            >,
11120            offset: usize,
11121            _depth: fidl::encoding::Depth,
11122        ) -> fidl::Result<()> {
11123            encoder.debug_check_bounds::<RegistryConnectRequest>(offset);
11124            // Delegate to tuple encoding.
11125            fidl::encoding::Encode::<RegistryConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11126                (
11127                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.fuzzer_url),
11128                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.controller),
11129                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.timeout),
11130                ),
11131                encoder, offset, _depth
11132            )
11133        }
11134    }
11135    unsafe impl<
11136        T0: fidl::encoding::Encode<
11137                fidl::encoding::BoundedString<4096>,
11138                fidl::encoding::DefaultFuchsiaResourceDialect,
11139            >,
11140        T1: fidl::encoding::Encode<
11141                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
11142                fidl::encoding::DefaultFuchsiaResourceDialect,
11143            >,
11144        T2: fidl::encoding::Encode<i64, fidl::encoding::DefaultFuchsiaResourceDialect>,
11145    >
11146        fidl::encoding::Encode<
11147            RegistryConnectRequest,
11148            fidl::encoding::DefaultFuchsiaResourceDialect,
11149        > for (T0, T1, T2)
11150    {
11151        #[inline]
11152        unsafe fn encode(
11153            self,
11154            encoder: &mut fidl::encoding::Encoder<
11155                '_,
11156                fidl::encoding::DefaultFuchsiaResourceDialect,
11157            >,
11158            offset: usize,
11159            depth: fidl::encoding::Depth,
11160        ) -> fidl::Result<()> {
11161            encoder.debug_check_bounds::<RegistryConnectRequest>(offset);
11162            // Zero out padding regions. There's no need to apply masks
11163            // because the unmasked parts will be overwritten by fields.
11164            unsafe {
11165                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
11166                (ptr as *mut u64).write_unaligned(0);
11167            }
11168            // Write the fields.
11169            self.0.encode(encoder, offset + 0, depth)?;
11170            self.1.encode(encoder, offset + 16, depth)?;
11171            self.2.encode(encoder, offset + 24, depth)?;
11172            Ok(())
11173        }
11174    }
11175
11176    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11177        for RegistryConnectRequest
11178    {
11179        #[inline(always)]
11180        fn new_empty() -> Self {
11181            Self {
11182                fuzzer_url: fidl::new_empty!(
11183                    fidl::encoding::BoundedString<4096>,
11184                    fidl::encoding::DefaultFuchsiaResourceDialect
11185                ),
11186                controller: fidl::new_empty!(
11187                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
11188                    fidl::encoding::DefaultFuchsiaResourceDialect
11189                ),
11190                timeout: fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect),
11191            }
11192        }
11193
11194        #[inline]
11195        unsafe fn decode(
11196            &mut self,
11197            decoder: &mut fidl::encoding::Decoder<
11198                '_,
11199                fidl::encoding::DefaultFuchsiaResourceDialect,
11200            >,
11201            offset: usize,
11202            _depth: fidl::encoding::Depth,
11203        ) -> fidl::Result<()> {
11204            decoder.debug_check_bounds::<Self>(offset);
11205            // Verify that padding bytes are zero.
11206            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
11207            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11208            let mask = 0xffffffff00000000u64;
11209            let maskedval = padval & mask;
11210            if maskedval != 0 {
11211                return Err(fidl::Error::NonZeroPadding {
11212                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
11213                });
11214            }
11215            fidl::decode!(
11216                fidl::encoding::BoundedString<4096>,
11217                fidl::encoding::DefaultFuchsiaResourceDialect,
11218                &mut self.fuzzer_url,
11219                decoder,
11220                offset + 0,
11221                _depth
11222            )?;
11223            fidl::decode!(
11224                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControllerMarker>>,
11225                fidl::encoding::DefaultFuchsiaResourceDialect,
11226                &mut self.controller,
11227                decoder,
11228                offset + 16,
11229                _depth
11230            )?;
11231            fidl::decode!(
11232                i64,
11233                fidl::encoding::DefaultFuchsiaResourceDialect,
11234                &mut self.timeout,
11235                decoder,
11236                offset + 24,
11237                _depth
11238            )?;
11239            Ok(())
11240        }
11241    }
11242
11243    impl fidl::encoding::ResourceTypeMarker for TargetAdapterConnectRequest {
11244        type Borrowed<'a> = &'a mut Self;
11245        fn take_or_borrow<'a>(
11246            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11247        ) -> Self::Borrowed<'a> {
11248            value
11249        }
11250    }
11251
11252    unsafe impl fidl::encoding::TypeMarker for TargetAdapterConnectRequest {
11253        type Owned = Self;
11254
11255        #[inline(always)]
11256        fn inline_align(_context: fidl::encoding::Context) -> usize {
11257            4
11258        }
11259
11260        #[inline(always)]
11261        fn inline_size(_context: fidl::encoding::Context) -> usize {
11262            8
11263        }
11264    }
11265
11266    unsafe impl
11267        fidl::encoding::Encode<
11268            TargetAdapterConnectRequest,
11269            fidl::encoding::DefaultFuchsiaResourceDialect,
11270        > for &mut TargetAdapterConnectRequest
11271    {
11272        #[inline]
11273        unsafe fn encode(
11274            self,
11275            encoder: &mut fidl::encoding::Encoder<
11276                '_,
11277                fidl::encoding::DefaultFuchsiaResourceDialect,
11278            >,
11279            offset: usize,
11280            _depth: fidl::encoding::Depth,
11281        ) -> fidl::Result<()> {
11282            encoder.debug_check_bounds::<TargetAdapterConnectRequest>(offset);
11283            // Delegate to tuple encoding.
11284            fidl::encoding::Encode::<
11285                TargetAdapterConnectRequest,
11286                fidl::encoding::DefaultFuchsiaResourceDialect,
11287            >::encode(
11288                (
11289                    <fidl::encoding::HandleType<
11290                        fidl::EventPair,
11291                        { fidl::ObjectType::EVENTPAIR.into_raw() },
11292                        2147483648,
11293                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11294                        &mut self.eventpair
11295                    ),
11296                    <fidl::encoding::HandleType<
11297                        fidl::Vmo,
11298                        { fidl::ObjectType::VMO.into_raw() },
11299                        2147483648,
11300                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11301                        &mut self.test_input
11302                    ),
11303                ),
11304                encoder,
11305                offset,
11306                _depth,
11307            )
11308        }
11309    }
11310    unsafe impl<
11311        T0: fidl::encoding::Encode<
11312                fidl::encoding::HandleType<
11313                    fidl::EventPair,
11314                    { fidl::ObjectType::EVENTPAIR.into_raw() },
11315                    2147483648,
11316                >,
11317                fidl::encoding::DefaultFuchsiaResourceDialect,
11318            >,
11319        T1: fidl::encoding::Encode<
11320                fidl::encoding::HandleType<
11321                    fidl::Vmo,
11322                    { fidl::ObjectType::VMO.into_raw() },
11323                    2147483648,
11324                >,
11325                fidl::encoding::DefaultFuchsiaResourceDialect,
11326            >,
11327    >
11328        fidl::encoding::Encode<
11329            TargetAdapterConnectRequest,
11330            fidl::encoding::DefaultFuchsiaResourceDialect,
11331        > for (T0, T1)
11332    {
11333        #[inline]
11334        unsafe fn encode(
11335            self,
11336            encoder: &mut fidl::encoding::Encoder<
11337                '_,
11338                fidl::encoding::DefaultFuchsiaResourceDialect,
11339            >,
11340            offset: usize,
11341            depth: fidl::encoding::Depth,
11342        ) -> fidl::Result<()> {
11343            encoder.debug_check_bounds::<TargetAdapterConnectRequest>(offset);
11344            // Zero out padding regions. There's no need to apply masks
11345            // because the unmasked parts will be overwritten by fields.
11346            // Write the fields.
11347            self.0.encode(encoder, offset + 0, depth)?;
11348            self.1.encode(encoder, offset + 4, depth)?;
11349            Ok(())
11350        }
11351    }
11352
11353    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11354        for TargetAdapterConnectRequest
11355    {
11356        #[inline(always)]
11357        fn new_empty() -> Self {
11358            Self {
11359                eventpair: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11360                test_input: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11361            }
11362        }
11363
11364        #[inline]
11365        unsafe fn decode(
11366            &mut self,
11367            decoder: &mut fidl::encoding::Decoder<
11368                '_,
11369                fidl::encoding::DefaultFuchsiaResourceDialect,
11370            >,
11371            offset: usize,
11372            _depth: fidl::encoding::Depth,
11373        ) -> fidl::Result<()> {
11374            decoder.debug_check_bounds::<Self>(offset);
11375            // Verify that padding bytes are zero.
11376            fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.eventpair, decoder, offset + 0, _depth)?;
11377            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.test_input, decoder, offset + 4, _depth)?;
11378            Ok(())
11379        }
11380    }
11381
11382    impl Artifact {
11383        #[inline(always)]
11384        fn max_ordinal_present(&self) -> u64 {
11385            if let Some(_) = self.error {
11386                return 3;
11387            }
11388            if let Some(_) = self.input {
11389                return 2;
11390            }
11391            if let Some(_) = self.result {
11392                return 1;
11393            }
11394            0
11395        }
11396    }
11397
11398    impl fidl::encoding::ResourceTypeMarker for Artifact {
11399        type Borrowed<'a> = &'a mut Self;
11400        fn take_or_borrow<'a>(
11401            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11402        ) -> Self::Borrowed<'a> {
11403            value
11404        }
11405    }
11406
11407    unsafe impl fidl::encoding::TypeMarker for Artifact {
11408        type Owned = Self;
11409
11410        #[inline(always)]
11411        fn inline_align(_context: fidl::encoding::Context) -> usize {
11412            8
11413        }
11414
11415        #[inline(always)]
11416        fn inline_size(_context: fidl::encoding::Context) -> usize {
11417            16
11418        }
11419    }
11420
11421    unsafe impl fidl::encoding::Encode<Artifact, fidl::encoding::DefaultFuchsiaResourceDialect>
11422        for &mut Artifact
11423    {
11424        unsafe fn encode(
11425            self,
11426            encoder: &mut fidl::encoding::Encoder<
11427                '_,
11428                fidl::encoding::DefaultFuchsiaResourceDialect,
11429            >,
11430            offset: usize,
11431            mut depth: fidl::encoding::Depth,
11432        ) -> fidl::Result<()> {
11433            encoder.debug_check_bounds::<Artifact>(offset);
11434            // Vector header
11435            let max_ordinal: u64 = self.max_ordinal_present();
11436            encoder.write_num(max_ordinal, offset);
11437            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11438            // Calling encoder.out_of_line_offset(0) is not allowed.
11439            if max_ordinal == 0 {
11440                return Ok(());
11441            }
11442            depth.increment()?;
11443            let envelope_size = 8;
11444            let bytes_len = max_ordinal as usize * envelope_size;
11445            #[allow(unused_variables)]
11446            let offset = encoder.out_of_line_offset(bytes_len);
11447            let mut _prev_end_offset: usize = 0;
11448            if 1 > max_ordinal {
11449                return Ok(());
11450            }
11451
11452            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11453            // are envelope_size bytes.
11454            let cur_offset: usize = (1 - 1) * envelope_size;
11455
11456            // Zero reserved fields.
11457            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11458
11459            // Safety:
11460            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11461            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11462            //   envelope_size bytes, there is always sufficient room.
11463            fidl::encoding::encode_in_envelope_optional::<
11464                Result_,
11465                fidl::encoding::DefaultFuchsiaResourceDialect,
11466            >(
11467                self.result.as_ref().map(<Result_ as fidl::encoding::ValueTypeMarker>::borrow),
11468                encoder,
11469                offset + cur_offset,
11470                depth,
11471            )?;
11472
11473            _prev_end_offset = cur_offset + envelope_size;
11474            if 2 > max_ordinal {
11475                return Ok(());
11476            }
11477
11478            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11479            // are envelope_size bytes.
11480            let cur_offset: usize = (2 - 1) * envelope_size;
11481
11482            // Zero reserved fields.
11483            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11484
11485            // Safety:
11486            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11487            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11488            //   envelope_size bytes, there is always sufficient room.
11489            fidl::encoding::encode_in_envelope_optional::<
11490                Input,
11491                fidl::encoding::DefaultFuchsiaResourceDialect,
11492            >(
11493                self.input
11494                    .as_mut()
11495                    .map(<Input as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11496                encoder,
11497                offset + cur_offset,
11498                depth,
11499            )?;
11500
11501            _prev_end_offset = cur_offset + envelope_size;
11502            if 3 > max_ordinal {
11503                return Ok(());
11504            }
11505
11506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11507            // are envelope_size bytes.
11508            let cur_offset: usize = (3 - 1) * envelope_size;
11509
11510            // Zero reserved fields.
11511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11512
11513            // Safety:
11514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11516            //   envelope_size bytes, there is always sufficient room.
11517            fidl::encoding::encode_in_envelope_optional::<
11518                i32,
11519                fidl::encoding::DefaultFuchsiaResourceDialect,
11520            >(
11521                self.error.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
11522                encoder,
11523                offset + cur_offset,
11524                depth,
11525            )?;
11526
11527            _prev_end_offset = cur_offset + envelope_size;
11528
11529            Ok(())
11530        }
11531    }
11532
11533    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Artifact {
11534        #[inline(always)]
11535        fn new_empty() -> Self {
11536            Self::default()
11537        }
11538
11539        unsafe fn decode(
11540            &mut self,
11541            decoder: &mut fidl::encoding::Decoder<
11542                '_,
11543                fidl::encoding::DefaultFuchsiaResourceDialect,
11544            >,
11545            offset: usize,
11546            mut depth: fidl::encoding::Depth,
11547        ) -> fidl::Result<()> {
11548            decoder.debug_check_bounds::<Self>(offset);
11549            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11550                None => return Err(fidl::Error::NotNullable),
11551                Some(len) => len,
11552            };
11553            // Calling decoder.out_of_line_offset(0) is not allowed.
11554            if len == 0 {
11555                return Ok(());
11556            };
11557            depth.increment()?;
11558            let envelope_size = 8;
11559            let bytes_len = len * envelope_size;
11560            let offset = decoder.out_of_line_offset(bytes_len)?;
11561            // Decode the envelope for each type.
11562            let mut _next_ordinal_to_read = 0;
11563            let mut next_offset = offset;
11564            let end_offset = offset + bytes_len;
11565            _next_ordinal_to_read += 1;
11566            if next_offset >= end_offset {
11567                return Ok(());
11568            }
11569
11570            // Decode unknown envelopes for gaps in ordinals.
11571            while _next_ordinal_to_read < 1 {
11572                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11573                _next_ordinal_to_read += 1;
11574                next_offset += envelope_size;
11575            }
11576
11577            let next_out_of_line = decoder.next_out_of_line();
11578            let handles_before = decoder.remaining_handles();
11579            if let Some((inlined, num_bytes, num_handles)) =
11580                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11581            {
11582                let member_inline_size =
11583                    <Result_ as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11584                if inlined != (member_inline_size <= 4) {
11585                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11586                }
11587                let inner_offset;
11588                let mut inner_depth = depth.clone();
11589                if inlined {
11590                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11591                    inner_offset = next_offset;
11592                } else {
11593                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11594                    inner_depth.increment()?;
11595                }
11596                let val_ref = self.result.get_or_insert_with(|| {
11597                    fidl::new_empty!(Result_, fidl::encoding::DefaultFuchsiaResourceDialect)
11598                });
11599                fidl::decode!(
11600                    Result_,
11601                    fidl::encoding::DefaultFuchsiaResourceDialect,
11602                    val_ref,
11603                    decoder,
11604                    inner_offset,
11605                    inner_depth
11606                )?;
11607                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11608                {
11609                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11610                }
11611                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11612                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11613                }
11614            }
11615
11616            next_offset += envelope_size;
11617            _next_ordinal_to_read += 1;
11618            if next_offset >= end_offset {
11619                return Ok(());
11620            }
11621
11622            // Decode unknown envelopes for gaps in ordinals.
11623            while _next_ordinal_to_read < 2 {
11624                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11625                _next_ordinal_to_read += 1;
11626                next_offset += envelope_size;
11627            }
11628
11629            let next_out_of_line = decoder.next_out_of_line();
11630            let handles_before = decoder.remaining_handles();
11631            if let Some((inlined, num_bytes, num_handles)) =
11632                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11633            {
11634                let member_inline_size =
11635                    <Input as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11636                if inlined != (member_inline_size <= 4) {
11637                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11638                }
11639                let inner_offset;
11640                let mut inner_depth = depth.clone();
11641                if inlined {
11642                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11643                    inner_offset = next_offset;
11644                } else {
11645                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11646                    inner_depth.increment()?;
11647                }
11648                let val_ref = self.input.get_or_insert_with(|| {
11649                    fidl::new_empty!(Input, fidl::encoding::DefaultFuchsiaResourceDialect)
11650                });
11651                fidl::decode!(
11652                    Input,
11653                    fidl::encoding::DefaultFuchsiaResourceDialect,
11654                    val_ref,
11655                    decoder,
11656                    inner_offset,
11657                    inner_depth
11658                )?;
11659                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11660                {
11661                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11662                }
11663                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11664                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11665                }
11666            }
11667
11668            next_offset += envelope_size;
11669            _next_ordinal_to_read += 1;
11670            if next_offset >= end_offset {
11671                return Ok(());
11672            }
11673
11674            // Decode unknown envelopes for gaps in ordinals.
11675            while _next_ordinal_to_read < 3 {
11676                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11677                _next_ordinal_to_read += 1;
11678                next_offset += envelope_size;
11679            }
11680
11681            let next_out_of_line = decoder.next_out_of_line();
11682            let handles_before = decoder.remaining_handles();
11683            if let Some((inlined, num_bytes, num_handles)) =
11684                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11685            {
11686                let member_inline_size =
11687                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11688                if inlined != (member_inline_size <= 4) {
11689                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11690                }
11691                let inner_offset;
11692                let mut inner_depth = depth.clone();
11693                if inlined {
11694                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11695                    inner_offset = next_offset;
11696                } else {
11697                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11698                    inner_depth.increment()?;
11699                }
11700                let val_ref = self.error.get_or_insert_with(|| {
11701                    fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect)
11702                });
11703                fidl::decode!(
11704                    i32,
11705                    fidl::encoding::DefaultFuchsiaResourceDialect,
11706                    val_ref,
11707                    decoder,
11708                    inner_offset,
11709                    inner_depth
11710                )?;
11711                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11712                {
11713                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11714                }
11715                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11716                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11717                }
11718            }
11719
11720            next_offset += envelope_size;
11721
11722            // Decode the remaining unknown envelopes.
11723            while next_offset < end_offset {
11724                _next_ordinal_to_read += 1;
11725                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11726                next_offset += envelope_size;
11727            }
11728
11729            Ok(())
11730        }
11731    }
11732
11733    impl fidl::encoding::ResourceTypeMarker for Data {
11734        type Borrowed<'a> = &'a mut Self;
11735        fn take_or_borrow<'a>(
11736            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11737        ) -> Self::Borrowed<'a> {
11738            value
11739        }
11740    }
11741
11742    unsafe impl fidl::encoding::TypeMarker for Data {
11743        type Owned = Self;
11744
11745        #[inline(always)]
11746        fn inline_align(_context: fidl::encoding::Context) -> usize {
11747            8
11748        }
11749
11750        #[inline(always)]
11751        fn inline_size(_context: fidl::encoding::Context) -> usize {
11752            16
11753        }
11754    }
11755
11756    unsafe impl fidl::encoding::Encode<Data, fidl::encoding::DefaultFuchsiaResourceDialect>
11757        for &mut Data
11758    {
11759        #[inline]
11760        unsafe fn encode(
11761            self,
11762            encoder: &mut fidl::encoding::Encoder<
11763                '_,
11764                fidl::encoding::DefaultFuchsiaResourceDialect,
11765            >,
11766            offset: usize,
11767            _depth: fidl::encoding::Depth,
11768        ) -> fidl::Result<()> {
11769            encoder.debug_check_bounds::<Data>(offset);
11770            encoder.write_num::<u64>(self.ordinal(), offset);
11771            match self {
11772                Data::Instrumented(ref mut val) => fidl::encoding::encode_in_envelope::<
11773                    InstrumentedProcess,
11774                    fidl::encoding::DefaultFuchsiaResourceDialect,
11775                >(
11776                    <InstrumentedProcess as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11777                        val,
11778                    ),
11779                    encoder,
11780                    offset + 8,
11781                    _depth,
11782                ),
11783                Data::Inline8bitCounters(ref mut val) => fidl::encoding::encode_in_envelope::<
11784                    fidl::encoding::HandleType<
11785                        fidl::Vmo,
11786                        { fidl::ObjectType::VMO.into_raw() },
11787                        2147483648,
11788                    >,
11789                    fidl::encoding::DefaultFuchsiaResourceDialect,
11790                >(
11791                    <fidl::encoding::HandleType<
11792                        fidl::Vmo,
11793                        { fidl::ObjectType::VMO.into_raw() },
11794                        2147483648,
11795                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11796                        val
11797                    ),
11798                    encoder,
11799                    offset + 8,
11800                    _depth,
11801                ),
11802                Data::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
11803            }
11804        }
11805    }
11806
11807    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Data {
11808        #[inline(always)]
11809        fn new_empty() -> Self {
11810            Self::__SourceBreaking { unknown_ordinal: 0 }
11811        }
11812
11813        #[inline]
11814        unsafe fn decode(
11815            &mut self,
11816            decoder: &mut fidl::encoding::Decoder<
11817                '_,
11818                fidl::encoding::DefaultFuchsiaResourceDialect,
11819            >,
11820            offset: usize,
11821            mut depth: fidl::encoding::Depth,
11822        ) -> fidl::Result<()> {
11823            decoder.debug_check_bounds::<Self>(offset);
11824            #[allow(unused_variables)]
11825            let next_out_of_line = decoder.next_out_of_line();
11826            let handles_before = decoder.remaining_handles();
11827            let (ordinal, inlined, num_bytes, num_handles) =
11828                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
11829
11830            let member_inline_size = match ordinal {
11831                1 => <InstrumentedProcess as fidl::encoding::TypeMarker>::inline_size(
11832                    decoder.context,
11833                ),
11834                2 => <fidl::encoding::HandleType<
11835                    fidl::Vmo,
11836                    { fidl::ObjectType::VMO.into_raw() },
11837                    2147483648,
11838                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11839                0 => return Err(fidl::Error::UnknownUnionTag),
11840                _ => num_bytes as usize,
11841            };
11842
11843            if inlined != (member_inline_size <= 4) {
11844                return Err(fidl::Error::InvalidInlineBitInEnvelope);
11845            }
11846            let _inner_offset;
11847            if inlined {
11848                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
11849                _inner_offset = offset + 8;
11850            } else {
11851                depth.increment()?;
11852                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11853            }
11854            match ordinal {
11855                1 => {
11856                    #[allow(irrefutable_let_patterns)]
11857                    if let Data::Instrumented(_) = self {
11858                        // Do nothing, read the value into the object
11859                    } else {
11860                        // Initialize `self` to the right variant
11861                        *self = Data::Instrumented(fidl::new_empty!(
11862                            InstrumentedProcess,
11863                            fidl::encoding::DefaultFuchsiaResourceDialect
11864                        ));
11865                    }
11866                    #[allow(irrefutable_let_patterns)]
11867                    if let Data::Instrumented(ref mut val) = self {
11868                        fidl::decode!(
11869                            InstrumentedProcess,
11870                            fidl::encoding::DefaultFuchsiaResourceDialect,
11871                            val,
11872                            decoder,
11873                            _inner_offset,
11874                            depth
11875                        )?;
11876                    } else {
11877                        unreachable!()
11878                    }
11879                }
11880                2 => {
11881                    #[allow(irrefutable_let_patterns)]
11882                    if let Data::Inline8bitCounters(_) = self {
11883                        // Do nothing, read the value into the object
11884                    } else {
11885                        // Initialize `self` to the right variant
11886                        *self = Data::Inline8bitCounters(
11887                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11888                        );
11889                    }
11890                    #[allow(irrefutable_let_patterns)]
11891                    if let Data::Inline8bitCounters(ref mut val) = self {
11892                        fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
11893                    } else {
11894                        unreachable!()
11895                    }
11896                }
11897                #[allow(deprecated)]
11898                ordinal => {
11899                    for _ in 0..num_handles {
11900                        decoder.drop_next_handle()?;
11901                    }
11902                    *self = Data::__SourceBreaking { unknown_ordinal: ordinal };
11903                }
11904            }
11905            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
11906                return Err(fidl::Error::InvalidNumBytesInEnvelope);
11907            }
11908            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11909                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11910            }
11911            Ok(())
11912        }
11913    }
11914}