1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 #[doc = " A key/value pair in a `Dictionary`.\n"]
8 #[derive(PartialEq, Clone, Debug)]
9 pub struct DictionaryEntry {
10 pub key: ::std::string::String,
11
12 pub value: ::core::option::Option<::std::boxed::Box<crate::natural::DictionaryValue>>,
13 }
14
15 impl ::fidl_next::Encodable for DictionaryEntry {
16 type Encoded = crate::wire::DictionaryEntry<'static>;
17 }
18
19 unsafe impl<___E> ::fidl_next::Encode<___E> for DictionaryEntry
20 where
21 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
22 ___E: ::fidl_next::Encoder,
23 {
24 #[inline]
25 fn encode(
26 self,
27 encoder_: &mut ___E,
28 out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
29 _: (),
30 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
31 ::fidl_next::munge! {
32 let Self::Encoded {
33 key,
34 value,
35
36 } = out_;
37 }
38
39 ::fidl_next::Encode::encode(self.key, encoder_, key, 1024)?;
40
41 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(key.as_mut_ptr()) };
42 ::fidl_next::Constrained::validate(_field, 1024)?;
43
44 ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
45
46 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
47
48 Ok(())
49 }
50 }
51
52 unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DictionaryEntry
53 where
54 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
55 ___E: ::fidl_next::Encoder,
56 {
57 #[inline]
58 fn encode_ref(
59 &self,
60 encoder_: &mut ___E,
61 out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
62 _: (),
63 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
64 ::fidl_next::munge! {
65 let Self::Encoded {
66
67 key,
68 value,
69
70 } = out_;
71 }
72
73 ::fidl_next::EncodeRef::encode_ref(&self.key, encoder_, key, 1024)?;
74
75 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(key.as_mut_ptr()) };
76 ::fidl_next::Constrained::validate(_field, 1024)?;
77
78 ::fidl_next::EncodeRef::encode_ref(&self.value, encoder_, value, ())?;
79
80 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(value.as_mut_ptr()) };
81
82 Ok(())
83 }
84 }
85
86 impl ::fidl_next::EncodableOption for DictionaryEntry {
87 type EncodedOption = ::fidl_next::WireBox<'static, crate::wire::DictionaryEntry<'static>>;
88 }
89
90 unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DictionaryEntry
91 where
92 ___E: ::fidl_next::Encoder + ?Sized,
93 DictionaryEntry: ::fidl_next::Encode<___E>,
94 {
95 #[inline]
96 fn encode_option(
97 this: ::core::option::Option<Self>,
98 encoder: &mut ___E,
99 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
100 _: (),
101 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
102 if let Some(inner) = this {
103 ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
104 ::fidl_next::WireBox::encode_present(out);
105 } else {
106 ::fidl_next::WireBox::encode_absent(out);
107 }
108
109 Ok(())
110 }
111 }
112
113 unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for DictionaryEntry
114 where
115 ___E: ::fidl_next::Encoder + ?Sized,
116 DictionaryEntry: ::fidl_next::EncodeRef<___E>,
117 {
118 #[inline]
119 fn encode_option_ref(
120 this: ::core::option::Option<&Self>,
121 encoder: &mut ___E,
122 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
123 _: (),
124 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
125 if let Some(inner) = this {
126 ::fidl_next::EncoderExt::encode_next(encoder, inner, ())?;
127 ::fidl_next::WireBox::encode_present(out);
128 } else {
129 ::fidl_next::WireBox::encode_absent(out);
130 }
131
132 Ok(())
133 }
134 }
135
136 impl<'de> ::fidl_next::FromWire<crate::wire::DictionaryEntry<'de>> for DictionaryEntry {
137 #[inline]
138 fn from_wire(wire: crate::wire::DictionaryEntry<'de>) -> Self {
139 Self {
140 key: ::fidl_next::FromWire::from_wire(wire.key),
141
142 value: ::fidl_next::FromWire::from_wire(wire.value),
143 }
144 }
145 }
146
147 impl<'de> ::fidl_next::FromWireRef<crate::wire::DictionaryEntry<'de>> for DictionaryEntry {
148 #[inline]
149 fn from_wire_ref(wire: &crate::wire::DictionaryEntry<'de>) -> Self {
150 Self {
151 key: ::fidl_next::FromWireRef::from_wire_ref(&wire.key),
152
153 value: ::fidl_next::FromWireRef::from_wire_ref(&wire.value),
154 }
155 }
156 }
157
158 #[doc = " A dictionary is a sequence of key/value pairs.\n Keys must be unique and sorted in lexicographically increasing order.\n"]
159 #[derive(PartialEq, Clone, Debug, Default)]
160 pub struct Dictionary {
161 pub entries: ::core::option::Option<::std::vec::Vec<crate::natural::DictionaryEntry>>,
162 }
163
164 impl Dictionary {
165 fn __max_ordinal(&self) -> usize {
166 if self.entries.is_some() {
167 return 1;
168 }
169
170 0
171 }
172 }
173
174 impl ::fidl_next::Encodable for Dictionary {
175 type Encoded = crate::wire::Dictionary<'static>;
176 }
177
178 unsafe impl<___E> ::fidl_next::Encode<___E> for Dictionary
179 where
180 ___E: ::fidl_next::Encoder + ?Sized,
181 {
182 #[inline]
183 fn encode(
184 mut self,
185 encoder: &mut ___E,
186 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
187 _: (),
188 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
189 ::fidl_next::munge!(let crate::wire::Dictionary { table } = out);
190
191 let max_ord = self.__max_ordinal();
192
193 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
194 ::fidl_next::Wire::zero_padding(&mut out);
195
196 let mut preallocated =
197 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
198
199 for i in 1..=max_ord {
200 match i {
201 1 => {
202 if let Some(value) = self.entries.take() {
203 ::fidl_next::WireEnvelope::encode_value(
204 value,
205 preallocated.encoder,
206 &mut out,
207 (1024, ()),
208 )?;
209 } else {
210 ::fidl_next::WireEnvelope::encode_zero(&mut out)
211 }
212 }
213
214 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
215 }
216 unsafe {
217 preallocated.write_next(out.assume_init_ref());
218 }
219 }
220
221 ::fidl_next::WireTable::encode_len(table, max_ord);
222
223 Ok(())
224 }
225 }
226
227 unsafe impl<___E> ::fidl_next::EncodeRef<___E> for Dictionary
228 where
229 ___E: ::fidl_next::Encoder + ?Sized,
230 {
231 #[inline]
232 fn encode_ref(
233 &self,
234 encoder: &mut ___E,
235 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
236 _: (),
237 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
238 ::fidl_next::munge!(let crate::wire::Dictionary { table } = out);
239
240 let max_ord = self.__max_ordinal();
241
242 let mut out = ::core::mem::MaybeUninit::<::fidl_next::WireEnvelope>::uninit();
243 ::fidl_next::Wire::zero_padding(&mut out);
244
245 let mut preallocated =
246 ::fidl_next::EncoderExt::preallocate::<::fidl_next::WireEnvelope>(encoder, max_ord);
247
248 for i in 1..=max_ord {
249 match i {
250 1 => {
251 if let Some(value) = &self.entries {
252 ::fidl_next::WireEnvelope::encode_value(
253 value,
254 preallocated.encoder,
255 &mut out,
256 (1024, ()),
257 )?;
258 } else {
259 ::fidl_next::WireEnvelope::encode_zero(&mut out)
260 }
261 }
262
263 _ => ::fidl_next::WireEnvelope::encode_zero(&mut out),
264 }
265 unsafe {
266 preallocated.write_next(out.assume_init_ref());
267 }
268 }
269
270 ::fidl_next::WireTable::encode_len(table, max_ord);
271
272 Ok(())
273 }
274 }
275
276 impl<'de> ::fidl_next::FromWire<crate::wire::Dictionary<'de>> for Dictionary {
277 #[inline]
278 fn from_wire(wire_: crate::wire::Dictionary<'de>) -> Self {
279 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
280
281 let entries = wire_.table.get(1);
282
283 Self {
284
285
286 entries: entries.map(|envelope| ::fidl_next::FromWire::from_wire(
287 unsafe { envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::wire::DictionaryEntry<'de>>>() }
288 )),
289
290 }
291 }
292 }
293
294 impl<'de> ::fidl_next::FromWireRef<crate::wire::Dictionary<'de>> for Dictionary {
295 #[inline]
296 fn from_wire_ref(wire: &crate::wire::Dictionary<'de>) -> Self {
297 Self {
298
299
300 entries: wire.table.get(1)
301 .map(|envelope| ::fidl_next::FromWireRef::from_wire_ref(
302 unsafe { envelope.deref_unchecked::<::fidl_next::WireVector<'de, crate::wire::DictionaryEntry<'de>>>() }
303 )),
304
305 }
306 }
307 }
308
309 #[doc = " A dictionary\'s value is a string, a list of strings, or a list of objects.\n"]
310 #[derive(PartialEq, Clone, Debug)]
311 pub enum DictionaryValue {
312 Str(::std::string::String),
313
314 StrVec(::std::vec::Vec<::std::string::String>),
315
316 ObjVec(::std::vec::Vec<crate::natural::Dictionary>),
317
318 UnknownOrdinal_(u64),
319 }
320
321 impl DictionaryValue {
322 pub fn is_unknown(&self) -> bool {
323 #[allow(unreachable_patterns)]
324 match self {
325 Self::UnknownOrdinal_(_) => true,
326 _ => false,
327 }
328 }
329 }
330
331 impl ::fidl_next::Encodable for DictionaryValue {
332 type Encoded = crate::wire::DictionaryValue<'static>;
333 }
334
335 unsafe impl<___E> ::fidl_next::Encode<___E> for DictionaryValue
336 where
337 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
338 ___E: ::fidl_next::Encoder,
339 {
340 #[inline]
341 fn encode(
342 self,
343 encoder: &mut ___E,
344 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
345 _: (),
346 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
347 ::fidl_next::munge!(let crate::wire::DictionaryValue { raw, _phantom: _ } = out);
348
349 match self {
350 Self::Str(value) => ::fidl_next::RawWireUnion::encode_as::<
351 ___E,
352 ::std::string::String,
353 >(value, 1, encoder, raw, 32768)?,
354
355 Self::StrVec(value) => ::fidl_next::RawWireUnion::encode_as::<
356 ___E,
357 ::std::vec::Vec<::std::string::String>,
358 >(value, 2, encoder, raw, (1024, 32768))?,
359
360 Self::ObjVec(value) => ::fidl_next::RawWireUnion::encode_as::<
361 ___E,
362 ::std::vec::Vec<crate::natural::Dictionary>,
363 >(value, 3, encoder, raw, (1024, ()))?,
364
365 Self::UnknownOrdinal_(ordinal) => {
366 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(ordinal as usize));
367 }
368 }
369
370 Ok(())
371 }
372 }
373
374 unsafe impl<___E> ::fidl_next::EncodeRef<___E> for DictionaryValue
375 where
376 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
377 ___E: ::fidl_next::Encoder,
378 {
379 #[inline]
380 fn encode_ref(
381 &self,
382 encoder: &mut ___E,
383 out: &mut ::core::mem::MaybeUninit<Self::Encoded>,
384 _: (),
385 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
386 ::fidl_next::munge!(let crate::wire::DictionaryValue { raw, _phantom: _ } = out);
387
388 match self {
389 Self::Str(value) => ::fidl_next::RawWireUnion::encode_as::<
390 ___E,
391 &::std::string::String,
392 >(value, 1, encoder, raw, 32768)?,
393
394 Self::StrVec(value) => ::fidl_next::RawWireUnion::encode_as::<
395 ___E,
396 &::std::vec::Vec<::std::string::String>,
397 >(value, 2, encoder, raw, (1024, 32768))?,
398
399 Self::ObjVec(value) => ::fidl_next::RawWireUnion::encode_as::<
400 ___E,
401 &::std::vec::Vec<crate::natural::Dictionary>,
402 >(value, 3, encoder, raw, (1024, ()))?,
403
404 Self::UnknownOrdinal_(ordinal) => {
405 return Err(::fidl_next::EncodeError::UnknownUnionOrdinal(*ordinal as usize));
406 }
407 }
408
409 Ok(())
410 }
411 }
412
413 impl ::fidl_next::EncodableOption for DictionaryValue {
414 type EncodedOption = crate::wire_optional::DictionaryValue<'static>;
415 }
416
417 unsafe impl<___E> ::fidl_next::EncodeOption<___E> for DictionaryValue
418 where
419 ___E: ?Sized,
420 DictionaryValue: ::fidl_next::Encode<___E>,
421 {
422 #[inline]
423 fn encode_option(
424 this: ::core::option::Option<Self>,
425 encoder: &mut ___E,
426 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
427 _: (),
428 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
429 ::fidl_next::munge!(let crate::wire_optional::DictionaryValue { raw, _phantom: _ } = &mut *out);
430
431 if let Some(inner) = this {
432 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
433 ::fidl_next::Encode::encode(inner, encoder, value_out, ())?;
434 } else {
435 ::fidl_next::RawWireUnion::encode_absent(raw);
436 }
437
438 Ok(())
439 }
440 }
441
442 unsafe impl<___E> ::fidl_next::EncodeOptionRef<___E> for DictionaryValue
443 where
444 ___E: ?Sized,
445 DictionaryValue: ::fidl_next::EncodeRef<___E>,
446 {
447 #[inline]
448 fn encode_option_ref(
449 this: ::core::option::Option<&Self>,
450 encoder: &mut ___E,
451 out: &mut ::core::mem::MaybeUninit<Self::EncodedOption>,
452 _: (),
453 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
454 ::fidl_next::munge!(let crate::wire_optional::DictionaryValue { raw, _phantom: _ } = &mut *out);
455
456 if let Some(inner) = this {
457 let value_out = unsafe { &mut *out.as_mut_ptr().cast() };
458 ::fidl_next::EncodeRef::encode_ref(inner, encoder, value_out, ())?;
459 } else {
460 ::fidl_next::RawWireUnion::encode_absent(raw);
461 }
462
463 Ok(())
464 }
465 }
466
467 impl<'de> ::fidl_next::FromWire<crate::wire::DictionaryValue<'de>> for DictionaryValue {
468 #[inline]
469 fn from_wire(wire: crate::wire::DictionaryValue<'de>) -> Self {
470 let wire = ::core::mem::ManuallyDrop::new(wire);
471 match wire.raw.ordinal() {
472 1 => Self::Str(::fidl_next::FromWire::from_wire(unsafe {
473 wire.raw.get().read_unchecked::<::fidl_next::WireString<'de>>()
474 })),
475
476 2 => Self::StrVec(::fidl_next::FromWire::from_wire(unsafe {
477 wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
478 })),
479
480 3 => Self::ObjVec(::fidl_next::FromWire::from_wire(unsafe {
481 wire.raw.get().read_unchecked::<::fidl_next::WireVector<'de, crate::wire::Dictionary<'de>>>()
482 })),
483
484 ord => return Self::UnknownOrdinal_(ord as u64),
485 }
486 }
487 }
488
489 impl<'de> ::fidl_next::FromWireRef<crate::wire::DictionaryValue<'de>> for DictionaryValue {
490 #[inline]
491 fn from_wire_ref(wire: &crate::wire::DictionaryValue<'de>) -> Self {
492 match wire.raw.ordinal() {
493 1 => Self::Str(::fidl_next::FromWireRef::from_wire_ref(unsafe {
494 wire.raw.get().deref_unchecked::<::fidl_next::WireString<'de>>()
495 })),
496
497 2 => Self::StrVec(::fidl_next::FromWireRef::from_wire_ref(unsafe {
498 wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
499 })),
500
501 3 => Self::ObjVec(::fidl_next::FromWireRef::from_wire_ref(unsafe {
502 wire.raw.get().deref_unchecked::<::fidl_next::WireVector<'de, crate::wire::Dictionary<'de>>>()
503 })),
504
505 ord => return Self::UnknownOrdinal_(ord as u64),
506 }
507 }
508 }
509
510 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DictionaryValue<'de>>
511 for DictionaryValue
512 {
513 #[inline]
514 fn from_wire_option(
515 wire: crate::wire_optional::DictionaryValue<'de>,
516 ) -> ::core::option::Option<Self> {
517 if let Some(inner) = wire.into_option() {
518 Some(::fidl_next::FromWire::from_wire(inner))
519 } else {
520 None
521 }
522 }
523 }
524
525 impl<'de> ::fidl_next::FromWireOption<crate::wire_optional::DictionaryValue<'de>>
526 for Box<DictionaryValue>
527 {
528 #[inline]
529 fn from_wire_option(
530 wire: crate::wire_optional::DictionaryValue<'de>,
531 ) -> ::core::option::Option<Self> {
532 <DictionaryValue as ::fidl_next::FromWireOption<
533 crate::wire_optional::DictionaryValue<'de>,
534 >>::from_wire_option(wire)
535 .map(Box::new)
536 }
537 }
538
539 impl<'de> ::fidl_next::FromWireOptionRef<crate::wire_optional::DictionaryValue<'de>>
540 for Box<DictionaryValue>
541 {
542 #[inline]
543 fn from_wire_option_ref(
544 wire: &crate::wire_optional::DictionaryValue<'de>,
545 ) -> ::core::option::Option<Self> {
546 if let Some(inner) = wire.as_ref() {
547 Some(Box::new(::fidl_next::FromWireRef::from_wire_ref(inner)))
548 } else {
549 None
550 }
551 }
552 }
553}
554
555pub mod wire {
556
557 #[derive(Debug)]
559 #[repr(C)]
560 pub struct DictionaryEntry<'de> {
561 pub key: ::fidl_next::WireString<'de>,
562
563 pub value: crate::wire_optional::DictionaryValue<'de>,
564 }
565
566 static_assertions::const_assert_eq!(std::mem::size_of::<DictionaryEntry<'_>>(), 32);
567 static_assertions::const_assert_eq!(std::mem::align_of::<DictionaryEntry<'_>>(), 8);
568
569 static_assertions::const_assert_eq!(std::mem::offset_of!(DictionaryEntry<'_>, key), 0);
570
571 static_assertions::const_assert_eq!(std::mem::offset_of!(DictionaryEntry<'_>, value), 16);
572
573 unsafe impl ::fidl_next::Wire for DictionaryEntry<'static> {
574 type Decoded<'de> = DictionaryEntry<'de>;
575
576 #[inline]
577 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
578 ::fidl_next::munge! {
579 let Self {
580
581 key,
582 value,
583
584 } = &mut *out_;
585 }
586
587 ::fidl_next::Wire::zero_padding(key);
588
589 ::fidl_next::Wire::zero_padding(value);
590 }
591 }
592
593 unsafe impl<___D> ::fidl_next::Decode<___D> for DictionaryEntry<'static>
594 where
595 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
596 ___D: ::fidl_next::Decoder,
597 {
598 fn decode(
599 slot_: ::fidl_next::Slot<'_, Self>,
600 decoder_: &mut ___D,
601 _: (),
602 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
603 ::fidl_next::munge! {
604 let Self {
605
606 mut key,
607 mut value,
608
609 } = slot_;
610 }
611
612 let _field = key.as_mut();
613 ::fidl_next::Constrained::validate(_field, 1024)?;
614 ::fidl_next::Decode::decode(key.as_mut(), decoder_, 1024)?;
615
616 let key = unsafe { key.deref_unchecked() };
617
618 if key.len() > 1024 {
619 return Err(::fidl_next::DecodeError::VectorTooLong {
620 size: key.len() as u64,
621 limit: 1024,
622 });
623 }
624
625 let _field = value.as_mut();
626
627 ::fidl_next::Decode::decode(value.as_mut(), decoder_, ())?;
628
629 Ok(())
630 }
631 }
632
633 impl<'de> ::fidl_next::IntoNatural for DictionaryEntry<'de> {
634 type Natural = crate::natural::DictionaryEntry;
635 }
636
637 impl ::fidl_next::Unconstrained for DictionaryEntry<'static> {}
638
639 #[repr(C)]
641 pub struct Dictionary<'de> {
642 pub(crate) table: ::fidl_next::WireTable<'de>,
643 }
644
645 impl<'de> Drop for Dictionary<'de> {
646 fn drop(&mut self) {
647 let _ = self.table.get(1)
648 .map(|envelope| unsafe {
649 envelope.read_unchecked::<::fidl_next::WireVector<'de, crate::wire::DictionaryEntry<'de>>>()
650 });
651 }
652 }
653
654 unsafe impl ::fidl_next::Wire for Dictionary<'static> {
655 type Decoded<'de> = Dictionary<'de>;
656
657 #[inline]
658 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
659 ::fidl_next::munge!(let Self { table } = out);
660 ::fidl_next::WireTable::zero_padding(table);
661 }
662 }
663
664 unsafe impl<___D> ::fidl_next::Decode<___D> for Dictionary<'static>
665 where
666 ___D: ::fidl_next::Decoder + ?Sized,
667 {
668 fn decode(
669 slot: ::fidl_next::Slot<'_, Self>,
670 decoder: &mut ___D,
671 _: (),
672 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
673 ::fidl_next::munge!(let Self { table } = slot);
674
675 ::fidl_next::WireTable::decode_with(table, decoder, |ordinal, mut slot, decoder| {
676 match ordinal {
677 0 => unsafe { ::core::hint::unreachable_unchecked() },
678
679 1 => {
680 ::fidl_next::WireEnvelope::decode_as::<
681 ___D,
682 ::fidl_next::WireVector<'static, crate::wire::DictionaryEntry<'static>>,
683 >(slot.as_mut(), decoder, (1024, ()))?;
684
685 let value = unsafe {
686 slot
687 .deref_unchecked()
688 .deref_unchecked::<
689 ::fidl_next::WireVector<'_, crate::wire::DictionaryEntry<'_>>
690 >()
691 };
692
693 if value.len() > 1024 {
694 return Err(::fidl_next::DecodeError::VectorTooLong {
695 size: value.len() as u64,
696 limit: 1024,
697 });
698 }
699
700 Ok(())
701 }
702
703 _ => ::fidl_next::WireEnvelope::decode_unknown(slot, decoder),
704 }
705 })
706 }
707 }
708
709 impl<'de> Dictionary<'de> {
710 pub fn entries(
711 &self,
712 ) -> ::core::option::Option<&::fidl_next::WireVector<'de, crate::wire::DictionaryEntry<'de>>>
713 {
714 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
715 }
716 }
717
718 impl<'de> ::core::fmt::Debug for Dictionary<'de> {
719 fn fmt(
720 &self,
721 f: &mut ::core::fmt::Formatter<'_>,
722 ) -> ::core::result::Result<(), ::core::fmt::Error> {
723 f.debug_struct("Dictionary").field("entries", &self.entries()).finish()
724 }
725 }
726
727 impl<'de> ::fidl_next::IntoNatural for Dictionary<'de> {
728 type Natural = crate::natural::Dictionary;
729 }
730
731 impl ::fidl_next::Unconstrained for Dictionary<'_> {}
732
733 #[repr(transparent)]
735 pub struct DictionaryValue<'de> {
736 pub(crate) raw: ::fidl_next::RawWireUnion,
737 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
738 }
739
740 impl<'de> Drop for DictionaryValue<'de> {
741 fn drop(&mut self) {
742 match self.raw.ordinal() {
743 1 => {
744 let _ =
745 unsafe { self.raw.get().read_unchecked::<::fidl_next::WireString<'de>>() };
746 }
747
748 2 => {
749 let _ = unsafe {
750 self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>>()
751 };
752 }
753
754 3 => {
755 let _ = unsafe {
756 self.raw.get().read_unchecked::<::fidl_next::WireVector<'de, crate::wire::Dictionary<'de>>>()
757 };
758 }
759
760 _ => (),
761 }
762 }
763 }
764
765 unsafe impl ::fidl_next::Wire for DictionaryValue<'static> {
766 type Decoded<'de> = DictionaryValue<'de>;
767
768 #[inline]
769 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
770 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
771 ::fidl_next::RawWireUnion::zero_padding(raw);
772 }
773 }
774
775 pub mod dictionary_value {
776 pub enum Ref<'de> {
777 Str(&'de ::fidl_next::WireString<'de>),
778
779 StrVec(&'de ::fidl_next::WireVector<'de, ::fidl_next::WireString<'de>>),
780
781 ObjVec(&'de ::fidl_next::WireVector<'de, crate::wire::Dictionary<'de>>),
782
783 UnknownOrdinal_(u64),
784 }
785 }
786
787 impl<'de> DictionaryValue<'de> {
788 pub fn as_ref(&self) -> crate::wire::dictionary_value::Ref<'_> {
789 match self.raw.ordinal() {
790 1 => crate::wire::dictionary_value::Ref::Str(unsafe {
791 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>()
792 }),
793
794 2 => crate::wire::dictionary_value::Ref::StrVec(unsafe {
795 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>>()
796 }),
797
798 3 => crate::wire::dictionary_value::Ref::ObjVec(unsafe {
799 self.raw.get().deref_unchecked::<::fidl_next::WireVector<'_, crate::wire::Dictionary<'_>>>()
800 }),
801
802 unknown => crate::wire::dictionary_value::Ref::UnknownOrdinal_(unknown),
803 }
804 }
805 }
806
807 unsafe impl<___D> ::fidl_next::Decode<___D> for DictionaryValue<'static>
808 where
809 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
810 ___D: ::fidl_next::Decoder,
811 {
812 fn decode(
813 mut slot: ::fidl_next::Slot<'_, Self>,
814 decoder: &mut ___D,
815 _: (),
816 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
817 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
818 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
819 1 => {
820 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
821 raw, decoder, 32768,
822 )?
823 }
824
825 2 => ::fidl_next::RawWireUnion::decode_as::<
826 ___D,
827 ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
828 >(raw, decoder, (1024, 32768))?,
829
830 3 => ::fidl_next::RawWireUnion::decode_as::<
831 ___D,
832 ::fidl_next::WireVector<'static, crate::wire::Dictionary<'static>>,
833 >(raw, decoder, (1024, ()))?,
834
835 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
836 }
837
838 Ok(())
839 }
840 }
841
842 impl<'de> ::core::fmt::Debug for DictionaryValue<'de> {
843 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
844 match self.raw.ordinal() {
845 1 => unsafe {
846 self.raw.get().deref_unchecked::<::fidl_next::WireString<'_>>().fmt(f)
847 },
848 2 => unsafe {
849 self.raw.get().deref_unchecked::<
850 ::fidl_next::WireVector<'_, ::fidl_next::WireString<'_>>
851 >().fmt(f)
852 },
853 3 => unsafe {
854 self.raw.get().deref_unchecked::<
855 ::fidl_next::WireVector<'_, crate::wire::Dictionary<'_>>
856 >().fmt(f)
857 },
858 _ => unsafe { ::core::hint::unreachable_unchecked() },
859 }
860 }
861 }
862
863 impl<'de> ::fidl_next::IntoNatural for DictionaryValue<'de> {
864 type Natural = crate::natural::DictionaryValue;
865 }
866
867 impl ::fidl_next::Unconstrained for DictionaryValue<'static> {}
868}
869
870pub mod wire_optional {
871
872 #[repr(transparent)]
873 pub struct DictionaryValue<'de> {
874 pub(crate) raw: ::fidl_next::RawWireUnion,
875 pub(crate) _phantom: ::core::marker::PhantomData<&'de mut [::fidl_next::Chunk]>,
876 }
877
878 unsafe impl ::fidl_next::Wire for DictionaryValue<'static> {
879 type Decoded<'de> = DictionaryValue<'de>;
880
881 #[inline]
882 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
883 ::fidl_next::munge!(let Self { raw, _phantom: _ } = out);
884 ::fidl_next::RawWireUnion::zero_padding(raw);
885 }
886 }
887
888 impl<'de> DictionaryValue<'de> {
889 pub fn is_some(&self) -> bool {
890 self.raw.is_some()
891 }
892
893 pub fn is_none(&self) -> bool {
894 self.raw.is_none()
895 }
896
897 pub fn as_ref(&self) -> ::core::option::Option<&crate::wire::DictionaryValue<'de>> {
898 if self.is_some() { Some(unsafe { &*(self as *const Self).cast() }) } else { None }
899 }
900
901 pub fn into_option(self) -> ::core::option::Option<crate::wire::DictionaryValue<'de>> {
902 if self.is_some() {
903 Some(crate::wire::DictionaryValue {
904 raw: self.raw,
905 _phantom: ::core::marker::PhantomData,
906 })
907 } else {
908 None
909 }
910 }
911 }
912
913 unsafe impl<___D> ::fidl_next::Decode<___D> for DictionaryValue<'static>
914 where
915 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
916 ___D: ::fidl_next::Decoder,
917 {
918 fn decode(
919 mut slot: ::fidl_next::Slot<'_, Self>,
920 decoder: &mut ___D,
921 _: (),
922 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
923 ::fidl_next::munge!(let Self { mut raw, _phantom: _ } = slot.as_mut());
924 match ::fidl_next::RawWireUnion::encoded_ordinal(raw.as_mut()) {
925 1 => {
926 ::fidl_next::RawWireUnion::decode_as::<___D, ::fidl_next::WireString<'static>>(
927 raw, decoder, 32768,
928 )?
929 }
930
931 2 => ::fidl_next::RawWireUnion::decode_as::<
932 ___D,
933 ::fidl_next::WireVector<'static, ::fidl_next::WireString<'static>>,
934 >(raw, decoder, (1024, 32768))?,
935
936 3 => ::fidl_next::RawWireUnion::decode_as::<
937 ___D,
938 ::fidl_next::WireVector<'static, crate::wire::Dictionary<'static>>,
939 >(raw, decoder, (1024, ()))?,
940
941 0 => ::fidl_next::RawWireUnion::decode_absent(raw)?,
942 _ => ::fidl_next::RawWireUnion::decode_unknown(raw, decoder)?,
943 }
944
945 Ok(())
946 }
947 }
948
949 impl<'de> ::core::fmt::Debug for DictionaryValue<'de> {
950 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
951 self.as_ref().fmt(f)
952 }
953 }
954
955 impl<'de> ::fidl_next::IntoNatural for DictionaryValue<'de> {
956 type Natural = ::core::option::Option<crate::natural::DictionaryValue>;
957 }
958
959 impl ::fidl_next::Unconstrained for DictionaryValue<'static> {}
960}
961
962pub mod generic {
963
964 pub struct DictionaryEntry<T0, T1> {
965 pub key: T0,
966
967 pub value: T1,
968 }
969
970 impl<T0, T1> ::fidl_next::Encodable for DictionaryEntry<T0, T1>
971 where
972 T0: ::fidl_next::Encodable<Encoded = ::fidl_next::WireString<'static>>,
973 T1: ::fidl_next::Encodable<Encoded = crate::wire_optional::DictionaryValue<'static>>,
974 {
975 type Encoded = crate::wire::DictionaryEntry<'static>;
976 }
977
978 unsafe impl<___E, T0, T1> ::fidl_next::Encode<___E> for DictionaryEntry<T0, T1>
979 where
980 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
981 ___E: ::fidl_next::Encoder,
982 T0: ::fidl_next::Encode<___E, Encoded = ::fidl_next::WireString<'static>>,
983 T1: ::fidl_next::Encode<___E, Encoded = crate::wire_optional::DictionaryValue<'static>>,
984 {
985 #[inline]
986 fn encode(
987 self,
988 encoder_: &mut ___E,
989 out_: &mut ::core::mem::MaybeUninit<Self::Encoded>,
990 _: (),
991 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
992 ::fidl_next::munge! {
993 let Self::Encoded {
994
995 key,
996 value,
997
998 } = out_;
999 }
1000
1001 ::fidl_next::Encode::encode(self.key, encoder_, key, 1024)?;
1002
1003 ::fidl_next::Encode::encode(self.value, encoder_, value, ())?;
1004
1005 Ok(())
1006 }
1007 }
1008}
1009
1010pub use self::natural::*;
1011
1012pub const MAX_KEY_LENGTH: u32 = 1024 as u32;
1013
1014pub const MAX_NUM_ENTRIES: u32 = 1024 as u32;
1015
1016pub const MAX_NUM_VALUE_ITEMS: u32 = 1024 as u32;
1017
1018pub const MAX_VALUE_LENGTH: u32 = 32768 as u32;
1019
1020pub mod compat {
1022
1023 impl ::fidl_next::CompatFrom<crate::DictionaryEntry> for ::fidl_fuchsia_data::DictionaryEntry {
1024 #[inline]
1025 fn compat_from(value: crate::DictionaryEntry) -> Self {
1026 Self {
1027 key: ::fidl_next::CompatFrom::compat_from(value.key),
1028
1029 value: ::fidl_next::CompatFrom::compat_from(value.value),
1030 }
1031 }
1032 }
1033
1034 impl ::fidl_next::CompatFrom<::fidl_fuchsia_data::DictionaryEntry> for crate::DictionaryEntry {
1035 #[inline]
1036 fn compat_from(value: ::fidl_fuchsia_data::DictionaryEntry) -> Self {
1037 Self {
1038 key: ::fidl_next::CompatFrom::compat_from(value.key),
1039
1040 value: ::fidl_next::CompatFrom::compat_from(value.value),
1041 }
1042 }
1043 }
1044
1045 impl ::fidl_next::CompatFrom<crate::Dictionary> for ::fidl_fuchsia_data::Dictionary {
1046 fn compat_from(value: crate::Dictionary) -> Self {
1047 Self {
1048 entries: ::fidl_next::CompatFrom::compat_from(value.entries),
1049
1050 __source_breaking: ::fidl::marker::SourceBreaking,
1051 }
1052 }
1053 }
1054
1055 impl ::fidl_next::CompatFrom<::fidl_fuchsia_data::Dictionary> for crate::Dictionary {
1056 fn compat_from(value: ::fidl_fuchsia_data::Dictionary) -> Self {
1057 Self { entries: ::fidl_next::CompatFrom::compat_from(value.entries) }
1058 }
1059 }
1060
1061 impl ::fidl_next::CompatFrom<crate::DictionaryValue> for ::fidl_fuchsia_data::DictionaryValue {
1062 fn compat_from(value: crate::DictionaryValue) -> Self {
1063 match value {
1064 crate::DictionaryValue::Str(value) => {
1065 Self::Str(::fidl_next::CompatFrom::compat_from(value))
1066 }
1067
1068 crate::DictionaryValue::StrVec(value) => {
1069 Self::StrVec(::fidl_next::CompatFrom::compat_from(value))
1070 }
1071
1072 crate::DictionaryValue::ObjVec(value) => {
1073 Self::ObjVec(::fidl_next::CompatFrom::compat_from(value))
1074 }
1075
1076 crate::DictionaryValue::UnknownOrdinal_(unknown_ordinal) => {
1077 Self::__SourceBreaking { unknown_ordinal }
1078 }
1079 }
1080 }
1081 }
1082
1083 impl ::fidl_next::CompatFrom<::fidl_fuchsia_data::DictionaryValue> for crate::DictionaryValue {
1084 fn compat_from(value: ::fidl_fuchsia_data::DictionaryValue) -> Self {
1085 match value {
1086 ::fidl_fuchsia_data::DictionaryValue::Str(value) => {
1087 Self::Str(::fidl_next::CompatFrom::compat_from(value))
1088 }
1089
1090 ::fidl_fuchsia_data::DictionaryValue::StrVec(value) => {
1091 Self::StrVec(::fidl_next::CompatFrom::compat_from(value))
1092 }
1093
1094 ::fidl_fuchsia_data::DictionaryValue::ObjVec(value) => {
1095 Self::ObjVec(::fidl_next::CompatFrom::compat_from(value))
1096 }
1097
1098 ::fidl_fuchsia_data::DictionaryValue::__SourceBreaking { unknown_ordinal } => {
1099 Self::UnknownOrdinal_(unknown_ordinal)
1100 }
1101 }
1102 }
1103 }
1104}