1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 pub use fidl_next_common_fuchsia_sysmem2::natural::*;
8
9 #[derive(Debug, Default, PartialEq)]
10 pub struct AllocatorAllocateNonSharedCollectionRequest {
11 pub collection_request: ::core::option::Option<
12 ::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::fuchsia::zx::Channel>,
13 >,
14 }
15
16 impl AllocatorAllocateNonSharedCollectionRequest {
17 fn __max_ordinal(&self) -> usize {
18 if self.collection_request.is_some() {
19 return 1;
20 }
21
22 0
23 }
24 }
25
26 unsafe impl<___E>
27 ::fidl_next::Encode<crate::wire::AllocatorAllocateNonSharedCollectionRequest<'static>, ___E>
28 for AllocatorAllocateNonSharedCollectionRequest
29 where
30 ___E: ::fidl_next::Encoder + ?Sized,
31 ___E: ::fidl_next::fuchsia::HandleEncoder,
32 {
33 #[inline]
34 fn encode(
35 mut self,
36 encoder: &mut ___E,
37 out: &mut ::core::mem::MaybeUninit<
38 crate::wire::AllocatorAllocateNonSharedCollectionRequest<'static>,
39 >,
40 _: (),
41 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
42 ::fidl_next::munge!(let crate::wire::AllocatorAllocateNonSharedCollectionRequest { table } = out);
43
44 let max_ord = self.__max_ordinal();
45
46 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
47 ::fidl_next::Wire::zero_padding(&mut out);
48
49 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
50 ::fidl_next::wire::Envelope,
51 >(encoder, max_ord);
52
53 for i in 1..=max_ord {
54 match i {
55 1 => {
56 if let Some(value) = self.collection_request.take() {
57 ::fidl_next::wire::Envelope::encode_value::<
58 ::fidl_next::ServerEnd<
59 crate::BufferCollection,
60 ::fidl_next::wire::fuchsia::Channel,
61 >,
62 ___E,
63 >(
64 value, preallocated.encoder, &mut out, ()
65 )?;
66 } else {
67 ::fidl_next::wire::Envelope::encode_zero(&mut out)
68 }
69 }
70
71 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
72 }
73 unsafe {
74 preallocated.write_next(out.assume_init_ref());
75 }
76 }
77
78 ::fidl_next::wire::Table::encode_len(table, max_ord);
79
80 Ok(())
81 }
82 }
83
84 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorAllocateNonSharedCollectionRequest<'de>>
85 for AllocatorAllocateNonSharedCollectionRequest
86 {
87 #[inline]
88 fn from_wire(wire_: crate::wire::AllocatorAllocateNonSharedCollectionRequest<'de>) -> Self {
89 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
90
91 let collection_request = wire_.table.get(1);
92
93 Self {
94 collection_request: collection_request.map(|envelope| {
95 ::fidl_next::FromWire::from_wire(unsafe {
96 envelope.read_unchecked::<::fidl_next::ServerEnd<
97 crate::BufferCollection,
98 ::fidl_next::wire::fuchsia::Channel,
99 >>()
100 })
101 }),
102 }
103 }
104 }
105
106 #[derive(Debug, Default, PartialEq)]
107 pub struct AllocatorAllocateSharedCollectionRequest {
108 pub token_request: ::core::option::Option<
109 ::fidl_next::ServerEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
110 >,
111 }
112
113 impl AllocatorAllocateSharedCollectionRequest {
114 fn __max_ordinal(&self) -> usize {
115 if self.token_request.is_some() {
116 return 1;
117 }
118
119 0
120 }
121 }
122
123 unsafe impl<___E>
124 ::fidl_next::Encode<crate::wire::AllocatorAllocateSharedCollectionRequest<'static>, ___E>
125 for AllocatorAllocateSharedCollectionRequest
126 where
127 ___E: ::fidl_next::Encoder + ?Sized,
128 ___E: ::fidl_next::fuchsia::HandleEncoder,
129 {
130 #[inline]
131 fn encode(
132 mut self,
133 encoder: &mut ___E,
134 out: &mut ::core::mem::MaybeUninit<
135 crate::wire::AllocatorAllocateSharedCollectionRequest<'static>,
136 >,
137 _: (),
138 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
139 ::fidl_next::munge!(let crate::wire::AllocatorAllocateSharedCollectionRequest { table } = out);
140
141 let max_ord = self.__max_ordinal();
142
143 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
144 ::fidl_next::Wire::zero_padding(&mut out);
145
146 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
147 ::fidl_next::wire::Envelope,
148 >(encoder, max_ord);
149
150 for i in 1..=max_ord {
151 match i {
152 1 => {
153 if let Some(value) = self.token_request.take() {
154 ::fidl_next::wire::Envelope::encode_value::<
155 ::fidl_next::ServerEnd<
156 crate::BufferCollectionToken,
157 ::fidl_next::wire::fuchsia::Channel,
158 >,
159 ___E,
160 >(
161 value, preallocated.encoder, &mut out, ()
162 )?;
163 } else {
164 ::fidl_next::wire::Envelope::encode_zero(&mut out)
165 }
166 }
167
168 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
169 }
170 unsafe {
171 preallocated.write_next(out.assume_init_ref());
172 }
173 }
174
175 ::fidl_next::wire::Table::encode_len(table, max_ord);
176
177 Ok(())
178 }
179 }
180
181 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorAllocateSharedCollectionRequest<'de>>
182 for AllocatorAllocateSharedCollectionRequest
183 {
184 #[inline]
185 fn from_wire(wire_: crate::wire::AllocatorAllocateSharedCollectionRequest<'de>) -> Self {
186 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
187
188 let token_request = wire_.table.get(1);
189
190 Self {
191 token_request: token_request.map(|envelope| {
192 ::fidl_next::FromWire::from_wire(unsafe {
193 envelope.read_unchecked::<::fidl_next::ServerEnd<
194 crate::BufferCollectionToken,
195 ::fidl_next::wire::fuchsia::Channel,
196 >>()
197 })
198 }),
199 }
200 }
201 }
202
203 #[derive(Debug, Default, PartialEq)]
204 pub struct AllocatorBindSharedCollectionRequest {
205 pub token: ::core::option::Option<
206 ::fidl_next::ClientEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
207 >,
208
209 pub buffer_collection_request: ::core::option::Option<
210 ::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::fuchsia::zx::Channel>,
211 >,
212 }
213
214 impl AllocatorBindSharedCollectionRequest {
215 fn __max_ordinal(&self) -> usize {
216 if self.buffer_collection_request.is_some() {
217 return 2;
218 }
219
220 if self.token.is_some() {
221 return 1;
222 }
223
224 0
225 }
226 }
227
228 unsafe impl<___E>
229 ::fidl_next::Encode<crate::wire::AllocatorBindSharedCollectionRequest<'static>, ___E>
230 for AllocatorBindSharedCollectionRequest
231 where
232 ___E: ::fidl_next::Encoder + ?Sized,
233 ___E: ::fidl_next::fuchsia::HandleEncoder,
234 {
235 #[inline]
236 fn encode(
237 mut self,
238 encoder: &mut ___E,
239 out: &mut ::core::mem::MaybeUninit<
240 crate::wire::AllocatorBindSharedCollectionRequest<'static>,
241 >,
242 _: (),
243 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
244 ::fidl_next::munge!(let crate::wire::AllocatorBindSharedCollectionRequest { table } = out);
245
246 let max_ord = self.__max_ordinal();
247
248 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
249 ::fidl_next::Wire::zero_padding(&mut out);
250
251 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
252 ::fidl_next::wire::Envelope,
253 >(encoder, max_ord);
254
255 for i in 1..=max_ord {
256 match i {
257 2 => {
258 if let Some(value) = self.buffer_collection_request.take() {
259 ::fidl_next::wire::Envelope::encode_value::<
260 ::fidl_next::ServerEnd<
261 crate::BufferCollection,
262 ::fidl_next::wire::fuchsia::Channel,
263 >,
264 ___E,
265 >(
266 value, preallocated.encoder, &mut out, ()
267 )?;
268 } else {
269 ::fidl_next::wire::Envelope::encode_zero(&mut out)
270 }
271 }
272
273 1 => {
274 if let Some(value) = self.token.take() {
275 ::fidl_next::wire::Envelope::encode_value::<
276 ::fidl_next::ClientEnd<
277 crate::BufferCollectionToken,
278 ::fidl_next::wire::fuchsia::Channel,
279 >,
280 ___E,
281 >(
282 value, preallocated.encoder, &mut out, ()
283 )?;
284 } else {
285 ::fidl_next::wire::Envelope::encode_zero(&mut out)
286 }
287 }
288
289 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
290 }
291 unsafe {
292 preallocated.write_next(out.assume_init_ref());
293 }
294 }
295
296 ::fidl_next::wire::Table::encode_len(table, max_ord);
297
298 Ok(())
299 }
300 }
301
302 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorBindSharedCollectionRequest<'de>>
303 for AllocatorBindSharedCollectionRequest
304 {
305 #[inline]
306 fn from_wire(wire_: crate::wire::AllocatorBindSharedCollectionRequest<'de>) -> Self {
307 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
308
309 let token = wire_.table.get(1);
310
311 let buffer_collection_request = wire_.table.get(2);
312
313 Self {
314 token: token.map(|envelope| {
315 ::fidl_next::FromWire::from_wire(unsafe {
316 envelope.read_unchecked::<::fidl_next::ClientEnd<
317 crate::BufferCollectionToken,
318 ::fidl_next::wire::fuchsia::Channel,
319 >>()
320 })
321 }),
322
323 buffer_collection_request: buffer_collection_request.map(|envelope| {
324 ::fidl_next::FromWire::from_wire(unsafe {
325 envelope.read_unchecked::<::fidl_next::ServerEnd<
326 crate::BufferCollection,
327 ::fidl_next::wire::fuchsia::Channel,
328 >>()
329 })
330 }),
331 }
332 }
333 }
334
335 #[derive(Debug, Default, PartialEq)]
336 pub struct AllocatorGetVmoInfoRequest {
337 pub vmo: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
338
339 pub need_weak: ::core::option::Option<bool>,
340
341 pub need_single_buffer_settings: ::core::option::Option<bool>,
342
343 pub constraints_to_check:
344 ::core::option::Option<crate::natural::BufferCollectionConstraints>,
345
346 pub vmo_settings_to_check: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
347
348 pub vmo_settings_to_check_ignore_size: ::core::option::Option<bool>,
349 }
350
351 impl AllocatorGetVmoInfoRequest {
352 fn __max_ordinal(&self) -> usize {
353 if self.vmo_settings_to_check_ignore_size.is_some() {
354 return 6;
355 }
356
357 if self.vmo_settings_to_check.is_some() {
358 return 5;
359 }
360
361 if self.constraints_to_check.is_some() {
362 return 4;
363 }
364
365 if self.need_single_buffer_settings.is_some() {
366 return 3;
367 }
368
369 if self.need_weak.is_some() {
370 return 2;
371 }
372
373 if self.vmo.is_some() {
374 return 1;
375 }
376
377 0
378 }
379 }
380
381 unsafe impl<___E> ::fidl_next::Encode<crate::wire::AllocatorGetVmoInfoRequest<'static>, ___E>
382 for AllocatorGetVmoInfoRequest
383 where
384 ___E: ::fidl_next::Encoder + ?Sized,
385 ___E: ::fidl_next::fuchsia::HandleEncoder,
386 {
387 #[inline]
388 fn encode(
389 mut self,
390 encoder: &mut ___E,
391 out: &mut ::core::mem::MaybeUninit<crate::wire::AllocatorGetVmoInfoRequest<'static>>,
392 _: (),
393 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
394 ::fidl_next::munge!(let crate::wire::AllocatorGetVmoInfoRequest { table } = out);
395
396 let max_ord = self.__max_ordinal();
397
398 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
399 ::fidl_next::Wire::zero_padding(&mut out);
400
401 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
402 ::fidl_next::wire::Envelope,
403 >(encoder, max_ord);
404
405 for i in 1..=max_ord {
406 match i {
407 6 => {
408 if let Some(value) = self.vmo_settings_to_check_ignore_size.take() {
409 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
410 value,
411 preallocated.encoder,
412 &mut out,
413 (),
414 )?;
415 } else {
416 ::fidl_next::wire::Envelope::encode_zero(&mut out)
417 }
418 }
419
420 5 => {
421 if let Some(value) = self.vmo_settings_to_check.take() {
422 ::fidl_next::wire::Envelope::encode_value::<
423 ::fidl_next::wire::fuchsia::Vmo,
424 ___E,
425 >(
426 value, preallocated.encoder, &mut out, ()
427 )?;
428 } else {
429 ::fidl_next::wire::Envelope::encode_zero(&mut out)
430 }
431 }
432
433 4 => {
434 if let Some(value) = self.constraints_to_check.take() {
435 ::fidl_next::wire::Envelope::encode_value::<
436 crate::wire::BufferCollectionConstraints<'static>,
437 ___E,
438 >(
439 value, preallocated.encoder, &mut out, ()
440 )?;
441 } else {
442 ::fidl_next::wire::Envelope::encode_zero(&mut out)
443 }
444 }
445
446 3 => {
447 if let Some(value) = self.need_single_buffer_settings.take() {
448 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
449 value,
450 preallocated.encoder,
451 &mut out,
452 (),
453 )?;
454 } else {
455 ::fidl_next::wire::Envelope::encode_zero(&mut out)
456 }
457 }
458
459 2 => {
460 if let Some(value) = self.need_weak.take() {
461 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
462 value,
463 preallocated.encoder,
464 &mut out,
465 (),
466 )?;
467 } else {
468 ::fidl_next::wire::Envelope::encode_zero(&mut out)
469 }
470 }
471
472 1 => {
473 if let Some(value) = self.vmo.take() {
474 ::fidl_next::wire::Envelope::encode_value::<
475 ::fidl_next::wire::fuchsia::Vmo,
476 ___E,
477 >(
478 value, preallocated.encoder, &mut out, ()
479 )?;
480 } else {
481 ::fidl_next::wire::Envelope::encode_zero(&mut out)
482 }
483 }
484
485 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
486 }
487 unsafe {
488 preallocated.write_next(out.assume_init_ref());
489 }
490 }
491
492 ::fidl_next::wire::Table::encode_len(table, max_ord);
493
494 Ok(())
495 }
496 }
497
498 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorGetVmoInfoRequest<'de>>
499 for AllocatorGetVmoInfoRequest
500 {
501 #[inline]
502 fn from_wire(wire_: crate::wire::AllocatorGetVmoInfoRequest<'de>) -> Self {
503 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
504
505 let vmo = wire_.table.get(1);
506
507 let need_weak = wire_.table.get(2);
508
509 let need_single_buffer_settings = wire_.table.get(3);
510
511 let constraints_to_check = wire_.table.get(4);
512
513 let vmo_settings_to_check = wire_.table.get(5);
514
515 let vmo_settings_to_check_ignore_size = wire_.table.get(6);
516
517 Self {
518 vmo: vmo.map(|envelope| {
519 ::fidl_next::FromWire::from_wire(unsafe {
520 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
521 })
522 }),
523
524 need_weak: need_weak.map(|envelope| {
525 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
526 }),
527
528 need_single_buffer_settings: need_single_buffer_settings.map(|envelope| {
529 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
530 }),
531
532 constraints_to_check: constraints_to_check.map(|envelope| {
533 ::fidl_next::FromWire::from_wire(unsafe {
534 envelope.read_unchecked::<crate::wire::BufferCollectionConstraints<'de>>()
535 })
536 }),
537
538 vmo_settings_to_check: vmo_settings_to_check.map(|envelope| {
539 ::fidl_next::FromWire::from_wire(unsafe {
540 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
541 })
542 }),
543
544 vmo_settings_to_check_ignore_size: vmo_settings_to_check_ignore_size.map(
545 |envelope| {
546 ::fidl_next::FromWire::from_wire(unsafe {
547 envelope.read_unchecked::<bool>()
548 })
549 },
550 ),
551 }
552 }
553 }
554
555 #[derive(Debug, Default, PartialEq)]
556 pub struct AllocatorGetVmoInfoResponse {
557 pub buffer_collection_id: ::core::option::Option<u64>,
558
559 pub buffer_index: ::core::option::Option<u64>,
560
561 pub close_weak_asap: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
562
563 pub weak_vmo: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
564
565 pub single_buffer_settings: ::core::option::Option<crate::natural::SingleBufferSettings>,
566
567 pub constraints_ok: ::core::option::Option<bool>,
568
569 pub vmo_settings_match: ::core::option::Option<bool>,
570 }
571
572 impl AllocatorGetVmoInfoResponse {
573 fn __max_ordinal(&self) -> usize {
574 if self.vmo_settings_match.is_some() {
575 return 7;
576 }
577
578 if self.constraints_ok.is_some() {
579 return 6;
580 }
581
582 if self.single_buffer_settings.is_some() {
583 return 5;
584 }
585
586 if self.weak_vmo.is_some() {
587 return 4;
588 }
589
590 if self.close_weak_asap.is_some() {
591 return 3;
592 }
593
594 if self.buffer_index.is_some() {
595 return 2;
596 }
597
598 if self.buffer_collection_id.is_some() {
599 return 1;
600 }
601
602 0
603 }
604 }
605
606 unsafe impl<___E> ::fidl_next::Encode<crate::wire::AllocatorGetVmoInfoResponse<'static>, ___E>
607 for AllocatorGetVmoInfoResponse
608 where
609 ___E: ::fidl_next::Encoder + ?Sized,
610 ___E: ::fidl_next::fuchsia::HandleEncoder,
611 {
612 #[inline]
613 fn encode(
614 mut self,
615 encoder: &mut ___E,
616 out: &mut ::core::mem::MaybeUninit<crate::wire::AllocatorGetVmoInfoResponse<'static>>,
617 _: (),
618 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
619 ::fidl_next::munge!(let crate::wire::AllocatorGetVmoInfoResponse { table } = out);
620
621 let max_ord = self.__max_ordinal();
622
623 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
624 ::fidl_next::Wire::zero_padding(&mut out);
625
626 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
627 ::fidl_next::wire::Envelope,
628 >(encoder, max_ord);
629
630 for i in 1..=max_ord {
631 match i {
632 7 => {
633 if let Some(value) = self.vmo_settings_match.take() {
634 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
635 value,
636 preallocated.encoder,
637 &mut out,
638 (),
639 )?;
640 } else {
641 ::fidl_next::wire::Envelope::encode_zero(&mut out)
642 }
643 }
644
645 6 => {
646 if let Some(value) = self.constraints_ok.take() {
647 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
648 value,
649 preallocated.encoder,
650 &mut out,
651 (),
652 )?;
653 } else {
654 ::fidl_next::wire::Envelope::encode_zero(&mut out)
655 }
656 }
657
658 5 => {
659 if let Some(value) = self.single_buffer_settings.take() {
660 ::fidl_next::wire::Envelope::encode_value::<
661 crate::wire::SingleBufferSettings<'static>,
662 ___E,
663 >(
664 value, preallocated.encoder, &mut out, ()
665 )?;
666 } else {
667 ::fidl_next::wire::Envelope::encode_zero(&mut out)
668 }
669 }
670
671 4 => {
672 if let Some(value) = self.weak_vmo.take() {
673 ::fidl_next::wire::Envelope::encode_value::<
674 ::fidl_next::wire::fuchsia::Vmo,
675 ___E,
676 >(
677 value, preallocated.encoder, &mut out, ()
678 )?;
679 } else {
680 ::fidl_next::wire::Envelope::encode_zero(&mut out)
681 }
682 }
683
684 3 => {
685 if let Some(value) = self.close_weak_asap.take() {
686 ::fidl_next::wire::Envelope::encode_value::<
687 ::fidl_next::wire::fuchsia::EventPair,
688 ___E,
689 >(
690 value, preallocated.encoder, &mut out, ()
691 )?;
692 } else {
693 ::fidl_next::wire::Envelope::encode_zero(&mut out)
694 }
695 }
696
697 2 => {
698 if let Some(value) = self.buffer_index.take() {
699 ::fidl_next::wire::Envelope::encode_value::<
700 ::fidl_next::wire::Uint64,
701 ___E,
702 >(
703 value, preallocated.encoder, &mut out, ()
704 )?;
705 } else {
706 ::fidl_next::wire::Envelope::encode_zero(&mut out)
707 }
708 }
709
710 1 => {
711 if let Some(value) = self.buffer_collection_id.take() {
712 ::fidl_next::wire::Envelope::encode_value::<
713 ::fidl_next::wire::Uint64,
714 ___E,
715 >(
716 value, preallocated.encoder, &mut out, ()
717 )?;
718 } else {
719 ::fidl_next::wire::Envelope::encode_zero(&mut out)
720 }
721 }
722
723 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
724 }
725 unsafe {
726 preallocated.write_next(out.assume_init_ref());
727 }
728 }
729
730 ::fidl_next::wire::Table::encode_len(table, max_ord);
731
732 Ok(())
733 }
734 }
735
736 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorGetVmoInfoResponse<'de>>
737 for AllocatorGetVmoInfoResponse
738 {
739 #[inline]
740 fn from_wire(wire_: crate::wire::AllocatorGetVmoInfoResponse<'de>) -> Self {
741 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
742
743 let buffer_collection_id = wire_.table.get(1);
744
745 let buffer_index = wire_.table.get(2);
746
747 let close_weak_asap = wire_.table.get(3);
748
749 let weak_vmo = wire_.table.get(4);
750
751 let single_buffer_settings = wire_.table.get(5);
752
753 let constraints_ok = wire_.table.get(6);
754
755 let vmo_settings_match = wire_.table.get(7);
756
757 Self {
758 buffer_collection_id: buffer_collection_id.map(|envelope| {
759 ::fidl_next::FromWire::from_wire(unsafe {
760 envelope.read_unchecked::<::fidl_next::wire::Uint64>()
761 })
762 }),
763
764 buffer_index: buffer_index.map(|envelope| {
765 ::fidl_next::FromWire::from_wire(unsafe {
766 envelope.read_unchecked::<::fidl_next::wire::Uint64>()
767 })
768 }),
769
770 close_weak_asap: close_weak_asap.map(|envelope| {
771 ::fidl_next::FromWire::from_wire(unsafe {
772 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
773 })
774 }),
775
776 weak_vmo: weak_vmo.map(|envelope| {
777 ::fidl_next::FromWire::from_wire(unsafe {
778 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
779 })
780 }),
781
782 single_buffer_settings: single_buffer_settings.map(|envelope| {
783 ::fidl_next::FromWire::from_wire(unsafe {
784 envelope.read_unchecked::<crate::wire::SingleBufferSettings<'de>>()
785 })
786 }),
787
788 constraints_ok: constraints_ok.map(|envelope| {
789 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
790 }),
791
792 vmo_settings_match: vmo_settings_match.map(|envelope| {
793 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
794 }),
795 }
796 }
797 }
798
799 #[derive(Debug, Default, PartialEq)]
800 pub struct NodeGetNodeRefResponse {
801 pub node_ref: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
802 }
803
804 impl NodeGetNodeRefResponse {
805 fn __max_ordinal(&self) -> usize {
806 if self.node_ref.is_some() {
807 return 1;
808 }
809
810 0
811 }
812 }
813
814 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeGetNodeRefResponse<'static>, ___E>
815 for NodeGetNodeRefResponse
816 where
817 ___E: ::fidl_next::Encoder + ?Sized,
818 ___E: ::fidl_next::fuchsia::HandleEncoder,
819 {
820 #[inline]
821 fn encode(
822 mut self,
823 encoder: &mut ___E,
824 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeGetNodeRefResponse<'static>>,
825 _: (),
826 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
827 ::fidl_next::munge!(let crate::wire::NodeGetNodeRefResponse { table } = out);
828
829 let max_ord = self.__max_ordinal();
830
831 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
832 ::fidl_next::Wire::zero_padding(&mut out);
833
834 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
835 ::fidl_next::wire::Envelope,
836 >(encoder, max_ord);
837
838 for i in 1..=max_ord {
839 match i {
840 1 => {
841 if let Some(value) = self.node_ref.take() {
842 ::fidl_next::wire::Envelope::encode_value::<
843 ::fidl_next::wire::fuchsia::Event,
844 ___E,
845 >(
846 value, preallocated.encoder, &mut out, ()
847 )?;
848 } else {
849 ::fidl_next::wire::Envelope::encode_zero(&mut out)
850 }
851 }
852
853 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
854 }
855 unsafe {
856 preallocated.write_next(out.assume_init_ref());
857 }
858 }
859
860 ::fidl_next::wire::Table::encode_len(table, max_ord);
861
862 Ok(())
863 }
864 }
865
866 impl<'de> ::fidl_next::FromWire<crate::wire::NodeGetNodeRefResponse<'de>>
867 for NodeGetNodeRefResponse
868 {
869 #[inline]
870 fn from_wire(wire_: crate::wire::NodeGetNodeRefResponse<'de>) -> Self {
871 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
872
873 let node_ref = wire_.table.get(1);
874
875 Self {
876 node_ref: node_ref.map(|envelope| {
877 ::fidl_next::FromWire::from_wire(unsafe {
878 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
879 })
880 }),
881 }
882 }
883 }
884
885 #[derive(Debug, Default, PartialEq)]
886 pub struct NodeIsAlternateForRequest {
887 pub node_ref: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
888 }
889
890 impl NodeIsAlternateForRequest {
891 fn __max_ordinal(&self) -> usize {
892 if self.node_ref.is_some() {
893 return 1;
894 }
895
896 0
897 }
898 }
899
900 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeIsAlternateForRequest<'static>, ___E>
901 for NodeIsAlternateForRequest
902 where
903 ___E: ::fidl_next::Encoder + ?Sized,
904 ___E: ::fidl_next::fuchsia::HandleEncoder,
905 {
906 #[inline]
907 fn encode(
908 mut self,
909 encoder: &mut ___E,
910 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeIsAlternateForRequest<'static>>,
911 _: (),
912 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
913 ::fidl_next::munge!(let crate::wire::NodeIsAlternateForRequest { table } = out);
914
915 let max_ord = self.__max_ordinal();
916
917 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
918 ::fidl_next::Wire::zero_padding(&mut out);
919
920 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
921 ::fidl_next::wire::Envelope,
922 >(encoder, max_ord);
923
924 for i in 1..=max_ord {
925 match i {
926 1 => {
927 if let Some(value) = self.node_ref.take() {
928 ::fidl_next::wire::Envelope::encode_value::<
929 ::fidl_next::wire::fuchsia::Event,
930 ___E,
931 >(
932 value, preallocated.encoder, &mut out, ()
933 )?;
934 } else {
935 ::fidl_next::wire::Envelope::encode_zero(&mut out)
936 }
937 }
938
939 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
940 }
941 unsafe {
942 preallocated.write_next(out.assume_init_ref());
943 }
944 }
945
946 ::fidl_next::wire::Table::encode_len(table, max_ord);
947
948 Ok(())
949 }
950 }
951
952 impl<'de> ::fidl_next::FromWire<crate::wire::NodeIsAlternateForRequest<'de>>
953 for NodeIsAlternateForRequest
954 {
955 #[inline]
956 fn from_wire(wire_: crate::wire::NodeIsAlternateForRequest<'de>) -> Self {
957 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
958
959 let node_ref = wire_.table.get(1);
960
961 Self {
962 node_ref: node_ref.map(|envelope| {
963 ::fidl_next::FromWire::from_wire(unsafe {
964 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
965 })
966 }),
967 }
968 }
969 }
970
971 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
972 pub struct NodeSetWeakOkRequest {
973 pub for_child_nodes_also: ::core::option::Option<bool>,
974 }
975
976 impl NodeSetWeakOkRequest {
977 fn __max_ordinal(&self) -> usize {
978 if self.for_child_nodes_also.is_some() {
979 return 1;
980 }
981
982 0
983 }
984 }
985
986 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeSetWeakOkRequest<'static>, ___E>
987 for NodeSetWeakOkRequest
988 where
989 ___E: ::fidl_next::Encoder + ?Sized,
990 ___E: ::fidl_next::fuchsia::HandleEncoder,
991 {
992 #[inline]
993 fn encode(
994 mut self,
995 encoder: &mut ___E,
996 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeSetWeakOkRequest<'static>>,
997 _: (),
998 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
999 ::fidl_next::munge!(let crate::wire::NodeSetWeakOkRequest { table } = out);
1000
1001 let max_ord = self.__max_ordinal();
1002
1003 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1004 ::fidl_next::Wire::zero_padding(&mut out);
1005
1006 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1007 ::fidl_next::wire::Envelope,
1008 >(encoder, max_ord);
1009
1010 for i in 1..=max_ord {
1011 match i {
1012 1 => {
1013 if let Some(value) = self.for_child_nodes_also.take() {
1014 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
1015 value,
1016 preallocated.encoder,
1017 &mut out,
1018 (),
1019 )?;
1020 } else {
1021 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1022 }
1023 }
1024
1025 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1026 }
1027 unsafe {
1028 preallocated.write_next(out.assume_init_ref());
1029 }
1030 }
1031
1032 ::fidl_next::wire::Table::encode_len(table, max_ord);
1033
1034 Ok(())
1035 }
1036 }
1037
1038 impl<'de> ::fidl_next::FromWire<crate::wire::NodeSetWeakOkRequest<'de>> for NodeSetWeakOkRequest {
1039 #[inline]
1040 fn from_wire(wire_: crate::wire::NodeSetWeakOkRequest<'de>) -> Self {
1041 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1042
1043 let for_child_nodes_also = wire_.table.get(1);
1044
1045 Self {
1046 for_child_nodes_also: for_child_nodes_also.map(|envelope| {
1047 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
1048 }),
1049 }
1050 }
1051 }
1052
1053 #[derive(Debug, Default, PartialEq)]
1054 pub struct VmoBuffer {
1055 pub vmo: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
1056
1057 pub vmo_usable_start: ::core::option::Option<u64>,
1058
1059 pub close_weak_asap: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
1060 }
1061
1062 impl VmoBuffer {
1063 fn __max_ordinal(&self) -> usize {
1064 if self.close_weak_asap.is_some() {
1065 return 3;
1066 }
1067
1068 if self.vmo_usable_start.is_some() {
1069 return 2;
1070 }
1071
1072 if self.vmo.is_some() {
1073 return 1;
1074 }
1075
1076 0
1077 }
1078 }
1079
1080 unsafe impl<___E> ::fidl_next::Encode<crate::wire::VmoBuffer<'static>, ___E> for VmoBuffer
1081 where
1082 ___E: ::fidl_next::Encoder + ?Sized,
1083 ___E: ::fidl_next::fuchsia::HandleEncoder,
1084 {
1085 #[inline]
1086 fn encode(
1087 mut self,
1088 encoder: &mut ___E,
1089 out: &mut ::core::mem::MaybeUninit<crate::wire::VmoBuffer<'static>>,
1090 _: (),
1091 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1092 ::fidl_next::munge!(let crate::wire::VmoBuffer { table } = out);
1093
1094 let max_ord = self.__max_ordinal();
1095
1096 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1097 ::fidl_next::Wire::zero_padding(&mut out);
1098
1099 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1100 ::fidl_next::wire::Envelope,
1101 >(encoder, max_ord);
1102
1103 for i in 1..=max_ord {
1104 match i {
1105 3 => {
1106 if let Some(value) = self.close_weak_asap.take() {
1107 ::fidl_next::wire::Envelope::encode_value::<
1108 ::fidl_next::wire::fuchsia::EventPair,
1109 ___E,
1110 >(
1111 value, preallocated.encoder, &mut out, ()
1112 )?;
1113 } else {
1114 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1115 }
1116 }
1117
1118 2 => {
1119 if let Some(value) = self.vmo_usable_start.take() {
1120 ::fidl_next::wire::Envelope::encode_value::<
1121 ::fidl_next::wire::Uint64,
1122 ___E,
1123 >(
1124 value, preallocated.encoder, &mut out, ()
1125 )?;
1126 } else {
1127 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1128 }
1129 }
1130
1131 1 => {
1132 if let Some(value) = self.vmo.take() {
1133 ::fidl_next::wire::Envelope::encode_value::<
1134 ::fidl_next::wire::fuchsia::Vmo,
1135 ___E,
1136 >(
1137 value, preallocated.encoder, &mut out, ()
1138 )?;
1139 } else {
1140 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1141 }
1142 }
1143
1144 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1145 }
1146 unsafe {
1147 preallocated.write_next(out.assume_init_ref());
1148 }
1149 }
1150
1151 ::fidl_next::wire::Table::encode_len(table, max_ord);
1152
1153 Ok(())
1154 }
1155 }
1156
1157 impl<'de> ::fidl_next::FromWire<crate::wire::VmoBuffer<'de>> for VmoBuffer {
1158 #[inline]
1159 fn from_wire(wire_: crate::wire::VmoBuffer<'de>) -> Self {
1160 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1161
1162 let vmo = wire_.table.get(1);
1163
1164 let vmo_usable_start = wire_.table.get(2);
1165
1166 let close_weak_asap = wire_.table.get(3);
1167
1168 Self {
1169 vmo: vmo.map(|envelope| {
1170 ::fidl_next::FromWire::from_wire(unsafe {
1171 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
1172 })
1173 }),
1174
1175 vmo_usable_start: vmo_usable_start.map(|envelope| {
1176 ::fidl_next::FromWire::from_wire(unsafe {
1177 envelope.read_unchecked::<::fidl_next::wire::Uint64>()
1178 })
1179 }),
1180
1181 close_weak_asap: close_weak_asap.map(|envelope| {
1182 ::fidl_next::FromWire::from_wire(unsafe {
1183 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
1184 })
1185 }),
1186 }
1187 }
1188 }
1189
1190 #[derive(Debug, Default, PartialEq)]
1191 pub struct BufferCollectionAttachLifetimeTrackingRequest {
1192 pub server_end: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
1193
1194 pub buffers_remaining: ::core::option::Option<u32>,
1195 }
1196
1197 impl BufferCollectionAttachLifetimeTrackingRequest {
1198 fn __max_ordinal(&self) -> usize {
1199 if self.buffers_remaining.is_some() {
1200 return 2;
1201 }
1202
1203 if self.server_end.is_some() {
1204 return 1;
1205 }
1206
1207 0
1208 }
1209 }
1210
1211 unsafe impl<___E>
1212 ::fidl_next::Encode<
1213 crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'static>,
1214 ___E,
1215 > for BufferCollectionAttachLifetimeTrackingRequest
1216 where
1217 ___E: ::fidl_next::Encoder + ?Sized,
1218 ___E: ::fidl_next::fuchsia::HandleEncoder,
1219 {
1220 #[inline]
1221 fn encode(
1222 mut self,
1223 encoder: &mut ___E,
1224 out: &mut ::core::mem::MaybeUninit<
1225 crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'static>,
1226 >,
1227 _: (),
1228 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1229 ::fidl_next::munge!(let crate::wire::BufferCollectionAttachLifetimeTrackingRequest { table } = out);
1230
1231 let max_ord = self.__max_ordinal();
1232
1233 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1234 ::fidl_next::Wire::zero_padding(&mut out);
1235
1236 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1237 ::fidl_next::wire::Envelope,
1238 >(encoder, max_ord);
1239
1240 for i in 1..=max_ord {
1241 match i {
1242 2 => {
1243 if let Some(value) = self.buffers_remaining.take() {
1244 ::fidl_next::wire::Envelope::encode_value::<
1245 ::fidl_next::wire::Uint32,
1246 ___E,
1247 >(
1248 value, preallocated.encoder, &mut out, ()
1249 )?;
1250 } else {
1251 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1252 }
1253 }
1254
1255 1 => {
1256 if let Some(value) = self.server_end.take() {
1257 ::fidl_next::wire::Envelope::encode_value::<
1258 ::fidl_next::wire::fuchsia::EventPair,
1259 ___E,
1260 >(
1261 value, preallocated.encoder, &mut out, ()
1262 )?;
1263 } else {
1264 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1265 }
1266 }
1267
1268 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1269 }
1270 unsafe {
1271 preallocated.write_next(out.assume_init_ref());
1272 }
1273 }
1274
1275 ::fidl_next::wire::Table::encode_len(table, max_ord);
1276
1277 Ok(())
1278 }
1279 }
1280
1281 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'de>>
1282 for BufferCollectionAttachLifetimeTrackingRequest
1283 {
1284 #[inline]
1285 fn from_wire(
1286 wire_: crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'de>,
1287 ) -> Self {
1288 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1289
1290 let server_end = wire_.table.get(1);
1291
1292 let buffers_remaining = wire_.table.get(2);
1293
1294 Self {
1295 server_end: server_end.map(|envelope| {
1296 ::fidl_next::FromWire::from_wire(unsafe {
1297 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
1298 })
1299 }),
1300
1301 buffers_remaining: buffers_remaining.map(|envelope| {
1302 ::fidl_next::FromWire::from_wire(unsafe {
1303 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
1304 })
1305 }),
1306 }
1307 }
1308 }
1309
1310 #[derive(Debug, Default, PartialEq)]
1311 pub struct NodeAttachNodeTrackingRequest {
1312 pub server_end: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
1313 }
1314
1315 impl NodeAttachNodeTrackingRequest {
1316 fn __max_ordinal(&self) -> usize {
1317 if self.server_end.is_some() {
1318 return 1;
1319 }
1320
1321 0
1322 }
1323 }
1324
1325 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeAttachNodeTrackingRequest<'static>, ___E>
1326 for NodeAttachNodeTrackingRequest
1327 where
1328 ___E: ::fidl_next::Encoder + ?Sized,
1329 ___E: ::fidl_next::fuchsia::HandleEncoder,
1330 {
1331 #[inline]
1332 fn encode(
1333 mut self,
1334 encoder: &mut ___E,
1335 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeAttachNodeTrackingRequest<'static>>,
1336 _: (),
1337 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1338 ::fidl_next::munge!(let crate::wire::NodeAttachNodeTrackingRequest { table } = out);
1339
1340 let max_ord = self.__max_ordinal();
1341
1342 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1343 ::fidl_next::Wire::zero_padding(&mut out);
1344
1345 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1346 ::fidl_next::wire::Envelope,
1347 >(encoder, max_ord);
1348
1349 for i in 1..=max_ord {
1350 match i {
1351 1 => {
1352 if let Some(value) = self.server_end.take() {
1353 ::fidl_next::wire::Envelope::encode_value::<
1354 ::fidl_next::wire::fuchsia::EventPair,
1355 ___E,
1356 >(
1357 value, preallocated.encoder, &mut out, ()
1358 )?;
1359 } else {
1360 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1361 }
1362 }
1363
1364 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1365 }
1366 unsafe {
1367 preallocated.write_next(out.assume_init_ref());
1368 }
1369 }
1370
1371 ::fidl_next::wire::Table::encode_len(table, max_ord);
1372
1373 Ok(())
1374 }
1375 }
1376
1377 impl<'de> ::fidl_next::FromWire<crate::wire::NodeAttachNodeTrackingRequest<'de>>
1378 for NodeAttachNodeTrackingRequest
1379 {
1380 #[inline]
1381 fn from_wire(wire_: crate::wire::NodeAttachNodeTrackingRequest<'de>) -> Self {
1382 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1383
1384 let server_end = wire_.table.get(1);
1385
1386 Self {
1387 server_end: server_end.map(|envelope| {
1388 ::fidl_next::FromWire::from_wire(unsafe {
1389 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
1390 })
1391 }),
1392 }
1393 }
1394 }
1395
1396 #[doc = " Information about a buffer collection and its buffers.\n\n When adding fields to this table, see also\n fuchsia.sysmem2/Allocator.GetVmoInfo, redacted_buffer_collection_info, and\n RedactBufferCollectionInfo. Consider whether a client with only\n ZX_RIGHT_TRANSFER right on a sysmem vmo handle, calling GetVmoInfo, should\n be given the information in the new field, or whether it should be un-set\n during redaction. GetVmoInfo is analogous to zx_object_get_info with topic\n ZX_INFO_VMO, which doesn\'t require the VMO handle to have any rights - just\n needs to be a handle to a VMO. Fields that are necessary to correctly use a\n single sysmem VMO in isolation are generally ok (but still think about it\n field by field). Fields that are not necessary to correctly use a single\n sysmem VMO in isolation should probably be redacted for GetVmoInfo\n redacted_buffer_collection_info.\n"]
1397 #[derive(Debug, Default, PartialEq)]
1398 pub struct BufferCollectionInfo {
1399 pub settings: ::core::option::Option<crate::natural::SingleBufferSettings>,
1400
1401 pub buffers: ::core::option::Option<::std::vec::Vec<crate::natural::VmoBuffer>>,
1402
1403 pub buffer_collection_id: ::core::option::Option<u64>,
1404 }
1405
1406 impl BufferCollectionInfo {
1407 fn __max_ordinal(&self) -> usize {
1408 if self.buffer_collection_id.is_some() {
1409 return 3;
1410 }
1411
1412 if self.buffers.is_some() {
1413 return 2;
1414 }
1415
1416 if self.settings.is_some() {
1417 return 1;
1418 }
1419
1420 0
1421 }
1422 }
1423
1424 unsafe impl<___E> ::fidl_next::Encode<crate::wire::BufferCollectionInfo<'static>, ___E>
1425 for BufferCollectionInfo
1426 where
1427 ___E: ::fidl_next::Encoder + ?Sized,
1428 ___E: ::fidl_next::fuchsia::HandleEncoder,
1429 {
1430 #[inline]
1431 fn encode(
1432 mut self,
1433 encoder: &mut ___E,
1434 out: &mut ::core::mem::MaybeUninit<crate::wire::BufferCollectionInfo<'static>>,
1435 _: (),
1436 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1437 ::fidl_next::munge!(let crate::wire::BufferCollectionInfo { table } = out);
1438
1439 let max_ord = self.__max_ordinal();
1440
1441 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1442 ::fidl_next::Wire::zero_padding(&mut out);
1443
1444 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1445 ::fidl_next::wire::Envelope,
1446 >(encoder, max_ord);
1447
1448 for i in 1..=max_ord {
1449 match i {
1450 3 => {
1451 if let Some(value) = self.buffer_collection_id.take() {
1452 ::fidl_next::wire::Envelope::encode_value::<
1453 ::fidl_next::wire::Uint64,
1454 ___E,
1455 >(
1456 value, preallocated.encoder, &mut out, ()
1457 )?;
1458 } else {
1459 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1460 }
1461 }
1462
1463 2 => {
1464 if let Some(value) = self.buffers.take() {
1465 ::fidl_next::wire::Envelope::encode_value::<
1466 ::fidl_next::wire::Vector<'static, crate::wire::VmoBuffer<'static>>,
1467 ___E,
1468 >(
1469 value, preallocated.encoder, &mut out, (128, ())
1470 )?;
1471 } else {
1472 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1473 }
1474 }
1475
1476 1 => {
1477 if let Some(value) = self.settings.take() {
1478 ::fidl_next::wire::Envelope::encode_value::<
1479 crate::wire::SingleBufferSettings<'static>,
1480 ___E,
1481 >(
1482 value, preallocated.encoder, &mut out, ()
1483 )?;
1484 } else {
1485 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1486 }
1487 }
1488
1489 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1490 }
1491 unsafe {
1492 preallocated.write_next(out.assume_init_ref());
1493 }
1494 }
1495
1496 ::fidl_next::wire::Table::encode_len(table, max_ord);
1497
1498 Ok(())
1499 }
1500 }
1501
1502 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionInfo<'de>> for BufferCollectionInfo {
1503 #[inline]
1504 fn from_wire(wire_: crate::wire::BufferCollectionInfo<'de>) -> Self {
1505 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1506
1507 let settings = wire_.table.get(1);
1508
1509 let buffers = wire_.table.get(2);
1510
1511 let buffer_collection_id = wire_.table.get(3);
1512
1513 Self {
1514
1515
1516 settings: settings.map(|envelope| ::fidl_next::FromWire::from_wire(
1517 unsafe { envelope.read_unchecked::<crate::wire::SingleBufferSettings<'de>>() }
1518 )),
1519
1520
1521 buffers: buffers.map(|envelope| ::fidl_next::FromWire::from_wire(
1522 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>>() }
1523 )),
1524
1525
1526 buffer_collection_id: buffer_collection_id.map(|envelope| ::fidl_next::FromWire::from_wire(
1527 unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() }
1528 )),
1529
1530 }
1531 }
1532 }
1533
1534 #[derive(Debug, Default, PartialEq)]
1535 pub struct BufferCollectionWaitForAllBuffersAllocatedResponse {
1536 pub buffer_collection_info: ::core::option::Option<crate::natural::BufferCollectionInfo>,
1537 }
1538
1539 impl BufferCollectionWaitForAllBuffersAllocatedResponse {
1540 fn __max_ordinal(&self) -> usize {
1541 if self.buffer_collection_info.is_some() {
1542 return 1;
1543 }
1544
1545 0
1546 }
1547 }
1548
1549 unsafe impl<___E>
1550 ::fidl_next::Encode<
1551 crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'static>,
1552 ___E,
1553 > for BufferCollectionWaitForAllBuffersAllocatedResponse
1554 where
1555 ___E: ::fidl_next::Encoder + ?Sized,
1556 ___E: ::fidl_next::fuchsia::HandleEncoder,
1557 {
1558 #[inline]
1559 fn encode(
1560 mut self,
1561 encoder: &mut ___E,
1562 out: &mut ::core::mem::MaybeUninit<
1563 crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'static>,
1564 >,
1565 _: (),
1566 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1567 ::fidl_next::munge!(let crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse { table } = out);
1568
1569 let max_ord = self.__max_ordinal();
1570
1571 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1572 ::fidl_next::Wire::zero_padding(&mut out);
1573
1574 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1575 ::fidl_next::wire::Envelope,
1576 >(encoder, max_ord);
1577
1578 for i in 1..=max_ord {
1579 match i {
1580 1 => {
1581 if let Some(value) = self.buffer_collection_info.take() {
1582 ::fidl_next::wire::Envelope::encode_value::<
1583 crate::wire::BufferCollectionInfo<'static>,
1584 ___E,
1585 >(
1586 value, preallocated.encoder, &mut out, ()
1587 )?;
1588 } else {
1589 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1590 }
1591 }
1592
1593 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1594 }
1595 unsafe {
1596 preallocated.write_next(out.assume_init_ref());
1597 }
1598 }
1599
1600 ::fidl_next::wire::Table::encode_len(table, max_ord);
1601
1602 Ok(())
1603 }
1604 }
1605
1606 impl<'de>
1607 ::fidl_next::FromWire<crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'de>>
1608 for BufferCollectionWaitForAllBuffersAllocatedResponse
1609 {
1610 #[inline]
1611 fn from_wire(
1612 wire_: crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'de>,
1613 ) -> Self {
1614 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1615
1616 let buffer_collection_info = wire_.table.get(1);
1617
1618 Self {
1619 buffer_collection_info: buffer_collection_info.map(|envelope| {
1620 ::fidl_next::FromWire::from_wire(unsafe {
1621 envelope.read_unchecked::<crate::wire::BufferCollectionInfo<'de>>()
1622 })
1623 }),
1624 }
1625 }
1626 }
1627
1628 #[derive(Debug, Default, PartialEq)]
1629 pub struct BufferCollectionSetConstraintsRequest {
1630 pub constraints: ::core::option::Option<crate::natural::BufferCollectionConstraints>,
1631
1632 pub must_match_vmo: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
1633 }
1634
1635 impl BufferCollectionSetConstraintsRequest {
1636 fn __max_ordinal(&self) -> usize {
1637 if self.must_match_vmo.is_some() {
1638 return 2;
1639 }
1640
1641 if self.constraints.is_some() {
1642 return 1;
1643 }
1644
1645 0
1646 }
1647 }
1648
1649 unsafe impl<___E>
1650 ::fidl_next::Encode<crate::wire::BufferCollectionSetConstraintsRequest<'static>, ___E>
1651 for BufferCollectionSetConstraintsRequest
1652 where
1653 ___E: ::fidl_next::Encoder + ?Sized,
1654 ___E: ::fidl_next::fuchsia::HandleEncoder,
1655 {
1656 #[inline]
1657 fn encode(
1658 mut self,
1659 encoder: &mut ___E,
1660 out: &mut ::core::mem::MaybeUninit<
1661 crate::wire::BufferCollectionSetConstraintsRequest<'static>,
1662 >,
1663 _: (),
1664 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1665 ::fidl_next::munge!(let crate::wire::BufferCollectionSetConstraintsRequest { table } = out);
1666
1667 let max_ord = self.__max_ordinal();
1668
1669 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1670 ::fidl_next::Wire::zero_padding(&mut out);
1671
1672 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1673 ::fidl_next::wire::Envelope,
1674 >(encoder, max_ord);
1675
1676 for i in 1..=max_ord {
1677 match i {
1678 2 => {
1679 if let Some(value) = self.must_match_vmo.take() {
1680 ::fidl_next::wire::Envelope::encode_value::<
1681 ::fidl_next::wire::fuchsia::Vmo,
1682 ___E,
1683 >(
1684 value, preallocated.encoder, &mut out, ()
1685 )?;
1686 } else {
1687 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1688 }
1689 }
1690
1691 1 => {
1692 if let Some(value) = self.constraints.take() {
1693 ::fidl_next::wire::Envelope::encode_value::<
1694 crate::wire::BufferCollectionConstraints<'static>,
1695 ___E,
1696 >(
1697 value, preallocated.encoder, &mut out, ()
1698 )?;
1699 } else {
1700 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1701 }
1702 }
1703
1704 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1705 }
1706 unsafe {
1707 preallocated.write_next(out.assume_init_ref());
1708 }
1709 }
1710
1711 ::fidl_next::wire::Table::encode_len(table, max_ord);
1712
1713 Ok(())
1714 }
1715 }
1716
1717 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionSetConstraintsRequest<'de>>
1718 for BufferCollectionSetConstraintsRequest
1719 {
1720 #[inline]
1721 fn from_wire(wire_: crate::wire::BufferCollectionSetConstraintsRequest<'de>) -> Self {
1722 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1723
1724 let constraints = wire_.table.get(1);
1725
1726 let must_match_vmo = wire_.table.get(2);
1727
1728 Self {
1729 constraints: constraints.map(|envelope| {
1730 ::fidl_next::FromWire::from_wire(unsafe {
1731 envelope.read_unchecked::<crate::wire::BufferCollectionConstraints<'de>>()
1732 })
1733 }),
1734
1735 must_match_vmo: must_match_vmo.map(|envelope| {
1736 ::fidl_next::FromWire::from_wire(unsafe {
1737 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
1738 })
1739 }),
1740 }
1741 }
1742 }
1743
1744 #[derive(Debug, Default, PartialEq)]
1745 pub struct BufferCollectionAttachTokenRequest {
1746 pub rights_attenuation_mask: ::core::option::Option<::fidl_next::fuchsia::zx::Rights>,
1747
1748 pub token_request: ::core::option::Option<
1749 ::fidl_next::ServerEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
1750 >,
1751 }
1752
1753 impl BufferCollectionAttachTokenRequest {
1754 fn __max_ordinal(&self) -> usize {
1755 if self.token_request.is_some() {
1756 return 2;
1757 }
1758
1759 if self.rights_attenuation_mask.is_some() {
1760 return 1;
1761 }
1762
1763 0
1764 }
1765 }
1766
1767 unsafe impl<___E>
1768 ::fidl_next::Encode<crate::wire::BufferCollectionAttachTokenRequest<'static>, ___E>
1769 for BufferCollectionAttachTokenRequest
1770 where
1771 ___E: ::fidl_next::Encoder + ?Sized,
1772 ___E: ::fidl_next::fuchsia::HandleEncoder,
1773 {
1774 #[inline]
1775 fn encode(
1776 mut self,
1777 encoder: &mut ___E,
1778 out: &mut ::core::mem::MaybeUninit<
1779 crate::wire::BufferCollectionAttachTokenRequest<'static>,
1780 >,
1781 _: (),
1782 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1783 ::fidl_next::munge!(let crate::wire::BufferCollectionAttachTokenRequest { table } = out);
1784
1785 let max_ord = self.__max_ordinal();
1786
1787 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1788 ::fidl_next::Wire::zero_padding(&mut out);
1789
1790 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1791 ::fidl_next::wire::Envelope,
1792 >(encoder, max_ord);
1793
1794 for i in 1..=max_ord {
1795 match i {
1796 2 => {
1797 if let Some(value) = self.token_request.take() {
1798 ::fidl_next::wire::Envelope::encode_value::<
1799 ::fidl_next::ServerEnd<
1800 crate::BufferCollectionToken,
1801 ::fidl_next::wire::fuchsia::Channel,
1802 >,
1803 ___E,
1804 >(
1805 value, preallocated.encoder, &mut out, ()
1806 )?;
1807 } else {
1808 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1809 }
1810 }
1811
1812 1 => {
1813 if let Some(value) = self.rights_attenuation_mask.take() {
1814 ::fidl_next::wire::Envelope::encode_value::<
1815 ::fidl_next::wire::fuchsia::Rights,
1816 ___E,
1817 >(
1818 value, preallocated.encoder, &mut out, ()
1819 )?;
1820 } else {
1821 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1822 }
1823 }
1824
1825 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1826 }
1827 unsafe {
1828 preallocated.write_next(out.assume_init_ref());
1829 }
1830 }
1831
1832 ::fidl_next::wire::Table::encode_len(table, max_ord);
1833
1834 Ok(())
1835 }
1836 }
1837
1838 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionAttachTokenRequest<'de>>
1839 for BufferCollectionAttachTokenRequest
1840 {
1841 #[inline]
1842 fn from_wire(wire_: crate::wire::BufferCollectionAttachTokenRequest<'de>) -> Self {
1843 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1844
1845 let rights_attenuation_mask = wire_.table.get(1);
1846
1847 let token_request = wire_.table.get(2);
1848
1849 Self {
1850 rights_attenuation_mask: rights_attenuation_mask.map(|envelope| {
1851 ::fidl_next::FromWire::from_wire(unsafe {
1852 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
1853 })
1854 }),
1855
1856 token_request: token_request.map(|envelope| {
1857 ::fidl_next::FromWire::from_wire(unsafe {
1858 envelope.read_unchecked::<::fidl_next::ServerEnd<
1859 crate::BufferCollectionToken,
1860 ::fidl_next::wire::fuchsia::Channel,
1861 >>()
1862 })
1863 }),
1864 }
1865 }
1866 }
1867
1868 #[derive(Debug, Default, PartialEq)]
1869 pub struct BufferCollectionTokenDuplicateSyncResponse {
1870 pub tokens: ::core::option::Option<
1871 ::std::vec::Vec<
1872 ::fidl_next::ClientEnd<
1873 crate::BufferCollectionToken,
1874 ::fidl_next::fuchsia::zx::Channel,
1875 >,
1876 >,
1877 >,
1878 }
1879
1880 impl BufferCollectionTokenDuplicateSyncResponse {
1881 fn __max_ordinal(&self) -> usize {
1882 if self.tokens.is_some() {
1883 return 1;
1884 }
1885
1886 0
1887 }
1888 }
1889
1890 unsafe impl<___E>
1891 ::fidl_next::Encode<crate::wire::BufferCollectionTokenDuplicateSyncResponse<'static>, ___E>
1892 for BufferCollectionTokenDuplicateSyncResponse
1893 where
1894 ___E: ::fidl_next::Encoder + ?Sized,
1895 ___E: ::fidl_next::fuchsia::HandleEncoder,
1896 {
1897 #[inline]
1898 fn encode(
1899 mut self,
1900 encoder: &mut ___E,
1901 out: &mut ::core::mem::MaybeUninit<
1902 crate::wire::BufferCollectionTokenDuplicateSyncResponse<'static>,
1903 >,
1904 _: (),
1905 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1906 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenDuplicateSyncResponse { table } = out);
1907
1908 let max_ord = self.__max_ordinal();
1909
1910 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1911 ::fidl_next::Wire::zero_padding(&mut out);
1912
1913 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1914 ::fidl_next::wire::Envelope,
1915 >(encoder, max_ord);
1916
1917 for i in 1..=max_ord {
1918 match i {
1919 1 => {
1920 if let Some(value) = self.tokens.take() {
1921 ::fidl_next::wire::Envelope::encode_value::<
1922 ::fidl_next::wire::Vector<
1923 'static,
1924 ::fidl_next::ClientEnd<
1925 crate::BufferCollectionToken,
1926 ::fidl_next::wire::fuchsia::Channel,
1927 >,
1928 >,
1929 ___E,
1930 >(
1931 value, preallocated.encoder, &mut out, (64, ())
1932 )?;
1933 } else {
1934 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1935 }
1936 }
1937
1938 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1939 }
1940 unsafe {
1941 preallocated.write_next(out.assume_init_ref());
1942 }
1943 }
1944
1945 ::fidl_next::wire::Table::encode_len(table, max_ord);
1946
1947 Ok(())
1948 }
1949 }
1950
1951 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionTokenDuplicateSyncResponse<'de>>
1952 for BufferCollectionTokenDuplicateSyncResponse
1953 {
1954 #[inline]
1955 fn from_wire(wire_: crate::wire::BufferCollectionTokenDuplicateSyncResponse<'de>) -> Self {
1956 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1957
1958 let tokens = wire_.table.get(1);
1959
1960 Self {
1961 tokens: tokens.map(|envelope| {
1962 ::fidl_next::FromWire::from_wire(unsafe {
1963 envelope.read_unchecked::<::fidl_next::wire::Vector<
1964 'de,
1965 ::fidl_next::ClientEnd<
1966 crate::BufferCollectionToken,
1967 ::fidl_next::wire::fuchsia::Channel,
1968 >,
1969 >>()
1970 })
1971 }),
1972 }
1973 }
1974 }
1975
1976 #[derive(Debug, Default, PartialEq)]
1977 pub struct BufferCollectionTokenDuplicateRequest {
1978 pub rights_attenuation_mask: ::core::option::Option<::fidl_next::fuchsia::zx::Rights>,
1979
1980 pub token_request: ::core::option::Option<
1981 ::fidl_next::ServerEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
1982 >,
1983 }
1984
1985 impl BufferCollectionTokenDuplicateRequest {
1986 fn __max_ordinal(&self) -> usize {
1987 if self.token_request.is_some() {
1988 return 2;
1989 }
1990
1991 if self.rights_attenuation_mask.is_some() {
1992 return 1;
1993 }
1994
1995 0
1996 }
1997 }
1998
1999 unsafe impl<___E>
2000 ::fidl_next::Encode<crate::wire::BufferCollectionTokenDuplicateRequest<'static>, ___E>
2001 for BufferCollectionTokenDuplicateRequest
2002 where
2003 ___E: ::fidl_next::Encoder + ?Sized,
2004 ___E: ::fidl_next::fuchsia::HandleEncoder,
2005 {
2006 #[inline]
2007 fn encode(
2008 mut self,
2009 encoder: &mut ___E,
2010 out: &mut ::core::mem::MaybeUninit<
2011 crate::wire::BufferCollectionTokenDuplicateRequest<'static>,
2012 >,
2013 _: (),
2014 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2015 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenDuplicateRequest { table } = out);
2016
2017 let max_ord = self.__max_ordinal();
2018
2019 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
2020 ::fidl_next::Wire::zero_padding(&mut out);
2021
2022 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
2023 ::fidl_next::wire::Envelope,
2024 >(encoder, max_ord);
2025
2026 for i in 1..=max_ord {
2027 match i {
2028 2 => {
2029 if let Some(value) = self.token_request.take() {
2030 ::fidl_next::wire::Envelope::encode_value::<
2031 ::fidl_next::ServerEnd<
2032 crate::BufferCollectionToken,
2033 ::fidl_next::wire::fuchsia::Channel,
2034 >,
2035 ___E,
2036 >(
2037 value, preallocated.encoder, &mut out, ()
2038 )?;
2039 } else {
2040 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2041 }
2042 }
2043
2044 1 => {
2045 if let Some(value) = self.rights_attenuation_mask.take() {
2046 ::fidl_next::wire::Envelope::encode_value::<
2047 ::fidl_next::wire::fuchsia::Rights,
2048 ___E,
2049 >(
2050 value, preallocated.encoder, &mut out, ()
2051 )?;
2052 } else {
2053 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2054 }
2055 }
2056
2057 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
2058 }
2059 unsafe {
2060 preallocated.write_next(out.assume_init_ref());
2061 }
2062 }
2063
2064 ::fidl_next::wire::Table::encode_len(table, max_ord);
2065
2066 Ok(())
2067 }
2068 }
2069
2070 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionTokenDuplicateRequest<'de>>
2071 for BufferCollectionTokenDuplicateRequest
2072 {
2073 #[inline]
2074 fn from_wire(wire_: crate::wire::BufferCollectionTokenDuplicateRequest<'de>) -> Self {
2075 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
2076
2077 let rights_attenuation_mask = wire_.table.get(1);
2078
2079 let token_request = wire_.table.get(2);
2080
2081 Self {
2082 rights_attenuation_mask: rights_attenuation_mask.map(|envelope| {
2083 ::fidl_next::FromWire::from_wire(unsafe {
2084 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
2085 })
2086 }),
2087
2088 token_request: token_request.map(|envelope| {
2089 ::fidl_next::FromWire::from_wire(unsafe {
2090 envelope.read_unchecked::<::fidl_next::ServerEnd<
2091 crate::BufferCollectionToken,
2092 ::fidl_next::wire::fuchsia::Channel,
2093 >>()
2094 })
2095 }),
2096 }
2097 }
2098 }
2099
2100 #[derive(Debug, Default, PartialEq)]
2101 pub struct BufferCollectionTokenCreateBufferCollectionTokenGroupRequest {
2102 pub group_request: ::core::option::Option<
2103 ::fidl_next::ServerEnd<
2104 crate::BufferCollectionTokenGroup,
2105 ::fidl_next::fuchsia::zx::Channel,
2106 >,
2107 >,
2108 }
2109
2110 impl BufferCollectionTokenCreateBufferCollectionTokenGroupRequest {
2111 fn __max_ordinal(&self) -> usize {
2112 if self.group_request.is_some() {
2113 return 1;
2114 }
2115
2116 0
2117 }
2118 }
2119
2120 unsafe impl<___E>
2121 ::fidl_next::Encode<
2122 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'static>,
2123 ___E,
2124 > for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest
2125 where
2126 ___E: ::fidl_next::Encoder + ?Sized,
2127 ___E: ::fidl_next::fuchsia::HandleEncoder,
2128 {
2129 #[inline]
2130 fn encode(
2131 mut self,
2132 encoder: &mut ___E,
2133 out: &mut ::core::mem::MaybeUninit<
2134 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'static>,
2135 >,
2136 _: (),
2137 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2138 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest { table } = out);
2139
2140 let max_ord = self.__max_ordinal();
2141
2142 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
2143 ::fidl_next::Wire::zero_padding(&mut out);
2144
2145 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
2146 ::fidl_next::wire::Envelope,
2147 >(encoder, max_ord);
2148
2149 for i in 1..=max_ord {
2150 match i {
2151 1 => {
2152 if let Some(value) = self.group_request.take() {
2153 ::fidl_next::wire::Envelope::encode_value::<
2154 ::fidl_next::ServerEnd<
2155 crate::BufferCollectionTokenGroup,
2156 ::fidl_next::wire::fuchsia::Channel,
2157 >,
2158 ___E,
2159 >(
2160 value, preallocated.encoder, &mut out, ()
2161 )?;
2162 } else {
2163 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2164 }
2165 }
2166
2167 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
2168 }
2169 unsafe {
2170 preallocated.write_next(out.assume_init_ref());
2171 }
2172 }
2173
2174 ::fidl_next::wire::Table::encode_len(table, max_ord);
2175
2176 Ok(())
2177 }
2178 }
2179
2180 impl<'de>
2181 ::fidl_next::FromWire<
2182 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>,
2183 > for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest
2184 {
2185 #[inline]
2186 fn from_wire(
2187 wire_: crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>,
2188 ) -> Self {
2189 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
2190
2191 let group_request = wire_.table.get(1);
2192
2193 Self {
2194 group_request: group_request.map(|envelope| {
2195 ::fidl_next::FromWire::from_wire(unsafe {
2196 envelope.read_unchecked::<::fidl_next::ServerEnd<
2197 crate::BufferCollectionTokenGroup,
2198 ::fidl_next::wire::fuchsia::Channel,
2199 >>()
2200 })
2201 }),
2202 }
2203 }
2204 }
2205
2206 #[derive(Debug, Default, PartialEq)]
2207 pub struct BufferCollectionTokenGroupCreateChildRequest {
2208 pub token_request: ::core::option::Option<
2209 ::fidl_next::ServerEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
2210 >,
2211
2212 pub rights_attenuation_mask: ::core::option::Option<::fidl_next::fuchsia::zx::Rights>,
2213 }
2214
2215 impl BufferCollectionTokenGroupCreateChildRequest {
2216 fn __max_ordinal(&self) -> usize {
2217 if self.rights_attenuation_mask.is_some() {
2218 return 2;
2219 }
2220
2221 if self.token_request.is_some() {
2222 return 1;
2223 }
2224
2225 0
2226 }
2227 }
2228
2229 unsafe impl<___E>
2230 ::fidl_next::Encode<
2231 crate::wire::BufferCollectionTokenGroupCreateChildRequest<'static>,
2232 ___E,
2233 > for BufferCollectionTokenGroupCreateChildRequest
2234 where
2235 ___E: ::fidl_next::Encoder + ?Sized,
2236 ___E: ::fidl_next::fuchsia::HandleEncoder,
2237 {
2238 #[inline]
2239 fn encode(
2240 mut self,
2241 encoder: &mut ___E,
2242 out: &mut ::core::mem::MaybeUninit<
2243 crate::wire::BufferCollectionTokenGroupCreateChildRequest<'static>,
2244 >,
2245 _: (),
2246 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2247 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenGroupCreateChildRequest { table } = out);
2248
2249 let max_ord = self.__max_ordinal();
2250
2251 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
2252 ::fidl_next::Wire::zero_padding(&mut out);
2253
2254 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
2255 ::fidl_next::wire::Envelope,
2256 >(encoder, max_ord);
2257
2258 for i in 1..=max_ord {
2259 match i {
2260 2 => {
2261 if let Some(value) = self.rights_attenuation_mask.take() {
2262 ::fidl_next::wire::Envelope::encode_value::<
2263 ::fidl_next::wire::fuchsia::Rights,
2264 ___E,
2265 >(
2266 value, preallocated.encoder, &mut out, ()
2267 )?;
2268 } else {
2269 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2270 }
2271 }
2272
2273 1 => {
2274 if let Some(value) = self.token_request.take() {
2275 ::fidl_next::wire::Envelope::encode_value::<
2276 ::fidl_next::ServerEnd<
2277 crate::BufferCollectionToken,
2278 ::fidl_next::wire::fuchsia::Channel,
2279 >,
2280 ___E,
2281 >(
2282 value, preallocated.encoder, &mut out, ()
2283 )?;
2284 } else {
2285 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2286 }
2287 }
2288
2289 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
2290 }
2291 unsafe {
2292 preallocated.write_next(out.assume_init_ref());
2293 }
2294 }
2295
2296 ::fidl_next::wire::Table::encode_len(table, max_ord);
2297
2298 Ok(())
2299 }
2300 }
2301
2302 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionTokenGroupCreateChildRequest<'de>>
2303 for BufferCollectionTokenGroupCreateChildRequest
2304 {
2305 #[inline]
2306 fn from_wire(
2307 wire_: crate::wire::BufferCollectionTokenGroupCreateChildRequest<'de>,
2308 ) -> Self {
2309 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
2310
2311 let token_request = wire_.table.get(1);
2312
2313 let rights_attenuation_mask = wire_.table.get(2);
2314
2315 Self {
2316 token_request: token_request.map(|envelope| {
2317 ::fidl_next::FromWire::from_wire(unsafe {
2318 envelope.read_unchecked::<::fidl_next::ServerEnd<
2319 crate::BufferCollectionToken,
2320 ::fidl_next::wire::fuchsia::Channel,
2321 >>()
2322 })
2323 }),
2324
2325 rights_attenuation_mask: rights_attenuation_mask.map(|envelope| {
2326 ::fidl_next::FromWire::from_wire(unsafe {
2327 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
2328 })
2329 }),
2330 }
2331 }
2332 }
2333
2334 #[derive(Debug, Default, PartialEq)]
2335 pub struct BufferCollectionTokenGroupCreateChildrenSyncResponse {
2336 pub tokens: ::core::option::Option<
2337 ::std::vec::Vec<
2338 ::fidl_next::ClientEnd<
2339 crate::BufferCollectionToken,
2340 ::fidl_next::fuchsia::zx::Channel,
2341 >,
2342 >,
2343 >,
2344 }
2345
2346 impl BufferCollectionTokenGroupCreateChildrenSyncResponse {
2347 fn __max_ordinal(&self) -> usize {
2348 if self.tokens.is_some() {
2349 return 1;
2350 }
2351
2352 0
2353 }
2354 }
2355
2356 unsafe impl<___E>
2357 ::fidl_next::Encode<
2358 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'static>,
2359 ___E,
2360 > for BufferCollectionTokenGroupCreateChildrenSyncResponse
2361 where
2362 ___E: ::fidl_next::Encoder + ?Sized,
2363 ___E: ::fidl_next::fuchsia::HandleEncoder,
2364 {
2365 #[inline]
2366 fn encode(
2367 mut self,
2368 encoder: &mut ___E,
2369 out: &mut ::core::mem::MaybeUninit<
2370 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'static>,
2371 >,
2372 _: (),
2373 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2374 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse { table } = out);
2375
2376 let max_ord = self.__max_ordinal();
2377
2378 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
2379 ::fidl_next::Wire::zero_padding(&mut out);
2380
2381 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
2382 ::fidl_next::wire::Envelope,
2383 >(encoder, max_ord);
2384
2385 for i in 1..=max_ord {
2386 match i {
2387 1 => {
2388 if let Some(value) = self.tokens.take() {
2389 ::fidl_next::wire::Envelope::encode_value::<
2390 ::fidl_next::wire::Vector<
2391 'static,
2392 ::fidl_next::ClientEnd<
2393 crate::BufferCollectionToken,
2394 ::fidl_next::wire::fuchsia::Channel,
2395 >,
2396 >,
2397 ___E,
2398 >(
2399 value, preallocated.encoder, &mut out, (64, ())
2400 )?;
2401 } else {
2402 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2403 }
2404 }
2405
2406 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
2407 }
2408 unsafe {
2409 preallocated.write_next(out.assume_init_ref());
2410 }
2411 }
2412
2413 ::fidl_next::wire::Table::encode_len(table, max_ord);
2414
2415 Ok(())
2416 }
2417 }
2418
2419 impl<'de>
2420 ::fidl_next::FromWire<
2421 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'de>,
2422 > for BufferCollectionTokenGroupCreateChildrenSyncResponse
2423 {
2424 #[inline]
2425 fn from_wire(
2426 wire_: crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'de>,
2427 ) -> Self {
2428 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
2429
2430 let tokens = wire_.table.get(1);
2431
2432 Self {
2433 tokens: tokens.map(|envelope| {
2434 ::fidl_next::FromWire::from_wire(unsafe {
2435 envelope.read_unchecked::<::fidl_next::wire::Vector<
2436 'de,
2437 ::fidl_next::ClientEnd<
2438 crate::BufferCollectionToken,
2439 ::fidl_next::wire::fuchsia::Channel,
2440 >,
2441 >>()
2442 })
2443 }),
2444 }
2445 }
2446 }
2447}
2448
2449pub mod wire {
2450
2451 pub use fidl_next_common_fuchsia_sysmem2::wire::*;
2452
2453 #[repr(C)]
2455 pub struct AllocatorAllocateNonSharedCollectionRequest<'de> {
2456 pub(crate) table: ::fidl_next::wire::Table<'de>,
2457 }
2458
2459 impl<'de> Drop for AllocatorAllocateNonSharedCollectionRequest<'de> {
2460 fn drop(&mut self) {
2461 let _ = self.table.get(1).map(|envelope| unsafe {
2462 envelope.read_unchecked::<::fidl_next::ServerEnd<
2463 crate::BufferCollection,
2464 ::fidl_next::wire::fuchsia::Channel,
2465 >>()
2466 });
2467 }
2468 }
2469
2470 impl ::fidl_next::Constrained for AllocatorAllocateNonSharedCollectionRequest<'_> {
2471 type Constraint = ();
2472
2473 fn validate(
2474 _: ::fidl_next::Slot<'_, Self>,
2475 _: Self::Constraint,
2476 ) -> Result<(), ::fidl_next::ValidationError> {
2477 Ok(())
2478 }
2479 }
2480
2481 unsafe impl ::fidl_next::Wire for AllocatorAllocateNonSharedCollectionRequest<'static> {
2482 type Narrowed<'de> = AllocatorAllocateNonSharedCollectionRequest<'de>;
2483
2484 #[inline]
2485 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2486 ::fidl_next::munge!(let Self { table } = out);
2487 ::fidl_next::wire::Table::zero_padding(table);
2488 }
2489 }
2490
2491 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2492 for AllocatorAllocateNonSharedCollectionRequest<'de>
2493 where
2494 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2495 ___D: ::fidl_next::fuchsia::HandleDecoder,
2496 {
2497 fn decode(
2498 slot: ::fidl_next::Slot<'_, Self>,
2499 decoder: &mut ___D,
2500 _: (),
2501 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2502 ::fidl_next::munge!(let Self { table } = slot);
2503
2504 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2505 match ordinal {
2506 0 => unsafe { ::core::hint::unreachable_unchecked() },
2507
2508 1 => {
2509 ::fidl_next::wire::Envelope::decode_as::<
2510 ___D,
2511 ::fidl_next::ServerEnd<
2512 crate::BufferCollection,
2513 ::fidl_next::wire::fuchsia::Channel,
2514 >,
2515 >(slot.as_mut(), decoder, ())?;
2516
2517 Ok(())
2518 }
2519
2520 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2521 }
2522 })
2523 }
2524 }
2525
2526 impl<'de> AllocatorAllocateNonSharedCollectionRequest<'de> {
2527 pub fn collection_request(
2528 &self,
2529 ) -> ::core::option::Option<
2530 &::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::wire::fuchsia::Channel>,
2531 > {
2532 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2533 }
2534
2535 pub fn take_collection_request(
2536 &mut self,
2537 ) -> ::core::option::Option<
2538 ::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::wire::fuchsia::Channel>,
2539 > {
2540 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2541 }
2542 }
2543
2544 impl<'de> ::core::fmt::Debug for AllocatorAllocateNonSharedCollectionRequest<'de> {
2545 fn fmt(
2546 &self,
2547 f: &mut ::core::fmt::Formatter<'_>,
2548 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2549 f.debug_struct("AllocatorAllocateNonSharedCollectionRequest")
2550 .field("collection_request", &self.collection_request())
2551 .finish()
2552 }
2553 }
2554
2555 impl<'de> ::fidl_next::IntoNatural for AllocatorAllocateNonSharedCollectionRequest<'de> {
2556 type Natural = crate::natural::AllocatorAllocateNonSharedCollectionRequest;
2557 }
2558
2559 #[repr(C)]
2561 pub struct AllocatorAllocateSharedCollectionRequest<'de> {
2562 pub(crate) table: ::fidl_next::wire::Table<'de>,
2563 }
2564
2565 impl<'de> Drop for AllocatorAllocateSharedCollectionRequest<'de> {
2566 fn drop(&mut self) {
2567 let _ = self.table.get(1).map(|envelope| unsafe {
2568 envelope.read_unchecked::<::fidl_next::ServerEnd<
2569 crate::BufferCollectionToken,
2570 ::fidl_next::wire::fuchsia::Channel,
2571 >>()
2572 });
2573 }
2574 }
2575
2576 impl ::fidl_next::Constrained for AllocatorAllocateSharedCollectionRequest<'_> {
2577 type Constraint = ();
2578
2579 fn validate(
2580 _: ::fidl_next::Slot<'_, Self>,
2581 _: Self::Constraint,
2582 ) -> Result<(), ::fidl_next::ValidationError> {
2583 Ok(())
2584 }
2585 }
2586
2587 unsafe impl ::fidl_next::Wire for AllocatorAllocateSharedCollectionRequest<'static> {
2588 type Narrowed<'de> = AllocatorAllocateSharedCollectionRequest<'de>;
2589
2590 #[inline]
2591 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2592 ::fidl_next::munge!(let Self { table } = out);
2593 ::fidl_next::wire::Table::zero_padding(table);
2594 }
2595 }
2596
2597 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for AllocatorAllocateSharedCollectionRequest<'de>
2598 where
2599 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2600 ___D: ::fidl_next::fuchsia::HandleDecoder,
2601 {
2602 fn decode(
2603 slot: ::fidl_next::Slot<'_, Self>,
2604 decoder: &mut ___D,
2605 _: (),
2606 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2607 ::fidl_next::munge!(let Self { table } = slot);
2608
2609 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2610 match ordinal {
2611 0 => unsafe { ::core::hint::unreachable_unchecked() },
2612
2613 1 => {
2614 ::fidl_next::wire::Envelope::decode_as::<
2615 ___D,
2616 ::fidl_next::ServerEnd<
2617 crate::BufferCollectionToken,
2618 ::fidl_next::wire::fuchsia::Channel,
2619 >,
2620 >(slot.as_mut(), decoder, ())?;
2621
2622 Ok(())
2623 }
2624
2625 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2626 }
2627 })
2628 }
2629 }
2630
2631 impl<'de> AllocatorAllocateSharedCollectionRequest<'de> {
2632 pub fn token_request(
2633 &self,
2634 ) -> ::core::option::Option<
2635 &::fidl_next::ServerEnd<
2636 crate::BufferCollectionToken,
2637 ::fidl_next::wire::fuchsia::Channel,
2638 >,
2639 > {
2640 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2641 }
2642
2643 pub fn take_token_request(
2644 &mut self,
2645 ) -> ::core::option::Option<
2646 ::fidl_next::ServerEnd<
2647 crate::BufferCollectionToken,
2648 ::fidl_next::wire::fuchsia::Channel,
2649 >,
2650 > {
2651 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2652 }
2653 }
2654
2655 impl<'de> ::core::fmt::Debug for AllocatorAllocateSharedCollectionRequest<'de> {
2656 fn fmt(
2657 &self,
2658 f: &mut ::core::fmt::Formatter<'_>,
2659 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2660 f.debug_struct("AllocatorAllocateSharedCollectionRequest")
2661 .field("token_request", &self.token_request())
2662 .finish()
2663 }
2664 }
2665
2666 impl<'de> ::fidl_next::IntoNatural for AllocatorAllocateSharedCollectionRequest<'de> {
2667 type Natural = crate::natural::AllocatorAllocateSharedCollectionRequest;
2668 }
2669
2670 #[repr(C)]
2672 pub struct AllocatorBindSharedCollectionRequest<'de> {
2673 pub(crate) table: ::fidl_next::wire::Table<'de>,
2674 }
2675
2676 impl<'de> Drop for AllocatorBindSharedCollectionRequest<'de> {
2677 fn drop(&mut self) {
2678 let _ = self.table.get(1).map(|envelope| unsafe {
2679 envelope.read_unchecked::<::fidl_next::ClientEnd<
2680 crate::BufferCollectionToken,
2681 ::fidl_next::wire::fuchsia::Channel,
2682 >>()
2683 });
2684
2685 let _ = self.table.get(2).map(|envelope| unsafe {
2686 envelope.read_unchecked::<::fidl_next::ServerEnd<
2687 crate::BufferCollection,
2688 ::fidl_next::wire::fuchsia::Channel,
2689 >>()
2690 });
2691 }
2692 }
2693
2694 impl ::fidl_next::Constrained for AllocatorBindSharedCollectionRequest<'_> {
2695 type Constraint = ();
2696
2697 fn validate(
2698 _: ::fidl_next::Slot<'_, Self>,
2699 _: Self::Constraint,
2700 ) -> Result<(), ::fidl_next::ValidationError> {
2701 Ok(())
2702 }
2703 }
2704
2705 unsafe impl ::fidl_next::Wire for AllocatorBindSharedCollectionRequest<'static> {
2706 type Narrowed<'de> = AllocatorBindSharedCollectionRequest<'de>;
2707
2708 #[inline]
2709 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2710 ::fidl_next::munge!(let Self { table } = out);
2711 ::fidl_next::wire::Table::zero_padding(table);
2712 }
2713 }
2714
2715 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for AllocatorBindSharedCollectionRequest<'de>
2716 where
2717 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2718 ___D: ::fidl_next::fuchsia::HandleDecoder,
2719 {
2720 fn decode(
2721 slot: ::fidl_next::Slot<'_, Self>,
2722 decoder: &mut ___D,
2723 _: (),
2724 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2725 ::fidl_next::munge!(let Self { table } = slot);
2726
2727 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2728 match ordinal {
2729 0 => unsafe { ::core::hint::unreachable_unchecked() },
2730
2731 1 => {
2732 ::fidl_next::wire::Envelope::decode_as::<
2733 ___D,
2734 ::fidl_next::ClientEnd<
2735 crate::BufferCollectionToken,
2736 ::fidl_next::wire::fuchsia::Channel,
2737 >,
2738 >(slot.as_mut(), decoder, ())?;
2739
2740 Ok(())
2741 }
2742
2743 2 => {
2744 ::fidl_next::wire::Envelope::decode_as::<
2745 ___D,
2746 ::fidl_next::ServerEnd<
2747 crate::BufferCollection,
2748 ::fidl_next::wire::fuchsia::Channel,
2749 >,
2750 >(slot.as_mut(), decoder, ())?;
2751
2752 Ok(())
2753 }
2754
2755 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2756 }
2757 })
2758 }
2759 }
2760
2761 impl<'de> AllocatorBindSharedCollectionRequest<'de> {
2762 pub fn token(
2763 &self,
2764 ) -> ::core::option::Option<
2765 &::fidl_next::ClientEnd<
2766 crate::BufferCollectionToken,
2767 ::fidl_next::wire::fuchsia::Channel,
2768 >,
2769 > {
2770 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2771 }
2772
2773 pub fn take_token(
2774 &mut self,
2775 ) -> ::core::option::Option<
2776 ::fidl_next::ClientEnd<
2777 crate::BufferCollectionToken,
2778 ::fidl_next::wire::fuchsia::Channel,
2779 >,
2780 > {
2781 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2782 }
2783
2784 pub fn buffer_collection_request(
2785 &self,
2786 ) -> ::core::option::Option<
2787 &::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::wire::fuchsia::Channel>,
2788 > {
2789 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2790 }
2791
2792 pub fn take_buffer_collection_request(
2793 &mut self,
2794 ) -> ::core::option::Option<
2795 ::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::wire::fuchsia::Channel>,
2796 > {
2797 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2798 }
2799 }
2800
2801 impl<'de> ::core::fmt::Debug for AllocatorBindSharedCollectionRequest<'de> {
2802 fn fmt(
2803 &self,
2804 f: &mut ::core::fmt::Formatter<'_>,
2805 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2806 f.debug_struct("AllocatorBindSharedCollectionRequest")
2807 .field("token", &self.token())
2808 .field("buffer_collection_request", &self.buffer_collection_request())
2809 .finish()
2810 }
2811 }
2812
2813 impl<'de> ::fidl_next::IntoNatural for AllocatorBindSharedCollectionRequest<'de> {
2814 type Natural = crate::natural::AllocatorBindSharedCollectionRequest;
2815 }
2816
2817 #[repr(C)]
2819 pub struct AllocatorGetVmoInfoRequest<'de> {
2820 pub(crate) table: ::fidl_next::wire::Table<'de>,
2821 }
2822
2823 impl<'de> Drop for AllocatorGetVmoInfoRequest<'de> {
2824 fn drop(&mut self) {
2825 let _ = self.table.get(1).map(|envelope| unsafe {
2826 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
2827 });
2828
2829 let _ = self.table.get(2).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
2830
2831 let _ = self.table.get(3).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
2832
2833 let _ = self.table.get(4).map(|envelope| unsafe {
2834 envelope.read_unchecked::<crate::wire::BufferCollectionConstraints<'de>>()
2835 });
2836
2837 let _ = self.table.get(5).map(|envelope| unsafe {
2838 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
2839 });
2840
2841 let _ = self.table.get(6).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
2842 }
2843 }
2844
2845 impl ::fidl_next::Constrained for AllocatorGetVmoInfoRequest<'_> {
2846 type Constraint = ();
2847
2848 fn validate(
2849 _: ::fidl_next::Slot<'_, Self>,
2850 _: Self::Constraint,
2851 ) -> Result<(), ::fidl_next::ValidationError> {
2852 Ok(())
2853 }
2854 }
2855
2856 unsafe impl ::fidl_next::Wire for AllocatorGetVmoInfoRequest<'static> {
2857 type Narrowed<'de> = AllocatorGetVmoInfoRequest<'de>;
2858
2859 #[inline]
2860 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2861 ::fidl_next::munge!(let Self { table } = out);
2862 ::fidl_next::wire::Table::zero_padding(table);
2863 }
2864 }
2865
2866 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for AllocatorGetVmoInfoRequest<'de>
2867 where
2868 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2869 ___D: ::fidl_next::fuchsia::HandleDecoder,
2870 {
2871 fn decode(
2872 slot: ::fidl_next::Slot<'_, Self>,
2873 decoder: &mut ___D,
2874 _: (),
2875 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2876 ::fidl_next::munge!(let Self { table } = slot);
2877
2878 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2879 match ordinal {
2880 0 => unsafe { ::core::hint::unreachable_unchecked() },
2881
2882 1 => {
2883 ::fidl_next::wire::Envelope::decode_as::<
2884 ___D,
2885 ::fidl_next::wire::fuchsia::Vmo,
2886 >(slot.as_mut(), decoder, ())?;
2887
2888 Ok(())
2889 }
2890
2891 2 => {
2892 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
2893 slot.as_mut(),
2894 decoder,
2895 (),
2896 )?;
2897
2898 Ok(())
2899 }
2900
2901 3 => {
2902 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
2903 slot.as_mut(),
2904 decoder,
2905 (),
2906 )?;
2907
2908 Ok(())
2909 }
2910
2911 4 => {
2912 ::fidl_next::wire::Envelope::decode_as::<
2913 ___D,
2914 crate::wire::BufferCollectionConstraints<'de>,
2915 >(slot.as_mut(), decoder, ())?;
2916
2917 Ok(())
2918 }
2919
2920 5 => {
2921 ::fidl_next::wire::Envelope::decode_as::<
2922 ___D,
2923 ::fidl_next::wire::fuchsia::Vmo,
2924 >(slot.as_mut(), decoder, ())?;
2925
2926 Ok(())
2927 }
2928
2929 6 => {
2930 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
2931 slot.as_mut(),
2932 decoder,
2933 (),
2934 )?;
2935
2936 Ok(())
2937 }
2938
2939 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2940 }
2941 })
2942 }
2943 }
2944
2945 impl<'de> AllocatorGetVmoInfoRequest<'de> {
2946 pub fn vmo(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
2947 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2948 }
2949
2950 pub fn take_vmo(&mut self) -> ::core::option::Option<::fidl_next::wire::fuchsia::Vmo> {
2951 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
2952 }
2953
2954 pub fn need_weak(&self) -> ::core::option::Option<&bool> {
2955 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2956 }
2957
2958 pub fn take_need_weak(&mut self) -> ::core::option::Option<bool> {
2959 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
2960 }
2961
2962 pub fn need_single_buffer_settings(&self) -> ::core::option::Option<&bool> {
2963 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2964 }
2965
2966 pub fn take_need_single_buffer_settings(&mut self) -> ::core::option::Option<bool> {
2967 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
2968 }
2969
2970 pub fn constraints_to_check(
2971 &self,
2972 ) -> ::core::option::Option<&crate::wire::BufferCollectionConstraints<'de>> {
2973 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
2974 }
2975
2976 pub fn take_constraints_to_check(
2977 &mut self,
2978 ) -> ::core::option::Option<crate::wire::BufferCollectionConstraints<'de>> {
2979 unsafe { Some(self.table.get_mut(4)?.take_unchecked()) }
2980 }
2981
2982 pub fn vmo_settings_to_check(
2983 &self,
2984 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
2985 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
2986 }
2987
2988 pub fn take_vmo_settings_to_check(
2989 &mut self,
2990 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Vmo> {
2991 unsafe { Some(self.table.get_mut(5)?.take_unchecked()) }
2992 }
2993
2994 pub fn vmo_settings_to_check_ignore_size(&self) -> ::core::option::Option<&bool> {
2995 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
2996 }
2997
2998 pub fn take_vmo_settings_to_check_ignore_size(&mut self) -> ::core::option::Option<bool> {
2999 unsafe { Some(self.table.get_mut(6)?.take_unchecked()) }
3000 }
3001 }
3002
3003 impl<'de> ::core::fmt::Debug for AllocatorGetVmoInfoRequest<'de> {
3004 fn fmt(
3005 &self,
3006 f: &mut ::core::fmt::Formatter<'_>,
3007 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3008 f.debug_struct("AllocatorGetVmoInfoRequest")
3009 .field("vmo", &self.vmo())
3010 .field("need_weak", &self.need_weak())
3011 .field("need_single_buffer_settings", &self.need_single_buffer_settings())
3012 .field("constraints_to_check", &self.constraints_to_check())
3013 .field("vmo_settings_to_check", &self.vmo_settings_to_check())
3014 .field(
3015 "vmo_settings_to_check_ignore_size",
3016 &self.vmo_settings_to_check_ignore_size(),
3017 )
3018 .finish()
3019 }
3020 }
3021
3022 impl<'de> ::fidl_next::IntoNatural for AllocatorGetVmoInfoRequest<'de> {
3023 type Natural = crate::natural::AllocatorGetVmoInfoRequest;
3024 }
3025
3026 #[repr(C)]
3028 pub struct AllocatorGetVmoInfoResponse<'de> {
3029 pub(crate) table: ::fidl_next::wire::Table<'de>,
3030 }
3031
3032 impl<'de> Drop for AllocatorGetVmoInfoResponse<'de> {
3033 fn drop(&mut self) {
3034 let _ = self
3035 .table
3036 .get(1)
3037 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
3038
3039 let _ = self
3040 .table
3041 .get(2)
3042 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
3043
3044 let _ = self.table.get(3).map(|envelope| unsafe {
3045 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
3046 });
3047
3048 let _ = self.table.get(4).map(|envelope| unsafe {
3049 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
3050 });
3051
3052 let _ = self.table.get(5).map(|envelope| unsafe {
3053 envelope.read_unchecked::<crate::wire::SingleBufferSettings<'de>>()
3054 });
3055
3056 let _ = self.table.get(6).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
3057
3058 let _ = self.table.get(7).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
3059 }
3060 }
3061
3062 impl ::fidl_next::Constrained for AllocatorGetVmoInfoResponse<'_> {
3063 type Constraint = ();
3064
3065 fn validate(
3066 _: ::fidl_next::Slot<'_, Self>,
3067 _: Self::Constraint,
3068 ) -> Result<(), ::fidl_next::ValidationError> {
3069 Ok(())
3070 }
3071 }
3072
3073 unsafe impl ::fidl_next::Wire for AllocatorGetVmoInfoResponse<'static> {
3074 type Narrowed<'de> = AllocatorGetVmoInfoResponse<'de>;
3075
3076 #[inline]
3077 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3078 ::fidl_next::munge!(let Self { table } = out);
3079 ::fidl_next::wire::Table::zero_padding(table);
3080 }
3081 }
3082
3083 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for AllocatorGetVmoInfoResponse<'de>
3084 where
3085 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3086 ___D: ::fidl_next::fuchsia::HandleDecoder,
3087 {
3088 fn decode(
3089 slot: ::fidl_next::Slot<'_, Self>,
3090 decoder: &mut ___D,
3091 _: (),
3092 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3093 ::fidl_next::munge!(let Self { table } = slot);
3094
3095 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3096 match ordinal {
3097 0 => unsafe { ::core::hint::unreachable_unchecked() },
3098
3099 1 => {
3100 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
3101 slot.as_mut(),
3102 decoder,
3103 (),
3104 )?;
3105
3106 Ok(())
3107 }
3108
3109 2 => {
3110 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
3111 slot.as_mut(),
3112 decoder,
3113 (),
3114 )?;
3115
3116 Ok(())
3117 }
3118
3119 3 => {
3120 ::fidl_next::wire::Envelope::decode_as::<
3121 ___D,
3122 ::fidl_next::wire::fuchsia::EventPair,
3123 >(slot.as_mut(), decoder, ())?;
3124
3125 Ok(())
3126 }
3127
3128 4 => {
3129 ::fidl_next::wire::Envelope::decode_as::<
3130 ___D,
3131 ::fidl_next::wire::fuchsia::Vmo,
3132 >(slot.as_mut(), decoder, ())?;
3133
3134 Ok(())
3135 }
3136
3137 5 => {
3138 ::fidl_next::wire::Envelope::decode_as::<
3139 ___D,
3140 crate::wire::SingleBufferSettings<'de>,
3141 >(slot.as_mut(), decoder, ())?;
3142
3143 Ok(())
3144 }
3145
3146 6 => {
3147 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
3148 slot.as_mut(),
3149 decoder,
3150 (),
3151 )?;
3152
3153 Ok(())
3154 }
3155
3156 7 => {
3157 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
3158 slot.as_mut(),
3159 decoder,
3160 (),
3161 )?;
3162
3163 Ok(())
3164 }
3165
3166 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3167 }
3168 })
3169 }
3170 }
3171
3172 impl<'de> AllocatorGetVmoInfoResponse<'de> {
3173 pub fn buffer_collection_id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
3174 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3175 }
3176
3177 pub fn take_buffer_collection_id(
3178 &mut self,
3179 ) -> ::core::option::Option<::fidl_next::wire::Uint64> {
3180 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
3181 }
3182
3183 pub fn buffer_index(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
3184 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3185 }
3186
3187 pub fn take_buffer_index(&mut self) -> ::core::option::Option<::fidl_next::wire::Uint64> {
3188 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
3189 }
3190
3191 pub fn close_weak_asap(
3192 &self,
3193 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
3194 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
3195 }
3196
3197 pub fn take_close_weak_asap(
3198 &mut self,
3199 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::EventPair> {
3200 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
3201 }
3202
3203 pub fn weak_vmo(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
3204 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
3205 }
3206
3207 pub fn take_weak_vmo(&mut self) -> ::core::option::Option<::fidl_next::wire::fuchsia::Vmo> {
3208 unsafe { Some(self.table.get_mut(4)?.take_unchecked()) }
3209 }
3210
3211 pub fn single_buffer_settings(
3212 &self,
3213 ) -> ::core::option::Option<&crate::wire::SingleBufferSettings<'de>> {
3214 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
3215 }
3216
3217 pub fn take_single_buffer_settings(
3218 &mut self,
3219 ) -> ::core::option::Option<crate::wire::SingleBufferSettings<'de>> {
3220 unsafe { Some(self.table.get_mut(5)?.take_unchecked()) }
3221 }
3222
3223 pub fn constraints_ok(&self) -> ::core::option::Option<&bool> {
3224 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
3225 }
3226
3227 pub fn take_constraints_ok(&mut self) -> ::core::option::Option<bool> {
3228 unsafe { Some(self.table.get_mut(6)?.take_unchecked()) }
3229 }
3230
3231 pub fn vmo_settings_match(&self) -> ::core::option::Option<&bool> {
3232 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
3233 }
3234
3235 pub fn take_vmo_settings_match(&mut self) -> ::core::option::Option<bool> {
3236 unsafe { Some(self.table.get_mut(7)?.take_unchecked()) }
3237 }
3238 }
3239
3240 impl<'de> ::core::fmt::Debug for AllocatorGetVmoInfoResponse<'de> {
3241 fn fmt(
3242 &self,
3243 f: &mut ::core::fmt::Formatter<'_>,
3244 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3245 f.debug_struct("AllocatorGetVmoInfoResponse")
3246 .field("buffer_collection_id", &self.buffer_collection_id())
3247 .field("buffer_index", &self.buffer_index())
3248 .field("close_weak_asap", &self.close_weak_asap())
3249 .field("weak_vmo", &self.weak_vmo())
3250 .field("single_buffer_settings", &self.single_buffer_settings())
3251 .field("constraints_ok", &self.constraints_ok())
3252 .field("vmo_settings_match", &self.vmo_settings_match())
3253 .finish()
3254 }
3255 }
3256
3257 impl<'de> ::fidl_next::IntoNatural for AllocatorGetVmoInfoResponse<'de> {
3258 type Natural = crate::natural::AllocatorGetVmoInfoResponse;
3259 }
3260
3261 #[repr(C)]
3263 pub struct NodeGetNodeRefResponse<'de> {
3264 pub(crate) table: ::fidl_next::wire::Table<'de>,
3265 }
3266
3267 impl<'de> Drop for NodeGetNodeRefResponse<'de> {
3268 fn drop(&mut self) {
3269 let _ = self.table.get(1).map(|envelope| unsafe {
3270 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
3271 });
3272 }
3273 }
3274
3275 impl ::fidl_next::Constrained for NodeGetNodeRefResponse<'_> {
3276 type Constraint = ();
3277
3278 fn validate(
3279 _: ::fidl_next::Slot<'_, Self>,
3280 _: Self::Constraint,
3281 ) -> Result<(), ::fidl_next::ValidationError> {
3282 Ok(())
3283 }
3284 }
3285
3286 unsafe impl ::fidl_next::Wire for NodeGetNodeRefResponse<'static> {
3287 type Narrowed<'de> = NodeGetNodeRefResponse<'de>;
3288
3289 #[inline]
3290 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3291 ::fidl_next::munge!(let Self { table } = out);
3292 ::fidl_next::wire::Table::zero_padding(table);
3293 }
3294 }
3295
3296 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeGetNodeRefResponse<'de>
3297 where
3298 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3299 ___D: ::fidl_next::fuchsia::HandleDecoder,
3300 {
3301 fn decode(
3302 slot: ::fidl_next::Slot<'_, Self>,
3303 decoder: &mut ___D,
3304 _: (),
3305 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3306 ::fidl_next::munge!(let Self { table } = slot);
3307
3308 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3309 match ordinal {
3310 0 => unsafe { ::core::hint::unreachable_unchecked() },
3311
3312 1 => {
3313 ::fidl_next::wire::Envelope::decode_as::<
3314 ___D,
3315 ::fidl_next::wire::fuchsia::Event,
3316 >(slot.as_mut(), decoder, ())?;
3317
3318 Ok(())
3319 }
3320
3321 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3322 }
3323 })
3324 }
3325 }
3326
3327 impl<'de> NodeGetNodeRefResponse<'de> {
3328 pub fn node_ref(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
3329 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3330 }
3331
3332 pub fn take_node_ref(
3333 &mut self,
3334 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
3335 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
3336 }
3337 }
3338
3339 impl<'de> ::core::fmt::Debug for NodeGetNodeRefResponse<'de> {
3340 fn fmt(
3341 &self,
3342 f: &mut ::core::fmt::Formatter<'_>,
3343 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3344 f.debug_struct("NodeGetNodeRefResponse").field("node_ref", &self.node_ref()).finish()
3345 }
3346 }
3347
3348 impl<'de> ::fidl_next::IntoNatural for NodeGetNodeRefResponse<'de> {
3349 type Natural = crate::natural::NodeGetNodeRefResponse;
3350 }
3351
3352 #[repr(C)]
3354 pub struct NodeIsAlternateForRequest<'de> {
3355 pub(crate) table: ::fidl_next::wire::Table<'de>,
3356 }
3357
3358 impl<'de> Drop for NodeIsAlternateForRequest<'de> {
3359 fn drop(&mut self) {
3360 let _ = self.table.get(1).map(|envelope| unsafe {
3361 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
3362 });
3363 }
3364 }
3365
3366 impl ::fidl_next::Constrained for NodeIsAlternateForRequest<'_> {
3367 type Constraint = ();
3368
3369 fn validate(
3370 _: ::fidl_next::Slot<'_, Self>,
3371 _: Self::Constraint,
3372 ) -> Result<(), ::fidl_next::ValidationError> {
3373 Ok(())
3374 }
3375 }
3376
3377 unsafe impl ::fidl_next::Wire for NodeIsAlternateForRequest<'static> {
3378 type Narrowed<'de> = NodeIsAlternateForRequest<'de>;
3379
3380 #[inline]
3381 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3382 ::fidl_next::munge!(let Self { table } = out);
3383 ::fidl_next::wire::Table::zero_padding(table);
3384 }
3385 }
3386
3387 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeIsAlternateForRequest<'de>
3388 where
3389 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3390 ___D: ::fidl_next::fuchsia::HandleDecoder,
3391 {
3392 fn decode(
3393 slot: ::fidl_next::Slot<'_, Self>,
3394 decoder: &mut ___D,
3395 _: (),
3396 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3397 ::fidl_next::munge!(let Self { table } = slot);
3398
3399 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3400 match ordinal {
3401 0 => unsafe { ::core::hint::unreachable_unchecked() },
3402
3403 1 => {
3404 ::fidl_next::wire::Envelope::decode_as::<
3405 ___D,
3406 ::fidl_next::wire::fuchsia::Event,
3407 >(slot.as_mut(), decoder, ())?;
3408
3409 Ok(())
3410 }
3411
3412 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3413 }
3414 })
3415 }
3416 }
3417
3418 impl<'de> NodeIsAlternateForRequest<'de> {
3419 pub fn node_ref(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
3420 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3421 }
3422
3423 pub fn take_node_ref(
3424 &mut self,
3425 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Event> {
3426 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
3427 }
3428 }
3429
3430 impl<'de> ::core::fmt::Debug for NodeIsAlternateForRequest<'de> {
3431 fn fmt(
3432 &self,
3433 f: &mut ::core::fmt::Formatter<'_>,
3434 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3435 f.debug_struct("NodeIsAlternateForRequest").field("node_ref", &self.node_ref()).finish()
3436 }
3437 }
3438
3439 impl<'de> ::fidl_next::IntoNatural for NodeIsAlternateForRequest<'de> {
3440 type Natural = crate::natural::NodeIsAlternateForRequest;
3441 }
3442
3443 #[repr(C)]
3445 pub struct NodeSetWeakOkRequest<'de> {
3446 pub(crate) table: ::fidl_next::wire::Table<'de>,
3447 }
3448
3449 impl<'de> Drop for NodeSetWeakOkRequest<'de> {
3450 fn drop(&mut self) {
3451 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
3452 }
3453 }
3454
3455 impl ::fidl_next::Constrained for NodeSetWeakOkRequest<'_> {
3456 type Constraint = ();
3457
3458 fn validate(
3459 _: ::fidl_next::Slot<'_, Self>,
3460 _: Self::Constraint,
3461 ) -> Result<(), ::fidl_next::ValidationError> {
3462 Ok(())
3463 }
3464 }
3465
3466 unsafe impl ::fidl_next::Wire for NodeSetWeakOkRequest<'static> {
3467 type Narrowed<'de> = NodeSetWeakOkRequest<'de>;
3468
3469 #[inline]
3470 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3471 ::fidl_next::munge!(let Self { table } = out);
3472 ::fidl_next::wire::Table::zero_padding(table);
3473 }
3474 }
3475
3476 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeSetWeakOkRequest<'de>
3477 where
3478 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3479 ___D: ::fidl_next::fuchsia::HandleDecoder,
3480 {
3481 fn decode(
3482 slot: ::fidl_next::Slot<'_, Self>,
3483 decoder: &mut ___D,
3484 _: (),
3485 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3486 ::fidl_next::munge!(let Self { table } = slot);
3487
3488 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3489 match ordinal {
3490 0 => unsafe { ::core::hint::unreachable_unchecked() },
3491
3492 1 => {
3493 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
3494 slot.as_mut(),
3495 decoder,
3496 (),
3497 )?;
3498
3499 Ok(())
3500 }
3501
3502 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3503 }
3504 })
3505 }
3506 }
3507
3508 impl<'de> NodeSetWeakOkRequest<'de> {
3509 pub fn for_child_nodes_also(&self) -> ::core::option::Option<&bool> {
3510 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3511 }
3512
3513 pub fn take_for_child_nodes_also(&mut self) -> ::core::option::Option<bool> {
3514 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
3515 }
3516 }
3517
3518 impl<'de> ::core::fmt::Debug for NodeSetWeakOkRequest<'de> {
3519 fn fmt(
3520 &self,
3521 f: &mut ::core::fmt::Formatter<'_>,
3522 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3523 f.debug_struct("NodeSetWeakOkRequest")
3524 .field("for_child_nodes_also", &self.for_child_nodes_also())
3525 .finish()
3526 }
3527 }
3528
3529 impl<'de> ::fidl_next::IntoNatural for NodeSetWeakOkRequest<'de> {
3530 type Natural = crate::natural::NodeSetWeakOkRequest;
3531 }
3532
3533 #[repr(C)]
3535 pub struct VmoBuffer<'de> {
3536 pub(crate) table: ::fidl_next::wire::Table<'de>,
3537 }
3538
3539 impl<'de> Drop for VmoBuffer<'de> {
3540 fn drop(&mut self) {
3541 let _ = self.table.get(1).map(|envelope| unsafe {
3542 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
3543 });
3544
3545 let _ = self
3546 .table
3547 .get(2)
3548 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
3549
3550 let _ = self.table.get(3).map(|envelope| unsafe {
3551 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
3552 });
3553 }
3554 }
3555
3556 impl ::fidl_next::Constrained for VmoBuffer<'_> {
3557 type Constraint = ();
3558
3559 fn validate(
3560 _: ::fidl_next::Slot<'_, Self>,
3561 _: Self::Constraint,
3562 ) -> Result<(), ::fidl_next::ValidationError> {
3563 Ok(())
3564 }
3565 }
3566
3567 unsafe impl ::fidl_next::Wire for VmoBuffer<'static> {
3568 type Narrowed<'de> = VmoBuffer<'de>;
3569
3570 #[inline]
3571 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3572 ::fidl_next::munge!(let Self { table } = out);
3573 ::fidl_next::wire::Table::zero_padding(table);
3574 }
3575 }
3576
3577 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for VmoBuffer<'de>
3578 where
3579 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3580 ___D: ::fidl_next::fuchsia::HandleDecoder,
3581 {
3582 fn decode(
3583 slot: ::fidl_next::Slot<'_, Self>,
3584 decoder: &mut ___D,
3585 _: (),
3586 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3587 ::fidl_next::munge!(let Self { table } = slot);
3588
3589 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3590 match ordinal {
3591 0 => unsafe { ::core::hint::unreachable_unchecked() },
3592
3593 1 => {
3594 ::fidl_next::wire::Envelope::decode_as::<
3595 ___D,
3596 ::fidl_next::wire::fuchsia::Vmo,
3597 >(slot.as_mut(), decoder, ())?;
3598
3599 Ok(())
3600 }
3601
3602 2 => {
3603 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
3604 slot.as_mut(),
3605 decoder,
3606 (),
3607 )?;
3608
3609 Ok(())
3610 }
3611
3612 3 => {
3613 ::fidl_next::wire::Envelope::decode_as::<
3614 ___D,
3615 ::fidl_next::wire::fuchsia::EventPair,
3616 >(slot.as_mut(), decoder, ())?;
3617
3618 Ok(())
3619 }
3620
3621 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3622 }
3623 })
3624 }
3625 }
3626
3627 impl<'de> VmoBuffer<'de> {
3628 pub fn vmo(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
3629 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3630 }
3631
3632 pub fn take_vmo(&mut self) -> ::core::option::Option<::fidl_next::wire::fuchsia::Vmo> {
3633 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
3634 }
3635
3636 pub fn vmo_usable_start(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
3637 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3638 }
3639
3640 pub fn take_vmo_usable_start(
3641 &mut self,
3642 ) -> ::core::option::Option<::fidl_next::wire::Uint64> {
3643 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
3644 }
3645
3646 pub fn close_weak_asap(
3647 &self,
3648 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
3649 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
3650 }
3651
3652 pub fn take_close_weak_asap(
3653 &mut self,
3654 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::EventPair> {
3655 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
3656 }
3657 }
3658
3659 impl<'de> ::core::fmt::Debug for VmoBuffer<'de> {
3660 fn fmt(
3661 &self,
3662 f: &mut ::core::fmt::Formatter<'_>,
3663 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3664 f.debug_struct("VmoBuffer")
3665 .field("vmo", &self.vmo())
3666 .field("vmo_usable_start", &self.vmo_usable_start())
3667 .field("close_weak_asap", &self.close_weak_asap())
3668 .finish()
3669 }
3670 }
3671
3672 impl<'de> ::fidl_next::IntoNatural for VmoBuffer<'de> {
3673 type Natural = crate::natural::VmoBuffer;
3674 }
3675
3676 #[repr(C)]
3678 pub struct BufferCollectionAttachLifetimeTrackingRequest<'de> {
3679 pub(crate) table: ::fidl_next::wire::Table<'de>,
3680 }
3681
3682 impl<'de> Drop for BufferCollectionAttachLifetimeTrackingRequest<'de> {
3683 fn drop(&mut self) {
3684 let _ = self.table.get(1).map(|envelope| unsafe {
3685 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
3686 });
3687
3688 let _ = self
3689 .table
3690 .get(2)
3691 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
3692 }
3693 }
3694
3695 impl ::fidl_next::Constrained for BufferCollectionAttachLifetimeTrackingRequest<'_> {
3696 type Constraint = ();
3697
3698 fn validate(
3699 _: ::fidl_next::Slot<'_, Self>,
3700 _: Self::Constraint,
3701 ) -> Result<(), ::fidl_next::ValidationError> {
3702 Ok(())
3703 }
3704 }
3705
3706 unsafe impl ::fidl_next::Wire for BufferCollectionAttachLifetimeTrackingRequest<'static> {
3707 type Narrowed<'de> = BufferCollectionAttachLifetimeTrackingRequest<'de>;
3708
3709 #[inline]
3710 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3711 ::fidl_next::munge!(let Self { table } = out);
3712 ::fidl_next::wire::Table::zero_padding(table);
3713 }
3714 }
3715
3716 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
3717 for BufferCollectionAttachLifetimeTrackingRequest<'de>
3718 where
3719 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3720 ___D: ::fidl_next::fuchsia::HandleDecoder,
3721 {
3722 fn decode(
3723 slot: ::fidl_next::Slot<'_, Self>,
3724 decoder: &mut ___D,
3725 _: (),
3726 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3727 ::fidl_next::munge!(let Self { table } = slot);
3728
3729 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3730 match ordinal {
3731 0 => unsafe { ::core::hint::unreachable_unchecked() },
3732
3733 1 => {
3734 ::fidl_next::wire::Envelope::decode_as::<
3735 ___D,
3736 ::fidl_next::wire::fuchsia::EventPair,
3737 >(slot.as_mut(), decoder, ())?;
3738
3739 Ok(())
3740 }
3741
3742 2 => {
3743 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
3744 slot.as_mut(),
3745 decoder,
3746 (),
3747 )?;
3748
3749 Ok(())
3750 }
3751
3752 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3753 }
3754 })
3755 }
3756 }
3757
3758 impl<'de> BufferCollectionAttachLifetimeTrackingRequest<'de> {
3759 pub fn server_end(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
3760 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3761 }
3762
3763 pub fn take_server_end(
3764 &mut self,
3765 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::EventPair> {
3766 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
3767 }
3768
3769 pub fn buffers_remaining(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
3770 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3771 }
3772
3773 pub fn take_buffers_remaining(
3774 &mut self,
3775 ) -> ::core::option::Option<::fidl_next::wire::Uint32> {
3776 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
3777 }
3778 }
3779
3780 impl<'de> ::core::fmt::Debug for BufferCollectionAttachLifetimeTrackingRequest<'de> {
3781 fn fmt(
3782 &self,
3783 f: &mut ::core::fmt::Formatter<'_>,
3784 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3785 f.debug_struct("BufferCollectionAttachLifetimeTrackingRequest")
3786 .field("server_end", &self.server_end())
3787 .field("buffers_remaining", &self.buffers_remaining())
3788 .finish()
3789 }
3790 }
3791
3792 impl<'de> ::fidl_next::IntoNatural for BufferCollectionAttachLifetimeTrackingRequest<'de> {
3793 type Natural = crate::natural::BufferCollectionAttachLifetimeTrackingRequest;
3794 }
3795
3796 #[repr(C)]
3798 pub struct NodeAttachNodeTrackingRequest<'de> {
3799 pub(crate) table: ::fidl_next::wire::Table<'de>,
3800 }
3801
3802 impl<'de> Drop for NodeAttachNodeTrackingRequest<'de> {
3803 fn drop(&mut self) {
3804 let _ = self.table.get(1).map(|envelope| unsafe {
3805 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
3806 });
3807 }
3808 }
3809
3810 impl ::fidl_next::Constrained for NodeAttachNodeTrackingRequest<'_> {
3811 type Constraint = ();
3812
3813 fn validate(
3814 _: ::fidl_next::Slot<'_, Self>,
3815 _: Self::Constraint,
3816 ) -> Result<(), ::fidl_next::ValidationError> {
3817 Ok(())
3818 }
3819 }
3820
3821 unsafe impl ::fidl_next::Wire for NodeAttachNodeTrackingRequest<'static> {
3822 type Narrowed<'de> = NodeAttachNodeTrackingRequest<'de>;
3823
3824 #[inline]
3825 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3826 ::fidl_next::munge!(let Self { table } = out);
3827 ::fidl_next::wire::Table::zero_padding(table);
3828 }
3829 }
3830
3831 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeAttachNodeTrackingRequest<'de>
3832 where
3833 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3834 ___D: ::fidl_next::fuchsia::HandleDecoder,
3835 {
3836 fn decode(
3837 slot: ::fidl_next::Slot<'_, Self>,
3838 decoder: &mut ___D,
3839 _: (),
3840 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3841 ::fidl_next::munge!(let Self { table } = slot);
3842
3843 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3844 match ordinal {
3845 0 => unsafe { ::core::hint::unreachable_unchecked() },
3846
3847 1 => {
3848 ::fidl_next::wire::Envelope::decode_as::<
3849 ___D,
3850 ::fidl_next::wire::fuchsia::EventPair,
3851 >(slot.as_mut(), decoder, ())?;
3852
3853 Ok(())
3854 }
3855
3856 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3857 }
3858 })
3859 }
3860 }
3861
3862 impl<'de> NodeAttachNodeTrackingRequest<'de> {
3863 pub fn server_end(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
3864 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3865 }
3866
3867 pub fn take_server_end(
3868 &mut self,
3869 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::EventPair> {
3870 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
3871 }
3872 }
3873
3874 impl<'de> ::core::fmt::Debug for NodeAttachNodeTrackingRequest<'de> {
3875 fn fmt(
3876 &self,
3877 f: &mut ::core::fmt::Formatter<'_>,
3878 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3879 f.debug_struct("NodeAttachNodeTrackingRequest")
3880 .field("server_end", &self.server_end())
3881 .finish()
3882 }
3883 }
3884
3885 impl<'de> ::fidl_next::IntoNatural for NodeAttachNodeTrackingRequest<'de> {
3886 type Natural = crate::natural::NodeAttachNodeTrackingRequest;
3887 }
3888
3889 #[repr(C)]
3891 pub struct BufferCollectionInfo<'de> {
3892 pub(crate) table: ::fidl_next::wire::Table<'de>,
3893 }
3894
3895 impl<'de> Drop for BufferCollectionInfo<'de> {
3896 fn drop(&mut self) {
3897 let _ = self.table.get(1).map(|envelope| unsafe {
3898 envelope.read_unchecked::<crate::wire::SingleBufferSettings<'de>>()
3899 });
3900
3901 let _ = self.table.get(2)
3902 .map(|envelope| unsafe {
3903 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>>()
3904 });
3905
3906 let _ = self
3907 .table
3908 .get(3)
3909 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
3910 }
3911 }
3912
3913 impl ::fidl_next::Constrained for BufferCollectionInfo<'_> {
3914 type Constraint = ();
3915
3916 fn validate(
3917 _: ::fidl_next::Slot<'_, Self>,
3918 _: Self::Constraint,
3919 ) -> Result<(), ::fidl_next::ValidationError> {
3920 Ok(())
3921 }
3922 }
3923
3924 unsafe impl ::fidl_next::Wire for BufferCollectionInfo<'static> {
3925 type Narrowed<'de> = BufferCollectionInfo<'de>;
3926
3927 #[inline]
3928 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3929 ::fidl_next::munge!(let Self { table } = out);
3930 ::fidl_next::wire::Table::zero_padding(table);
3931 }
3932 }
3933
3934 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionInfo<'de>
3935 where
3936 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3937 ___D: ::fidl_next::fuchsia::HandleDecoder,
3938 {
3939 fn decode(
3940 slot: ::fidl_next::Slot<'_, Self>,
3941 decoder: &mut ___D,
3942 _: (),
3943 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3944 ::fidl_next::munge!(let Self { table } = slot);
3945
3946 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3947 match ordinal {
3948 0 => unsafe { ::core::hint::unreachable_unchecked() },
3949
3950 1 => {
3951 ::fidl_next::wire::Envelope::decode_as::<
3952 ___D,
3953 crate::wire::SingleBufferSettings<'de>,
3954 >(slot.as_mut(), decoder, ())?;
3955
3956 Ok(())
3957 }
3958
3959 2 => {
3960 ::fidl_next::wire::Envelope::decode_as::<
3961 ___D,
3962 ::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>,
3963 >(slot.as_mut(), decoder, (128, ()))?;
3964
3965 let value = unsafe {
3966 slot
3967 .deref_unchecked()
3968 .deref_unchecked::<
3969 ::fidl_next::wire::Vector<'_, crate::wire::VmoBuffer<'_>>
3970 >()
3971 };
3972
3973 if value.len() > 128 {
3974 return Err(::fidl_next::DecodeError::VectorTooLong {
3975 size: value.len() as u64,
3976 limit: 128,
3977 });
3978 }
3979
3980 Ok(())
3981 }
3982
3983 3 => {
3984 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
3985 slot.as_mut(),
3986 decoder,
3987 (),
3988 )?;
3989
3990 Ok(())
3991 }
3992
3993 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3994 }
3995 })
3996 }
3997 }
3998
3999 impl<'de> BufferCollectionInfo<'de> {
4000 pub fn settings(&self) -> ::core::option::Option<&crate::wire::SingleBufferSettings<'de>> {
4001 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4002 }
4003
4004 pub fn take_settings(
4005 &mut self,
4006 ) -> ::core::option::Option<crate::wire::SingleBufferSettings<'de>> {
4007 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4008 }
4009
4010 pub fn buffers(
4011 &self,
4012 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>>
4013 {
4014 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4015 }
4016
4017 pub fn take_buffers(
4018 &mut self,
4019 ) -> ::core::option::Option<::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>>
4020 {
4021 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4022 }
4023
4024 pub fn buffer_collection_id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
4025 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
4026 }
4027
4028 pub fn take_buffer_collection_id(
4029 &mut self,
4030 ) -> ::core::option::Option<::fidl_next::wire::Uint64> {
4031 unsafe { Some(self.table.get_mut(3)?.take_unchecked()) }
4032 }
4033 }
4034
4035 impl<'de> ::core::fmt::Debug for BufferCollectionInfo<'de> {
4036 fn fmt(
4037 &self,
4038 f: &mut ::core::fmt::Formatter<'_>,
4039 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4040 f.debug_struct("BufferCollectionInfo")
4041 .field("settings", &self.settings())
4042 .field("buffers", &self.buffers())
4043 .field("buffer_collection_id", &self.buffer_collection_id())
4044 .finish()
4045 }
4046 }
4047
4048 impl<'de> ::fidl_next::IntoNatural for BufferCollectionInfo<'de> {
4049 type Natural = crate::natural::BufferCollectionInfo;
4050 }
4051
4052 #[repr(C)]
4054 pub struct BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
4055 pub(crate) table: ::fidl_next::wire::Table<'de>,
4056 }
4057
4058 impl<'de> Drop for BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
4059 fn drop(&mut self) {
4060 let _ = self.table.get(1).map(|envelope| unsafe {
4061 envelope.read_unchecked::<crate::wire::BufferCollectionInfo<'de>>()
4062 });
4063 }
4064 }
4065
4066 impl ::fidl_next::Constrained for BufferCollectionWaitForAllBuffersAllocatedResponse<'_> {
4067 type Constraint = ();
4068
4069 fn validate(
4070 _: ::fidl_next::Slot<'_, Self>,
4071 _: Self::Constraint,
4072 ) -> Result<(), ::fidl_next::ValidationError> {
4073 Ok(())
4074 }
4075 }
4076
4077 unsafe impl ::fidl_next::Wire for BufferCollectionWaitForAllBuffersAllocatedResponse<'static> {
4078 type Narrowed<'de> = BufferCollectionWaitForAllBuffersAllocatedResponse<'de>;
4079
4080 #[inline]
4081 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4082 ::fidl_next::munge!(let Self { table } = out);
4083 ::fidl_next::wire::Table::zero_padding(table);
4084 }
4085 }
4086
4087 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
4088 for BufferCollectionWaitForAllBuffersAllocatedResponse<'de>
4089 where
4090 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4091 ___D: ::fidl_next::fuchsia::HandleDecoder,
4092 {
4093 fn decode(
4094 slot: ::fidl_next::Slot<'_, Self>,
4095 decoder: &mut ___D,
4096 _: (),
4097 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4098 ::fidl_next::munge!(let Self { table } = slot);
4099
4100 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4101 match ordinal {
4102 0 => unsafe { ::core::hint::unreachable_unchecked() },
4103
4104 1 => {
4105 ::fidl_next::wire::Envelope::decode_as::<
4106 ___D,
4107 crate::wire::BufferCollectionInfo<'de>,
4108 >(slot.as_mut(), decoder, ())?;
4109
4110 Ok(())
4111 }
4112
4113 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4114 }
4115 })
4116 }
4117 }
4118
4119 impl<'de> BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
4120 pub fn buffer_collection_info(
4121 &self,
4122 ) -> ::core::option::Option<&crate::wire::BufferCollectionInfo<'de>> {
4123 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4124 }
4125
4126 pub fn take_buffer_collection_info(
4127 &mut self,
4128 ) -> ::core::option::Option<crate::wire::BufferCollectionInfo<'de>> {
4129 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4130 }
4131 }
4132
4133 impl<'de> ::core::fmt::Debug for BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
4134 fn fmt(
4135 &self,
4136 f: &mut ::core::fmt::Formatter<'_>,
4137 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4138 f.debug_struct("BufferCollectionWaitForAllBuffersAllocatedResponse")
4139 .field("buffer_collection_info", &self.buffer_collection_info())
4140 .finish()
4141 }
4142 }
4143
4144 impl<'de> ::fidl_next::IntoNatural for BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
4145 type Natural = crate::natural::BufferCollectionWaitForAllBuffersAllocatedResponse;
4146 }
4147
4148 #[repr(C)]
4150 pub struct BufferCollectionSetConstraintsRequest<'de> {
4151 pub(crate) table: ::fidl_next::wire::Table<'de>,
4152 }
4153
4154 impl<'de> Drop for BufferCollectionSetConstraintsRequest<'de> {
4155 fn drop(&mut self) {
4156 let _ = self.table.get(1).map(|envelope| unsafe {
4157 envelope.read_unchecked::<crate::wire::BufferCollectionConstraints<'de>>()
4158 });
4159
4160 let _ = self.table.get(2).map(|envelope| unsafe {
4161 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
4162 });
4163 }
4164 }
4165
4166 impl ::fidl_next::Constrained for BufferCollectionSetConstraintsRequest<'_> {
4167 type Constraint = ();
4168
4169 fn validate(
4170 _: ::fidl_next::Slot<'_, Self>,
4171 _: Self::Constraint,
4172 ) -> Result<(), ::fidl_next::ValidationError> {
4173 Ok(())
4174 }
4175 }
4176
4177 unsafe impl ::fidl_next::Wire for BufferCollectionSetConstraintsRequest<'static> {
4178 type Narrowed<'de> = BufferCollectionSetConstraintsRequest<'de>;
4179
4180 #[inline]
4181 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4182 ::fidl_next::munge!(let Self { table } = out);
4183 ::fidl_next::wire::Table::zero_padding(table);
4184 }
4185 }
4186
4187 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionSetConstraintsRequest<'de>
4188 where
4189 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4190 ___D: ::fidl_next::fuchsia::HandleDecoder,
4191 {
4192 fn decode(
4193 slot: ::fidl_next::Slot<'_, Self>,
4194 decoder: &mut ___D,
4195 _: (),
4196 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4197 ::fidl_next::munge!(let Self { table } = slot);
4198
4199 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4200 match ordinal {
4201 0 => unsafe { ::core::hint::unreachable_unchecked() },
4202
4203 1 => {
4204 ::fidl_next::wire::Envelope::decode_as::<
4205 ___D,
4206 crate::wire::BufferCollectionConstraints<'de>,
4207 >(slot.as_mut(), decoder, ())?;
4208
4209 Ok(())
4210 }
4211
4212 2 => {
4213 ::fidl_next::wire::Envelope::decode_as::<
4214 ___D,
4215 ::fidl_next::wire::fuchsia::Vmo,
4216 >(slot.as_mut(), decoder, ())?;
4217
4218 Ok(())
4219 }
4220
4221 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4222 }
4223 })
4224 }
4225 }
4226
4227 impl<'de> BufferCollectionSetConstraintsRequest<'de> {
4228 pub fn constraints(
4229 &self,
4230 ) -> ::core::option::Option<&crate::wire::BufferCollectionConstraints<'de>> {
4231 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4232 }
4233
4234 pub fn take_constraints(
4235 &mut self,
4236 ) -> ::core::option::Option<crate::wire::BufferCollectionConstraints<'de>> {
4237 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4238 }
4239
4240 pub fn must_match_vmo(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
4241 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4242 }
4243
4244 pub fn take_must_match_vmo(
4245 &mut self,
4246 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Vmo> {
4247 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4248 }
4249 }
4250
4251 impl<'de> ::core::fmt::Debug for BufferCollectionSetConstraintsRequest<'de> {
4252 fn fmt(
4253 &self,
4254 f: &mut ::core::fmt::Formatter<'_>,
4255 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4256 f.debug_struct("BufferCollectionSetConstraintsRequest")
4257 .field("constraints", &self.constraints())
4258 .field("must_match_vmo", &self.must_match_vmo())
4259 .finish()
4260 }
4261 }
4262
4263 impl<'de> ::fidl_next::IntoNatural for BufferCollectionSetConstraintsRequest<'de> {
4264 type Natural = crate::natural::BufferCollectionSetConstraintsRequest;
4265 }
4266
4267 #[repr(C)]
4269 pub struct BufferCollectionAttachTokenRequest<'de> {
4270 pub(crate) table: ::fidl_next::wire::Table<'de>,
4271 }
4272
4273 impl<'de> Drop for BufferCollectionAttachTokenRequest<'de> {
4274 fn drop(&mut self) {
4275 let _ = self.table.get(1).map(|envelope| unsafe {
4276 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
4277 });
4278
4279 let _ = self.table.get(2).map(|envelope| unsafe {
4280 envelope.read_unchecked::<::fidl_next::ServerEnd<
4281 crate::BufferCollectionToken,
4282 ::fidl_next::wire::fuchsia::Channel,
4283 >>()
4284 });
4285 }
4286 }
4287
4288 impl ::fidl_next::Constrained for BufferCollectionAttachTokenRequest<'_> {
4289 type Constraint = ();
4290
4291 fn validate(
4292 _: ::fidl_next::Slot<'_, Self>,
4293 _: Self::Constraint,
4294 ) -> Result<(), ::fidl_next::ValidationError> {
4295 Ok(())
4296 }
4297 }
4298
4299 unsafe impl ::fidl_next::Wire for BufferCollectionAttachTokenRequest<'static> {
4300 type Narrowed<'de> = BufferCollectionAttachTokenRequest<'de>;
4301
4302 #[inline]
4303 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4304 ::fidl_next::munge!(let Self { table } = out);
4305 ::fidl_next::wire::Table::zero_padding(table);
4306 }
4307 }
4308
4309 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionAttachTokenRequest<'de>
4310 where
4311 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4312 ___D: ::fidl_next::fuchsia::HandleDecoder,
4313 {
4314 fn decode(
4315 slot: ::fidl_next::Slot<'_, Self>,
4316 decoder: &mut ___D,
4317 _: (),
4318 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4319 ::fidl_next::munge!(let Self { table } = slot);
4320
4321 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4322 match ordinal {
4323 0 => unsafe { ::core::hint::unreachable_unchecked() },
4324
4325 1 => {
4326 ::fidl_next::wire::Envelope::decode_as::<
4327 ___D,
4328 ::fidl_next::wire::fuchsia::Rights,
4329 >(slot.as_mut(), decoder, ())?;
4330
4331 Ok(())
4332 }
4333
4334 2 => {
4335 ::fidl_next::wire::Envelope::decode_as::<
4336 ___D,
4337 ::fidl_next::ServerEnd<
4338 crate::BufferCollectionToken,
4339 ::fidl_next::wire::fuchsia::Channel,
4340 >,
4341 >(slot.as_mut(), decoder, ())?;
4342
4343 Ok(())
4344 }
4345
4346 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4347 }
4348 })
4349 }
4350 }
4351
4352 impl<'de> BufferCollectionAttachTokenRequest<'de> {
4353 pub fn rights_attenuation_mask(
4354 &self,
4355 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Rights> {
4356 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4357 }
4358
4359 pub fn take_rights_attenuation_mask(
4360 &mut self,
4361 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Rights> {
4362 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4363 }
4364
4365 pub fn token_request(
4366 &self,
4367 ) -> ::core::option::Option<
4368 &::fidl_next::ServerEnd<
4369 crate::BufferCollectionToken,
4370 ::fidl_next::wire::fuchsia::Channel,
4371 >,
4372 > {
4373 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4374 }
4375
4376 pub fn take_token_request(
4377 &mut self,
4378 ) -> ::core::option::Option<
4379 ::fidl_next::ServerEnd<
4380 crate::BufferCollectionToken,
4381 ::fidl_next::wire::fuchsia::Channel,
4382 >,
4383 > {
4384 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4385 }
4386 }
4387
4388 impl<'de> ::core::fmt::Debug for BufferCollectionAttachTokenRequest<'de> {
4389 fn fmt(
4390 &self,
4391 f: &mut ::core::fmt::Formatter<'_>,
4392 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4393 f.debug_struct("BufferCollectionAttachTokenRequest")
4394 .field("rights_attenuation_mask", &self.rights_attenuation_mask())
4395 .field("token_request", &self.token_request())
4396 .finish()
4397 }
4398 }
4399
4400 impl<'de> ::fidl_next::IntoNatural for BufferCollectionAttachTokenRequest<'de> {
4401 type Natural = crate::natural::BufferCollectionAttachTokenRequest;
4402 }
4403
4404 #[repr(C)]
4406 pub struct BufferCollectionTokenDuplicateSyncResponse<'de> {
4407 pub(crate) table: ::fidl_next::wire::Table<'de>,
4408 }
4409
4410 impl<'de> Drop for BufferCollectionTokenDuplicateSyncResponse<'de> {
4411 fn drop(&mut self) {
4412 let _ = self.table.get(1).map(|envelope| unsafe {
4413 envelope.read_unchecked::<::fidl_next::wire::Vector<
4414 'de,
4415 ::fidl_next::ClientEnd<
4416 crate::BufferCollectionToken,
4417 ::fidl_next::wire::fuchsia::Channel,
4418 >,
4419 >>()
4420 });
4421 }
4422 }
4423
4424 impl ::fidl_next::Constrained for BufferCollectionTokenDuplicateSyncResponse<'_> {
4425 type Constraint = ();
4426
4427 fn validate(
4428 _: ::fidl_next::Slot<'_, Self>,
4429 _: Self::Constraint,
4430 ) -> Result<(), ::fidl_next::ValidationError> {
4431 Ok(())
4432 }
4433 }
4434
4435 unsafe impl ::fidl_next::Wire for BufferCollectionTokenDuplicateSyncResponse<'static> {
4436 type Narrowed<'de> = BufferCollectionTokenDuplicateSyncResponse<'de>;
4437
4438 #[inline]
4439 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4440 ::fidl_next::munge!(let Self { table } = out);
4441 ::fidl_next::wire::Table::zero_padding(table);
4442 }
4443 }
4444
4445 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionTokenDuplicateSyncResponse<'de>
4446 where
4447 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4448 ___D: ::fidl_next::fuchsia::HandleDecoder,
4449 {
4450 fn decode(
4451 slot: ::fidl_next::Slot<'_, Self>,
4452 decoder: &mut ___D,
4453 _: (),
4454 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4455 ::fidl_next::munge!(let Self { table } = slot);
4456
4457 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4458 match ordinal {
4459 0 => unsafe { ::core::hint::unreachable_unchecked() },
4460
4461 1 => {
4462 ::fidl_next::wire::Envelope::decode_as::<
4463 ___D,
4464 ::fidl_next::wire::Vector<
4465 'de,
4466 ::fidl_next::ClientEnd<
4467 crate::BufferCollectionToken,
4468 ::fidl_next::wire::fuchsia::Channel,
4469 >,
4470 >,
4471 >(slot.as_mut(), decoder, (64, ()))?;
4472
4473 let value = unsafe {
4474 slot.deref_unchecked().deref_unchecked::<::fidl_next::wire::Vector<
4475 '_,
4476 ::fidl_next::ClientEnd<
4477 crate::BufferCollectionToken,
4478 ::fidl_next::wire::fuchsia::Channel,
4479 >,
4480 >>()
4481 };
4482
4483 if value.len() > 64 {
4484 return Err(::fidl_next::DecodeError::VectorTooLong {
4485 size: value.len() as u64,
4486 limit: 64,
4487 });
4488 }
4489
4490 Ok(())
4491 }
4492
4493 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4494 }
4495 })
4496 }
4497 }
4498
4499 impl<'de> BufferCollectionTokenDuplicateSyncResponse<'de> {
4500 pub fn tokens(
4501 &self,
4502 ) -> ::core::option::Option<
4503 &::fidl_next::wire::Vector<
4504 'de,
4505 ::fidl_next::ClientEnd<
4506 crate::BufferCollectionToken,
4507 ::fidl_next::wire::fuchsia::Channel,
4508 >,
4509 >,
4510 > {
4511 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4512 }
4513
4514 pub fn take_tokens(
4515 &mut self,
4516 ) -> ::core::option::Option<
4517 ::fidl_next::wire::Vector<
4518 'de,
4519 ::fidl_next::ClientEnd<
4520 crate::BufferCollectionToken,
4521 ::fidl_next::wire::fuchsia::Channel,
4522 >,
4523 >,
4524 > {
4525 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4526 }
4527 }
4528
4529 impl<'de> ::core::fmt::Debug for BufferCollectionTokenDuplicateSyncResponse<'de> {
4530 fn fmt(
4531 &self,
4532 f: &mut ::core::fmt::Formatter<'_>,
4533 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4534 f.debug_struct("BufferCollectionTokenDuplicateSyncResponse")
4535 .field("tokens", &self.tokens())
4536 .finish()
4537 }
4538 }
4539
4540 impl<'de> ::fidl_next::IntoNatural for BufferCollectionTokenDuplicateSyncResponse<'de> {
4541 type Natural = crate::natural::BufferCollectionTokenDuplicateSyncResponse;
4542 }
4543
4544 #[repr(C)]
4546 pub struct BufferCollectionTokenDuplicateRequest<'de> {
4547 pub(crate) table: ::fidl_next::wire::Table<'de>,
4548 }
4549
4550 impl<'de> Drop for BufferCollectionTokenDuplicateRequest<'de> {
4551 fn drop(&mut self) {
4552 let _ = self.table.get(1).map(|envelope| unsafe {
4553 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
4554 });
4555
4556 let _ = self.table.get(2).map(|envelope| unsafe {
4557 envelope.read_unchecked::<::fidl_next::ServerEnd<
4558 crate::BufferCollectionToken,
4559 ::fidl_next::wire::fuchsia::Channel,
4560 >>()
4561 });
4562 }
4563 }
4564
4565 impl ::fidl_next::Constrained for BufferCollectionTokenDuplicateRequest<'_> {
4566 type Constraint = ();
4567
4568 fn validate(
4569 _: ::fidl_next::Slot<'_, Self>,
4570 _: Self::Constraint,
4571 ) -> Result<(), ::fidl_next::ValidationError> {
4572 Ok(())
4573 }
4574 }
4575
4576 unsafe impl ::fidl_next::Wire for BufferCollectionTokenDuplicateRequest<'static> {
4577 type Narrowed<'de> = BufferCollectionTokenDuplicateRequest<'de>;
4578
4579 #[inline]
4580 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4581 ::fidl_next::munge!(let Self { table } = out);
4582 ::fidl_next::wire::Table::zero_padding(table);
4583 }
4584 }
4585
4586 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionTokenDuplicateRequest<'de>
4587 where
4588 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4589 ___D: ::fidl_next::fuchsia::HandleDecoder,
4590 {
4591 fn decode(
4592 slot: ::fidl_next::Slot<'_, Self>,
4593 decoder: &mut ___D,
4594 _: (),
4595 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4596 ::fidl_next::munge!(let Self { table } = slot);
4597
4598 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4599 match ordinal {
4600 0 => unsafe { ::core::hint::unreachable_unchecked() },
4601
4602 1 => {
4603 ::fidl_next::wire::Envelope::decode_as::<
4604 ___D,
4605 ::fidl_next::wire::fuchsia::Rights,
4606 >(slot.as_mut(), decoder, ())?;
4607
4608 Ok(())
4609 }
4610
4611 2 => {
4612 ::fidl_next::wire::Envelope::decode_as::<
4613 ___D,
4614 ::fidl_next::ServerEnd<
4615 crate::BufferCollectionToken,
4616 ::fidl_next::wire::fuchsia::Channel,
4617 >,
4618 >(slot.as_mut(), decoder, ())?;
4619
4620 Ok(())
4621 }
4622
4623 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4624 }
4625 })
4626 }
4627 }
4628
4629 impl<'de> BufferCollectionTokenDuplicateRequest<'de> {
4630 pub fn rights_attenuation_mask(
4631 &self,
4632 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Rights> {
4633 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4634 }
4635
4636 pub fn take_rights_attenuation_mask(
4637 &mut self,
4638 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Rights> {
4639 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4640 }
4641
4642 pub fn token_request(
4643 &self,
4644 ) -> ::core::option::Option<
4645 &::fidl_next::ServerEnd<
4646 crate::BufferCollectionToken,
4647 ::fidl_next::wire::fuchsia::Channel,
4648 >,
4649 > {
4650 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4651 }
4652
4653 pub fn take_token_request(
4654 &mut self,
4655 ) -> ::core::option::Option<
4656 ::fidl_next::ServerEnd<
4657 crate::BufferCollectionToken,
4658 ::fidl_next::wire::fuchsia::Channel,
4659 >,
4660 > {
4661 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4662 }
4663 }
4664
4665 impl<'de> ::core::fmt::Debug for BufferCollectionTokenDuplicateRequest<'de> {
4666 fn fmt(
4667 &self,
4668 f: &mut ::core::fmt::Formatter<'_>,
4669 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4670 f.debug_struct("BufferCollectionTokenDuplicateRequest")
4671 .field("rights_attenuation_mask", &self.rights_attenuation_mask())
4672 .field("token_request", &self.token_request())
4673 .finish()
4674 }
4675 }
4676
4677 impl<'de> ::fidl_next::IntoNatural for BufferCollectionTokenDuplicateRequest<'de> {
4678 type Natural = crate::natural::BufferCollectionTokenDuplicateRequest;
4679 }
4680
4681 #[repr(C)]
4683 pub struct BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de> {
4684 pub(crate) table: ::fidl_next::wire::Table<'de>,
4685 }
4686
4687 impl<'de> Drop for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de> {
4688 fn drop(&mut self) {
4689 let _ = self.table.get(1).map(|envelope| unsafe {
4690 envelope.read_unchecked::<::fidl_next::ServerEnd<
4691 crate::BufferCollectionTokenGroup,
4692 ::fidl_next::wire::fuchsia::Channel,
4693 >>()
4694 });
4695 }
4696 }
4697
4698 impl ::fidl_next::Constrained for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'_> {
4699 type Constraint = ();
4700
4701 fn validate(
4702 _: ::fidl_next::Slot<'_, Self>,
4703 _: Self::Constraint,
4704 ) -> Result<(), ::fidl_next::ValidationError> {
4705 Ok(())
4706 }
4707 }
4708
4709 unsafe impl ::fidl_next::Wire
4710 for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'static>
4711 {
4712 type Narrowed<'de> = BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>;
4713
4714 #[inline]
4715 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4716 ::fidl_next::munge!(let Self { table } = out);
4717 ::fidl_next::wire::Table::zero_padding(table);
4718 }
4719 }
4720
4721 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
4722 for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>
4723 where
4724 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4725 ___D: ::fidl_next::fuchsia::HandleDecoder,
4726 {
4727 fn decode(
4728 slot: ::fidl_next::Slot<'_, Self>,
4729 decoder: &mut ___D,
4730 _: (),
4731 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4732 ::fidl_next::munge!(let Self { table } = slot);
4733
4734 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4735 match ordinal {
4736 0 => unsafe { ::core::hint::unreachable_unchecked() },
4737
4738 1 => {
4739 ::fidl_next::wire::Envelope::decode_as::<
4740 ___D,
4741 ::fidl_next::ServerEnd<
4742 crate::BufferCollectionTokenGroup,
4743 ::fidl_next::wire::fuchsia::Channel,
4744 >,
4745 >(slot.as_mut(), decoder, ())?;
4746
4747 Ok(())
4748 }
4749
4750 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4751 }
4752 })
4753 }
4754 }
4755
4756 impl<'de> BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de> {
4757 pub fn group_request(
4758 &self,
4759 ) -> ::core::option::Option<
4760 &::fidl_next::ServerEnd<
4761 crate::BufferCollectionTokenGroup,
4762 ::fidl_next::wire::fuchsia::Channel,
4763 >,
4764 > {
4765 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4766 }
4767
4768 pub fn take_group_request(
4769 &mut self,
4770 ) -> ::core::option::Option<
4771 ::fidl_next::ServerEnd<
4772 crate::BufferCollectionTokenGroup,
4773 ::fidl_next::wire::fuchsia::Channel,
4774 >,
4775 > {
4776 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4777 }
4778 }
4779
4780 impl<'de> ::core::fmt::Debug for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de> {
4781 fn fmt(
4782 &self,
4783 f: &mut ::core::fmt::Formatter<'_>,
4784 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4785 f.debug_struct("BufferCollectionTokenCreateBufferCollectionTokenGroupRequest")
4786 .field("group_request", &self.group_request())
4787 .finish()
4788 }
4789 }
4790
4791 impl<'de> ::fidl_next::IntoNatural
4792 for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>
4793 {
4794 type Natural = crate::natural::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest;
4795 }
4796
4797 #[repr(C)]
4799 pub struct BufferCollectionTokenGroupCreateChildRequest<'de> {
4800 pub(crate) table: ::fidl_next::wire::Table<'de>,
4801 }
4802
4803 impl<'de> Drop for BufferCollectionTokenGroupCreateChildRequest<'de> {
4804 fn drop(&mut self) {
4805 let _ = self.table.get(1).map(|envelope| unsafe {
4806 envelope.read_unchecked::<::fidl_next::ServerEnd<
4807 crate::BufferCollectionToken,
4808 ::fidl_next::wire::fuchsia::Channel,
4809 >>()
4810 });
4811
4812 let _ = self.table.get(2).map(|envelope| unsafe {
4813 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
4814 });
4815 }
4816 }
4817
4818 impl ::fidl_next::Constrained for BufferCollectionTokenGroupCreateChildRequest<'_> {
4819 type Constraint = ();
4820
4821 fn validate(
4822 _: ::fidl_next::Slot<'_, Self>,
4823 _: Self::Constraint,
4824 ) -> Result<(), ::fidl_next::ValidationError> {
4825 Ok(())
4826 }
4827 }
4828
4829 unsafe impl ::fidl_next::Wire for BufferCollectionTokenGroupCreateChildRequest<'static> {
4830 type Narrowed<'de> = BufferCollectionTokenGroupCreateChildRequest<'de>;
4831
4832 #[inline]
4833 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4834 ::fidl_next::munge!(let Self { table } = out);
4835 ::fidl_next::wire::Table::zero_padding(table);
4836 }
4837 }
4838
4839 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
4840 for BufferCollectionTokenGroupCreateChildRequest<'de>
4841 where
4842 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4843 ___D: ::fidl_next::fuchsia::HandleDecoder,
4844 {
4845 fn decode(
4846 slot: ::fidl_next::Slot<'_, Self>,
4847 decoder: &mut ___D,
4848 _: (),
4849 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4850 ::fidl_next::munge!(let Self { table } = slot);
4851
4852 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4853 match ordinal {
4854 0 => unsafe { ::core::hint::unreachable_unchecked() },
4855
4856 1 => {
4857 ::fidl_next::wire::Envelope::decode_as::<
4858 ___D,
4859 ::fidl_next::ServerEnd<
4860 crate::BufferCollectionToken,
4861 ::fidl_next::wire::fuchsia::Channel,
4862 >,
4863 >(slot.as_mut(), decoder, ())?;
4864
4865 Ok(())
4866 }
4867
4868 2 => {
4869 ::fidl_next::wire::Envelope::decode_as::<
4870 ___D,
4871 ::fidl_next::wire::fuchsia::Rights,
4872 >(slot.as_mut(), decoder, ())?;
4873
4874 Ok(())
4875 }
4876
4877 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4878 }
4879 })
4880 }
4881 }
4882
4883 impl<'de> BufferCollectionTokenGroupCreateChildRequest<'de> {
4884 pub fn token_request(
4885 &self,
4886 ) -> ::core::option::Option<
4887 &::fidl_next::ServerEnd<
4888 crate::BufferCollectionToken,
4889 ::fidl_next::wire::fuchsia::Channel,
4890 >,
4891 > {
4892 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4893 }
4894
4895 pub fn take_token_request(
4896 &mut self,
4897 ) -> ::core::option::Option<
4898 ::fidl_next::ServerEnd<
4899 crate::BufferCollectionToken,
4900 ::fidl_next::wire::fuchsia::Channel,
4901 >,
4902 > {
4903 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
4904 }
4905
4906 pub fn rights_attenuation_mask(
4907 &self,
4908 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Rights> {
4909 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4910 }
4911
4912 pub fn take_rights_attenuation_mask(
4913 &mut self,
4914 ) -> ::core::option::Option<::fidl_next::wire::fuchsia::Rights> {
4915 unsafe { Some(self.table.get_mut(2)?.take_unchecked()) }
4916 }
4917 }
4918
4919 impl<'de> ::core::fmt::Debug for BufferCollectionTokenGroupCreateChildRequest<'de> {
4920 fn fmt(
4921 &self,
4922 f: &mut ::core::fmt::Formatter<'_>,
4923 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4924 f.debug_struct("BufferCollectionTokenGroupCreateChildRequest")
4925 .field("token_request", &self.token_request())
4926 .field("rights_attenuation_mask", &self.rights_attenuation_mask())
4927 .finish()
4928 }
4929 }
4930
4931 impl<'de> ::fidl_next::IntoNatural for BufferCollectionTokenGroupCreateChildRequest<'de> {
4932 type Natural = crate::natural::BufferCollectionTokenGroupCreateChildRequest;
4933 }
4934
4935 #[repr(C)]
4937 pub struct BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
4938 pub(crate) table: ::fidl_next::wire::Table<'de>,
4939 }
4940
4941 impl<'de> Drop for BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
4942 fn drop(&mut self) {
4943 let _ = self.table.get(1).map(|envelope| unsafe {
4944 envelope.read_unchecked::<::fidl_next::wire::Vector<
4945 'de,
4946 ::fidl_next::ClientEnd<
4947 crate::BufferCollectionToken,
4948 ::fidl_next::wire::fuchsia::Channel,
4949 >,
4950 >>()
4951 });
4952 }
4953 }
4954
4955 impl ::fidl_next::Constrained for BufferCollectionTokenGroupCreateChildrenSyncResponse<'_> {
4956 type Constraint = ();
4957
4958 fn validate(
4959 _: ::fidl_next::Slot<'_, Self>,
4960 _: Self::Constraint,
4961 ) -> Result<(), ::fidl_next::ValidationError> {
4962 Ok(())
4963 }
4964 }
4965
4966 unsafe impl ::fidl_next::Wire for BufferCollectionTokenGroupCreateChildrenSyncResponse<'static> {
4967 type Narrowed<'de> = BufferCollectionTokenGroupCreateChildrenSyncResponse<'de>;
4968
4969 #[inline]
4970 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4971 ::fidl_next::munge!(let Self { table } = out);
4972 ::fidl_next::wire::Table::zero_padding(table);
4973 }
4974 }
4975
4976 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
4977 for BufferCollectionTokenGroupCreateChildrenSyncResponse<'de>
4978 where
4979 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4980 ___D: ::fidl_next::fuchsia::HandleDecoder,
4981 {
4982 fn decode(
4983 slot: ::fidl_next::Slot<'_, Self>,
4984 decoder: &mut ___D,
4985 _: (),
4986 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4987 ::fidl_next::munge!(let Self { table } = slot);
4988
4989 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4990 match ordinal {
4991 0 => unsafe { ::core::hint::unreachable_unchecked() },
4992
4993 1 => {
4994 ::fidl_next::wire::Envelope::decode_as::<
4995 ___D,
4996 ::fidl_next::wire::Vector<
4997 'de,
4998 ::fidl_next::ClientEnd<
4999 crate::BufferCollectionToken,
5000 ::fidl_next::wire::fuchsia::Channel,
5001 >,
5002 >,
5003 >(slot.as_mut(), decoder, (64, ()))?;
5004
5005 let value = unsafe {
5006 slot.deref_unchecked().deref_unchecked::<::fidl_next::wire::Vector<
5007 '_,
5008 ::fidl_next::ClientEnd<
5009 crate::BufferCollectionToken,
5010 ::fidl_next::wire::fuchsia::Channel,
5011 >,
5012 >>()
5013 };
5014
5015 if value.len() > 64 {
5016 return Err(::fidl_next::DecodeError::VectorTooLong {
5017 size: value.len() as u64,
5018 limit: 64,
5019 });
5020 }
5021
5022 Ok(())
5023 }
5024
5025 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
5026 }
5027 })
5028 }
5029 }
5030
5031 impl<'de> BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
5032 pub fn tokens(
5033 &self,
5034 ) -> ::core::option::Option<
5035 &::fidl_next::wire::Vector<
5036 'de,
5037 ::fidl_next::ClientEnd<
5038 crate::BufferCollectionToken,
5039 ::fidl_next::wire::fuchsia::Channel,
5040 >,
5041 >,
5042 > {
5043 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
5044 }
5045
5046 pub fn take_tokens(
5047 &mut self,
5048 ) -> ::core::option::Option<
5049 ::fidl_next::wire::Vector<
5050 'de,
5051 ::fidl_next::ClientEnd<
5052 crate::BufferCollectionToken,
5053 ::fidl_next::wire::fuchsia::Channel,
5054 >,
5055 >,
5056 > {
5057 unsafe { Some(self.table.get_mut(1)?.take_unchecked()) }
5058 }
5059 }
5060
5061 impl<'de> ::core::fmt::Debug for BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
5062 fn fmt(
5063 &self,
5064 f: &mut ::core::fmt::Formatter<'_>,
5065 ) -> ::core::result::Result<(), ::core::fmt::Error> {
5066 f.debug_struct("BufferCollectionTokenGroupCreateChildrenSyncResponse")
5067 .field("tokens", &self.tokens())
5068 .finish()
5069 }
5070 }
5071
5072 impl<'de> ::fidl_next::IntoNatural for BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
5073 type Natural = crate::natural::BufferCollectionTokenGroupCreateChildrenSyncResponse;
5074 }
5075}
5076
5077pub mod wire_optional {
5078
5079 pub use fidl_next_common_fuchsia_sysmem2::wire_optional::*;
5080}
5081
5082pub mod generic {
5083
5084 pub use fidl_next_common_fuchsia_sysmem2::generic::*;
5085}
5086
5087pub use self::natural::*;
5088
5089#[doc = " Allocates system memory buffers.\n\n Epitaphs are not used in this protocol.\n"]
5091#[derive(PartialEq, Debug)]
5092pub struct Allocator;
5093
5094impl ::fidl_next::Discoverable for Allocator {
5095 const PROTOCOL_NAME: &'static str = "fuchsia.sysmem2.Allocator";
5096}
5097
5098#[cfg(target_os = "fuchsia")]
5099impl ::fidl_next::HasTransport for Allocator {
5100 type Transport = ::fidl_next::fuchsia::zx::Channel;
5101}
5102
5103pub mod allocator {
5104 pub mod prelude {
5105 pub use crate::{
5106 Allocator, AllocatorClientHandler, AllocatorLocalClientHandler,
5107 AllocatorLocalServerHandler, AllocatorServerHandler, allocator,
5108 };
5109
5110 pub use crate::natural::AllocatorAllocateNonSharedCollectionRequest;
5111
5112 pub use crate::natural::AllocatorAllocateSharedCollectionRequest;
5113
5114 pub use crate::natural::AllocatorBindSharedCollectionRequest;
5115
5116 pub use crate::natural::AllocatorGetVmoInfoRequest;
5117
5118 pub use crate::natural::AllocatorSetDebugClientInfoRequest;
5119
5120 pub use crate::natural::AllocatorValidateBufferCollectionTokenRequest;
5121
5122 pub use crate::natural::AllocatorGetVmoInfoResponse;
5123
5124 pub use crate::natural::AllocatorValidateBufferCollectionTokenResponse;
5125
5126 pub use crate::natural::Error;
5127 }
5128
5129 pub struct AllocateNonSharedCollection;
5130
5131 impl ::fidl_next::Method for AllocateNonSharedCollection {
5132 const ORDINAL: u64 = 6676166366047243844;
5133 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5134 ::fidl_next::protocol::Flexibility::Flexible;
5135
5136 type Protocol = crate::Allocator;
5137
5138 type Request = crate::wire::AllocatorAllocateNonSharedCollectionRequest<'static>;
5139 }
5140
5141 pub struct AllocateSharedCollection;
5142
5143 impl ::fidl_next::Method for AllocateSharedCollection {
5144 const ORDINAL: u64 = 1270472445031827905;
5145 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5146 ::fidl_next::protocol::Flexibility::Flexible;
5147
5148 type Protocol = crate::Allocator;
5149
5150 type Request = crate::wire::AllocatorAllocateSharedCollectionRequest<'static>;
5151 }
5152
5153 pub struct BindSharedCollection;
5154
5155 impl ::fidl_next::Method for BindSharedCollection {
5156 const ORDINAL: u64 = 6127453716877237070;
5157 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5158 ::fidl_next::protocol::Flexibility::Flexible;
5159
5160 type Protocol = crate::Allocator;
5161
5162 type Request = crate::wire::AllocatorBindSharedCollectionRequest<'static>;
5163 }
5164
5165 pub struct ValidateBufferCollectionToken;
5166
5167 impl ::fidl_next::Method for ValidateBufferCollectionToken {
5168 const ORDINAL: u64 = 5503092096911271565;
5169 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5170 ::fidl_next::protocol::Flexibility::Flexible;
5171
5172 type Protocol = crate::Allocator;
5173
5174 type Request = crate::wire::AllocatorValidateBufferCollectionTokenRequest<'static>;
5175 }
5176
5177 impl ::fidl_next::TwoWayMethod for ValidateBufferCollectionToken {
5178 type Response = ::fidl_next::wire::Flexible<
5179 'static,
5180 crate::wire::AllocatorValidateBufferCollectionTokenResponse<'static>,
5181 >;
5182 }
5183
5184 impl<___R> ::fidl_next::Respond<___R> for ValidateBufferCollectionToken {
5185 type Output = ::fidl_next::Flexible<___R>;
5186
5187 fn respond(response: ___R) -> Self::Output {
5188 ::fidl_next::Flexible(response)
5189 }
5190 }
5191
5192 pub struct SetDebugClientInfo;
5193
5194 impl ::fidl_next::Method for SetDebugClientInfo {
5195 const ORDINAL: u64 = 8027931980577414221;
5196 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5197 ::fidl_next::protocol::Flexibility::Flexible;
5198
5199 type Protocol = crate::Allocator;
5200
5201 type Request = crate::wire::AllocatorSetDebugClientInfoRequest<'static>;
5202 }
5203
5204 pub struct GetVmoInfo;
5205
5206 impl ::fidl_next::Method for GetVmoInfo {
5207 const ORDINAL: u64 = 2425330313826721273;
5208 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5209 ::fidl_next::protocol::Flexibility::Flexible;
5210
5211 type Protocol = crate::Allocator;
5212
5213 type Request = crate::wire::AllocatorGetVmoInfoRequest<'static>;
5214 }
5215
5216 impl ::fidl_next::TwoWayMethod for GetVmoInfo {
5217 type Response = ::fidl_next::wire::Result<
5218 'static,
5219 crate::wire::AllocatorGetVmoInfoResponse<'static>,
5220 crate::wire::Error,
5221 >;
5222 }
5223
5224 impl<___R> ::fidl_next::Respond<___R> for GetVmoInfo {
5225 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
5226
5227 fn respond(response: ___R) -> Self::Output {
5228 ::core::result::Result::Ok(response)
5229 }
5230 }
5231
5232 impl<___R> ::fidl_next::RespondErr<___R> for GetVmoInfo {
5233 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
5234
5235 fn respond_err(response: ___R) -> Self::Output {
5236 ::core::result::Result::Err(response)
5237 }
5238 }
5239
5240 mod ___detail {
5241 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Allocator
5242 where
5243 ___T: ::fidl_next::Transport,
5244 {
5245 type Client = AllocatorClient<___T>;
5246 type Server = AllocatorServer<___T>;
5247 }
5248
5249 #[repr(transparent)]
5251 pub struct AllocatorClient<___T: ::fidl_next::Transport> {
5252 #[allow(dead_code)]
5253 client: ::fidl_next::protocol::Client<___T>,
5254 }
5255
5256 impl<___T> AllocatorClient<___T>
5257 where
5258 ___T: ::fidl_next::Transport,
5259 {
5260 #[doc = " Allocates a buffer collection on behalf of a single client (aka\n initiator) who is also the only participant (from the point of view of\n sysmem).\n\n This call exists mainly for temp/testing purposes. This call skips the\n [`fuchsia.sysmem2/BufferCollectionToken`] stage, so there\'s no way to\n allow another participant to specify its constraints.\n\n Real clients are encouraged to use\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`] instead, and to\n let relevant participants directly convey their own constraints to\n sysmem by sending `BufferCollectionToken`s to those participants.\n\n + request `collection_request` The server end of the\n [`fuchsia.sysmem2/BufferCollection`].\n"]
5261 pub fn allocate_non_shared_collection_with<___R>(
5262 &self,
5263 request: ___R,
5264 ) -> ::fidl_next::SendFuture<'_, ___T>
5265 where
5266 ___R: ::fidl_next::Encode<
5267 crate::wire::AllocatorAllocateNonSharedCollectionRequest<'static>,
5268 <___T as ::fidl_next::Transport>::SendBuffer,
5269 >,
5270 {
5271 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5272 6676166366047243844,
5273 <super::AllocateNonSharedCollection as ::fidl_next::Method>::FLEXIBILITY,
5274 request,
5275 ))
5276 }
5277
5278 #[doc = " Creates a root [`fuchsia.sysmem2/BufferCollectionToken`].\n\n The `BufferCollectionToken` can be \"duplicated\" for distribution to\n participants by using\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`]. Each\n `BufferCollectionToken` can be converted into a\n [`fuchsia.sysmem2.BufferCollection`] using\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`].\n\n Buffer constraints can be set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n Success/failure to populate the buffer collection with buffers can be\n determined from\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n Closing the client end of a `BufferCollectionToken` or\n `BufferCollection` (without `Release` first) will fail all client ends\n in the same failure domain, which by default is all client ends of the\n buffer collection. See\n [`fuchsia.sysmem2/BufferCollection.SetDispensable`] and\n [`fuchsia.sysmem2/BufferCollection.AttachToken`] for ways to create\n separate failure domains within a buffer collection.\n"]
5279 pub fn allocate_shared_collection_with<___R>(
5280 &self,
5281 request: ___R,
5282 ) -> ::fidl_next::SendFuture<'_, ___T>
5283 where
5284 ___R: ::fidl_next::Encode<
5285 crate::wire::AllocatorAllocateSharedCollectionRequest<'static>,
5286 <___T as ::fidl_next::Transport>::SendBuffer,
5287 >,
5288 {
5289 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5290 1270472445031827905,
5291 <super::AllocateSharedCollection as ::fidl_next::Method>::FLEXIBILITY,
5292 request,
5293 ))
5294 }
5295
5296 #[doc = " Convert a [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n At the time of sending this message, the buffer collection hasn\'t yet\n been populated with buffers - the participant must first also send\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] via the\n `BufferCollection` client end.\n\n All `BufferCollectionToken`(s) duplicated from a root\n `BufferCollectionToken` (created via `AllocateSharedCollection`) must be\n \"turned in\" via `BindSharedCollection` (or `Release`ed), and all\n existing `BufferCollection` client ends must have sent `SetConstraints`\n before the logical BufferCollection will be populated with buffers (or\n will fail if the overall set of constraints can\'t be satisfied).\n\n + request `token` The client endpoint of a channel whose server end was\n sent to sysmem using\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`] or whose server\n end was sent to sysmem using\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`]. The token is\n being \"turned in\" in exchange for a\n [`fuchsia.sysmem2/BufferCollection`].\n + request `buffer_collection_request` The server end of a\n [`fuchsia.sysmem2/BufferCollection`] channel. The sender retains the\n client end. The `BufferCollection` channel is a single participant\'s\n connection to the logical buffer collection. Typically there will be\n other participants with their own `BufferCollection` channel to the\n logical buffer collection.\n"]
5297 pub fn bind_shared_collection_with<___R>(
5298 &self,
5299 request: ___R,
5300 ) -> ::fidl_next::SendFuture<'_, ___T>
5301 where
5302 ___R: ::fidl_next::Encode<
5303 crate::wire::AllocatorBindSharedCollectionRequest<'static>,
5304 <___T as ::fidl_next::Transport>::SendBuffer,
5305 >,
5306 {
5307 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5308 6127453716877237070,
5309 <super::BindSharedCollection as ::fidl_next::Method>::FLEXIBILITY,
5310 request,
5311 ))
5312 }
5313
5314 #[doc = " Checks whether a [`fuchsia.sysmem2/BufferCollectionToken`] is known to\n the sysmem server.\n\n With this call, the client can determine whether an incoming token is a\n real sysmem token that is known to the sysmem server, without any risk\n of getting stuck waiting forever on a potentially fake token to complete\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] or\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] (or any other two-way\n FIDL message). In cases where the client trusts the source of the token\n to provide a real token, this call is not typically needed outside of\n debugging.\n\n If the validate fails sometimes but succeeds other times, the source of\n the token may itself not be calling\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] or\n [`fuchsia.sysmem2/BufferCollection.Sync`] after creating/duplicating the\n token but before sending the token to the current client. It may be more\n convenient for the source to use\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] to duplicate\n token(s), since that call has the sync step built in. Or, the buffer\n collection may be failing before this call is processed by the sysmem\n server, as buffer collection failure cleans up sysmem\'s tracking of\n associated tokens.\n\n This call has no effect on any token.\n\n + request `token_server_koid` The koid of the server end of a channel\n that might be a BufferCollectionToken channel. This can be obtained\n via `zx_object_get_info` `ZX_INFO_HANDLE_BASIC` `related_koid`.\n - response `is_known` true means sysmem knew of the token at the time\n sysmem processed the request, but doesn\'t guarantee that the token is\n still valid by the time the client receives the reply. What it does\n guarantee is that the token at least was a real token, so a two-way\n call to the token won\'t stall forever (will fail or succeed fairly\n quickly, not stall). This can already be known implicitly if the\n source of the token can be trusted to provide a real token. A false\n value means the token wasn\'t known to sysmem at the time sysmem\n processed this call, but the token may have previously been valid, or\n may yet become valid. Or if the sender of the token isn\'t trusted to\n provide a real token, the token may be fake. It\'s the responsibility\n of the sender to sync with sysmem to ensure that previously\n created/duplicated token(s) are known to sysmem, before sending the\n token(s) to other participants.\n"]
5315 pub fn validate_buffer_collection_token_with<___R>(
5316 &self,
5317 request: ___R,
5318 ) -> ::fidl_next::TwoWayFuture<'_, super::ValidateBufferCollectionToken, ___T>
5319 where
5320 ___R: ::fidl_next::Encode<
5321 crate::wire::AllocatorValidateBufferCollectionTokenRequest<'static>,
5322 <___T as ::fidl_next::Transport>::SendBuffer,
5323 >,
5324 {
5325 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5326 5503092096911271565,
5327 <super::ValidateBufferCollectionToken as ::fidl_next::Method>::FLEXIBILITY,
5328 request,
5329 ))
5330 }
5331
5332 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on all [`fuchsia.sysmem2/Node`](s)\n subsequently created by this this [`fuchsia.sysmem2/Allocator`]\n including any [`fuchsia.sysmem2/BufferCollection`](s) created via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] (in the absence of\n any prior call to [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`],\n these `BufferCollection`(s) have the same initial debug client info as\n the token turned in to create the `BufferCollection`).\n\n This info can be subsequently overridden on a per-`Node` basis by\n sending [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
5333 pub fn set_debug_client_info_with<___R>(
5334 &self,
5335 request: ___R,
5336 ) -> ::fidl_next::SendFuture<'_, ___T>
5337 where
5338 ___R: ::fidl_next::Encode<
5339 crate::wire::AllocatorSetDebugClientInfoRequest<'static>,
5340 <___T as ::fidl_next::Transport>::SendBuffer,
5341 >,
5342 {
5343 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5344 8027931980577414221,
5345 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
5346 request,
5347 ))
5348 }
5349
5350 #[doc = " Given a handle to a sysmem-provided VMO, this returns additional info\n about the corresponding sysmem logical buffer.\n\n Most callers will duplicate a VMO handle first and send the duplicate to\n this call.\n\n If the client has created a child VMO of a sysmem-provided VMO, that\n child VMO isn\'t considered a \"sysmem VMO\" for purposes of this call.\n\n + request `vmo` A handle to a sysmem-provided VMO (or see errors).\n + request `need_weak` Iff set to true, the response will have weak_vmo\n set to a weak VMO for the buffer, regardless of whether `vmo` in the\n request was weak or strong.\n - response `buffer_collection_id` The buffer collection ID, which is\n unique per logical buffer collection per boot.\n - response `buffer_index` The buffer index of the buffer within the\n buffer collection. This is the same as the index of the buffer within\n [`fuchsia.sysmem2/BufferCollectionInfo.buffers`]. The `buffer_index`\n is the same for all sysmem-delivered VMOs corresponding to the same\n logical buffer, even if the VMO koids differ. The `buffer_index` is\n only unique across buffers of a buffer collection. For a given buffer,\n the combination of `buffer_collection_id` and `buffer_index` is unique\n per boot.\n - response `close_weak_asap` Iff `vmo` is a handle to a weak sysmem VMO\n OR need_weak is set to true, the `close_weak_asap` field will be set\n in the response. This handle will signal `ZX_EVENTPAIR_PEER_CLOSED`\n when all weak VMO handles to the buffer should be closed as soon as\n possible. This is signalled shortly after all strong sysmem VMOs to\n the buffer are closed (including any held indirectly via strong\n `BufferCollectionToken` or strong `BufferCollection`). Failure to\n close all weak sysmem VMO handles to the buffer quickly upon\n `ZX_EVENTPAIR_PEER_CLOSED` is considered a VMO leak caused by the\n client still holding a weak sysmem VMO handle and results in loud\n complaints to the log by sysmem (after a delay). The buffers of a\n collection can be freed independently of each other. The\n `ZX_EVENTPAIR_PEER_CLOSED` may already be signalled before the\n response arrives at the client. A client that isn\'t prepared to\n directly handle weak sysmem VMOs and waiting on close_weak_asap, on\n seeing this field set in response to a request that had need_weak\n un-set, typically should ignore the fact that the vmo handle was a\n weak vmo handle; typically another participant that\'s also a client of\n this participant via some other protocol has taken responsibility for\n ensuring that this participant will close all handles to the buffer,\n typically by shutting down this participant\'s context holding a vmo\n handle in some other way. That said, it is not harmful for both\n participants to directly handle close_weak_asap, even if one\n participant can take responsibility for handling close_weak_asap. See\n also `[fuchsia.sysmem2/Node.SetWeakOk]` for_child_nodes_also.\n - response `weak_vmo` This field is set in the response iff the request\n had `need_weak` set to true. When set, this is a weak VMO handle to\n the same buffer as `vmo` in the request, but may not have the same\n koid as `vmo` had (this applies regardless of whether `vmo` was strong\n or weak).\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` - the vmo isn\'t a sysmem\n VMO. Both strong and weak sysmem VMOs can be passed to this call, and\n the VMO handle passed in to this call itself keeps the VMO\'s info\n alive for purposes of responding to this call. Because of this,\n ZX_ERR_NOT_FOUND errors are unambiguous (even if there are no other\n handles to the VMO when calling; even if other handles are closed\n before the GetVmoInfo response arrives at the client).\n * error `[fuchsia.sysmem2/Error.UNSPECIFIED]` The request failed for an\n unspecified reason. See the log for more info.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The vmo field\n wasn\'t set, or there was some other problem with the request field(s).\n See the log.\n"]
5351 pub fn get_vmo_info_with<___R>(
5352 &self,
5353 request: ___R,
5354 ) -> ::fidl_next::TwoWayFuture<'_, super::GetVmoInfo, ___T>
5355 where
5356 ___R: ::fidl_next::Encode<
5357 crate::wire::AllocatorGetVmoInfoRequest<'static>,
5358 <___T as ::fidl_next::Transport>::SendBuffer,
5359 >,
5360 {
5361 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5362 2425330313826721273,
5363 <super::GetVmoInfo as ::fidl_next::Method>::FLEXIBILITY,
5364 request,
5365 ))
5366 }
5367 }
5368
5369 #[repr(transparent)]
5371 pub struct AllocatorServer<___T: ::fidl_next::Transport> {
5372 server: ::fidl_next::protocol::Server<___T>,
5373 }
5374
5375 impl<___T> AllocatorServer<___T> where ___T: ::fidl_next::Transport {}
5376 }
5377}
5378
5379#[diagnostic::on_unimplemented(
5380 note = "If {Self} implements the non-local AllocatorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5381)]
5382
5383pub trait AllocatorLocalClientHandler<
5387 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5388 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5389>
5390{
5391 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5392 ::core::future::ready(())
5393 }
5394}
5395
5396impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Allocator
5397where
5398 ___H: AllocatorLocalClientHandler<___T>,
5399 ___T: ::fidl_next::Transport,
5400{
5401 async fn on_event(
5402 handler: &mut ___H,
5403 mut message: ::fidl_next::Message<___T>,
5404 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5405 match *message.header().ordinal {
5406 ordinal => {
5407 handler.on_unknown_interaction(ordinal).await;
5408 if ::core::matches!(
5409 message.header().flexibility(),
5410 ::fidl_next::protocol::Flexibility::Strict
5411 ) {
5412 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5413 } else {
5414 Ok(())
5415 }
5416 }
5417 }
5418 }
5419}
5420
5421#[diagnostic::on_unimplemented(
5422 note = "If {Self} implements the non-local AllocatorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5423)]
5424
5425pub trait AllocatorLocalServerHandler<
5429 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5430 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5431>
5432{
5433 #[doc = " Allocates a buffer collection on behalf of a single client (aka\n initiator) who is also the only participant (from the point of view of\n sysmem).\n\n This call exists mainly for temp/testing purposes. This call skips the\n [`fuchsia.sysmem2/BufferCollectionToken`] stage, so there\'s no way to\n allow another participant to specify its constraints.\n\n Real clients are encouraged to use\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`] instead, and to\n let relevant participants directly convey their own constraints to\n sysmem by sending `BufferCollectionToken`s to those participants.\n\n + request `collection_request` The server end of the\n [`fuchsia.sysmem2/BufferCollection`].\n"]
5434 fn allocate_non_shared_collection(
5435 &mut self,
5436
5437 request: ::fidl_next::Request<allocator::AllocateNonSharedCollection, ___T>,
5438 ) -> impl ::core::future::Future<Output = ()>;
5439
5440 #[doc = " Creates a root [`fuchsia.sysmem2/BufferCollectionToken`].\n\n The `BufferCollectionToken` can be \"duplicated\" for distribution to\n participants by using\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`]. Each\n `BufferCollectionToken` can be converted into a\n [`fuchsia.sysmem2.BufferCollection`] using\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`].\n\n Buffer constraints can be set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n Success/failure to populate the buffer collection with buffers can be\n determined from\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n Closing the client end of a `BufferCollectionToken` or\n `BufferCollection` (without `Release` first) will fail all client ends\n in the same failure domain, which by default is all client ends of the\n buffer collection. See\n [`fuchsia.sysmem2/BufferCollection.SetDispensable`] and\n [`fuchsia.sysmem2/BufferCollection.AttachToken`] for ways to create\n separate failure domains within a buffer collection.\n"]
5441 fn allocate_shared_collection(
5442 &mut self,
5443
5444 request: ::fidl_next::Request<allocator::AllocateSharedCollection, ___T>,
5445 ) -> impl ::core::future::Future<Output = ()>;
5446
5447 #[doc = " Convert a [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n At the time of sending this message, the buffer collection hasn\'t yet\n been populated with buffers - the participant must first also send\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] via the\n `BufferCollection` client end.\n\n All `BufferCollectionToken`(s) duplicated from a root\n `BufferCollectionToken` (created via `AllocateSharedCollection`) must be\n \"turned in\" via `BindSharedCollection` (or `Release`ed), and all\n existing `BufferCollection` client ends must have sent `SetConstraints`\n before the logical BufferCollection will be populated with buffers (or\n will fail if the overall set of constraints can\'t be satisfied).\n\n + request `token` The client endpoint of a channel whose server end was\n sent to sysmem using\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`] or whose server\n end was sent to sysmem using\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`]. The token is\n being \"turned in\" in exchange for a\n [`fuchsia.sysmem2/BufferCollection`].\n + request `buffer_collection_request` The server end of a\n [`fuchsia.sysmem2/BufferCollection`] channel. The sender retains the\n client end. The `BufferCollection` channel is a single participant\'s\n connection to the logical buffer collection. Typically there will be\n other participants with their own `BufferCollection` channel to the\n logical buffer collection.\n"]
5448 fn bind_shared_collection(
5449 &mut self,
5450
5451 request: ::fidl_next::Request<allocator::BindSharedCollection, ___T>,
5452 ) -> impl ::core::future::Future<Output = ()>;
5453
5454 #[doc = " Checks whether a [`fuchsia.sysmem2/BufferCollectionToken`] is known to\n the sysmem server.\n\n With this call, the client can determine whether an incoming token is a\n real sysmem token that is known to the sysmem server, without any risk\n of getting stuck waiting forever on a potentially fake token to complete\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] or\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] (or any other two-way\n FIDL message). In cases where the client trusts the source of the token\n to provide a real token, this call is not typically needed outside of\n debugging.\n\n If the validate fails sometimes but succeeds other times, the source of\n the token may itself not be calling\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] or\n [`fuchsia.sysmem2/BufferCollection.Sync`] after creating/duplicating the\n token but before sending the token to the current client. It may be more\n convenient for the source to use\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] to duplicate\n token(s), since that call has the sync step built in. Or, the buffer\n collection may be failing before this call is processed by the sysmem\n server, as buffer collection failure cleans up sysmem\'s tracking of\n associated tokens.\n\n This call has no effect on any token.\n\n + request `token_server_koid` The koid of the server end of a channel\n that might be a BufferCollectionToken channel. This can be obtained\n via `zx_object_get_info` `ZX_INFO_HANDLE_BASIC` `related_koid`.\n - response `is_known` true means sysmem knew of the token at the time\n sysmem processed the request, but doesn\'t guarantee that the token is\n still valid by the time the client receives the reply. What it does\n guarantee is that the token at least was a real token, so a two-way\n call to the token won\'t stall forever (will fail or succeed fairly\n quickly, not stall). This can already be known implicitly if the\n source of the token can be trusted to provide a real token. A false\n value means the token wasn\'t known to sysmem at the time sysmem\n processed this call, but the token may have previously been valid, or\n may yet become valid. Or if the sender of the token isn\'t trusted to\n provide a real token, the token may be fake. It\'s the responsibility\n of the sender to sync with sysmem to ensure that previously\n created/duplicated token(s) are known to sysmem, before sending the\n token(s) to other participants.\n"]
5455 fn validate_buffer_collection_token(
5456 &mut self,
5457
5458 request: ::fidl_next::Request<allocator::ValidateBufferCollectionToken, ___T>,
5459
5460 responder: ::fidl_next::Responder<allocator::ValidateBufferCollectionToken, ___T>,
5461 ) -> impl ::core::future::Future<Output = ()>;
5462
5463 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on all [`fuchsia.sysmem2/Node`](s)\n subsequently created by this this [`fuchsia.sysmem2/Allocator`]\n including any [`fuchsia.sysmem2/BufferCollection`](s) created via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] (in the absence of\n any prior call to [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`],\n these `BufferCollection`(s) have the same initial debug client info as\n the token turned in to create the `BufferCollection`).\n\n This info can be subsequently overridden on a per-`Node` basis by\n sending [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
5464 fn set_debug_client_info(
5465 &mut self,
5466
5467 request: ::fidl_next::Request<allocator::SetDebugClientInfo, ___T>,
5468 ) -> impl ::core::future::Future<Output = ()>;
5469
5470 #[doc = " Given a handle to a sysmem-provided VMO, this returns additional info\n about the corresponding sysmem logical buffer.\n\n Most callers will duplicate a VMO handle first and send the duplicate to\n this call.\n\n If the client has created a child VMO of a sysmem-provided VMO, that\n child VMO isn\'t considered a \"sysmem VMO\" for purposes of this call.\n\n + request `vmo` A handle to a sysmem-provided VMO (or see errors).\n + request `need_weak` Iff set to true, the response will have weak_vmo\n set to a weak VMO for the buffer, regardless of whether `vmo` in the\n request was weak or strong.\n - response `buffer_collection_id` The buffer collection ID, which is\n unique per logical buffer collection per boot.\n - response `buffer_index` The buffer index of the buffer within the\n buffer collection. This is the same as the index of the buffer within\n [`fuchsia.sysmem2/BufferCollectionInfo.buffers`]. The `buffer_index`\n is the same for all sysmem-delivered VMOs corresponding to the same\n logical buffer, even if the VMO koids differ. The `buffer_index` is\n only unique across buffers of a buffer collection. For a given buffer,\n the combination of `buffer_collection_id` and `buffer_index` is unique\n per boot.\n - response `close_weak_asap` Iff `vmo` is a handle to a weak sysmem VMO\n OR need_weak is set to true, the `close_weak_asap` field will be set\n in the response. This handle will signal `ZX_EVENTPAIR_PEER_CLOSED`\n when all weak VMO handles to the buffer should be closed as soon as\n possible. This is signalled shortly after all strong sysmem VMOs to\n the buffer are closed (including any held indirectly via strong\n `BufferCollectionToken` or strong `BufferCollection`). Failure to\n close all weak sysmem VMO handles to the buffer quickly upon\n `ZX_EVENTPAIR_PEER_CLOSED` is considered a VMO leak caused by the\n client still holding a weak sysmem VMO handle and results in loud\n complaints to the log by sysmem (after a delay). The buffers of a\n collection can be freed independently of each other. The\n `ZX_EVENTPAIR_PEER_CLOSED` may already be signalled before the\n response arrives at the client. A client that isn\'t prepared to\n directly handle weak sysmem VMOs and waiting on close_weak_asap, on\n seeing this field set in response to a request that had need_weak\n un-set, typically should ignore the fact that the vmo handle was a\n weak vmo handle; typically another participant that\'s also a client of\n this participant via some other protocol has taken responsibility for\n ensuring that this participant will close all handles to the buffer,\n typically by shutting down this participant\'s context holding a vmo\n handle in some other way. That said, it is not harmful for both\n participants to directly handle close_weak_asap, even if one\n participant can take responsibility for handling close_weak_asap. See\n also `[fuchsia.sysmem2/Node.SetWeakOk]` for_child_nodes_also.\n - response `weak_vmo` This field is set in the response iff the request\n had `need_weak` set to true. When set, this is a weak VMO handle to\n the same buffer as `vmo` in the request, but may not have the same\n koid as `vmo` had (this applies regardless of whether `vmo` was strong\n or weak).\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` - the vmo isn\'t a sysmem\n VMO. Both strong and weak sysmem VMOs can be passed to this call, and\n the VMO handle passed in to this call itself keeps the VMO\'s info\n alive for purposes of responding to this call. Because of this,\n ZX_ERR_NOT_FOUND errors are unambiguous (even if there are no other\n handles to the VMO when calling; even if other handles are closed\n before the GetVmoInfo response arrives at the client).\n * error `[fuchsia.sysmem2/Error.UNSPECIFIED]` The request failed for an\n unspecified reason. See the log for more info.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The vmo field\n wasn\'t set, or there was some other problem with the request field(s).\n See the log.\n"]
5471 fn get_vmo_info(
5472 &mut self,
5473
5474 request: ::fidl_next::Request<allocator::GetVmoInfo, ___T>,
5475
5476 responder: ::fidl_next::Responder<allocator::GetVmoInfo, ___T>,
5477 ) -> impl ::core::future::Future<Output = ()>;
5478
5479 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5480 ::core::future::ready(())
5481 }
5482}
5483
5484impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Allocator
5485where
5486 ___H: AllocatorLocalServerHandler<___T>,
5487 ___T: ::fidl_next::Transport,
5488 for<'de> crate::wire::AllocatorAllocateNonSharedCollectionRequest<'de>: ::fidl_next::Decode<
5489 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5490 Constraint = (),
5491 >,
5492 for<'de> crate::wire::AllocatorAllocateSharedCollectionRequest<'de>: ::fidl_next::Decode<
5493 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5494 Constraint = (),
5495 >,
5496 for<'de> crate::wire::AllocatorBindSharedCollectionRequest<'de>: ::fidl_next::Decode<
5497 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5498 Constraint = (),
5499 >,
5500 for<'de> crate::wire::AllocatorValidateBufferCollectionTokenRequest<'de>: ::fidl_next::Decode<
5501 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5502 Constraint = (),
5503 >,
5504 for<'de> crate::wire::AllocatorSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
5505 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5506 Constraint = (),
5507 >,
5508 for<'de> crate::wire::AllocatorGetVmoInfoRequest<'de>: ::fidl_next::Decode<
5509 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5510 Constraint = (),
5511 >,
5512{
5513 async fn on_one_way(
5514 handler: &mut ___H,
5515 mut message: ::fidl_next::Message<___T>,
5516 ) -> ::core::result::Result<
5517 (),
5518 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5519 > {
5520 match *message.header().ordinal {
5521 6676166366047243844 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
5522 Ok(decoded) => {
5523 handler
5524 .allocate_non_shared_collection(::fidl_next::Request::from_decoded(decoded))
5525 .await;
5526 Ok(())
5527 }
5528 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5529 ordinal: 6676166366047243844,
5530 error,
5531 }),
5532 },
5533
5534 1270472445031827905 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
5535 Ok(decoded) => {
5536 handler
5537 .allocate_shared_collection(::fidl_next::Request::from_decoded(decoded))
5538 .await;
5539 Ok(())
5540 }
5541 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5542 ordinal: 1270472445031827905,
5543 error,
5544 }),
5545 },
5546
5547 6127453716877237070 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
5548 Ok(decoded) => {
5549 handler
5550 .bind_shared_collection(::fidl_next::Request::from_decoded(decoded))
5551 .await;
5552 Ok(())
5553 }
5554 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5555 ordinal: 6127453716877237070,
5556 error,
5557 }),
5558 },
5559
5560 8027931980577414221 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
5561 Ok(decoded) => {
5562 handler
5563 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
5564 .await;
5565 Ok(())
5566 }
5567 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5568 ordinal: 8027931980577414221,
5569 error,
5570 }),
5571 },
5572
5573 ordinal => {
5574 handler.on_unknown_interaction(ordinal).await;
5575 if ::core::matches!(
5576 message.header().flexibility(),
5577 ::fidl_next::protocol::Flexibility::Strict
5578 ) {
5579 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5580 } else {
5581 Ok(())
5582 }
5583 }
5584 }
5585 }
5586
5587 async fn on_two_way(
5588 handler: &mut ___H,
5589 mut message: ::fidl_next::Message<___T>,
5590 responder: ::fidl_next::protocol::Responder<___T>,
5591 ) -> ::core::result::Result<
5592 (),
5593 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5594 > {
5595 match *message.header().ordinal {
5596 5503092096911271565 => {
5597 let responder = ::fidl_next::Responder::from_untyped(responder);
5598
5599 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5600 Ok(decoded) => {
5601 handler
5602 .validate_buffer_collection_token(
5603 ::fidl_next::Request::from_decoded(decoded),
5604 responder,
5605 )
5606 .await;
5607 Ok(())
5608 }
5609 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5610 ordinal: 5503092096911271565,
5611 error,
5612 }),
5613 }
5614 }
5615
5616 2425330313826721273 => {
5617 let responder = ::fidl_next::Responder::from_untyped(responder);
5618
5619 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5620 Ok(decoded) => {
5621 handler
5622 .get_vmo_info(::fidl_next::Request::from_decoded(decoded), responder)
5623 .await;
5624 Ok(())
5625 }
5626 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5627 ordinal: 2425330313826721273,
5628 error,
5629 }),
5630 }
5631 }
5632
5633 ordinal => {
5634 handler.on_unknown_interaction(ordinal).await;
5635 if ::core::matches!(
5636 message.header().flexibility(),
5637 ::fidl_next::protocol::Flexibility::Strict
5638 ) {
5639 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5640 } else {
5641 responder
5642 .respond_framework_error(
5643 ordinal,
5644 ::fidl_next::FrameworkError::UnknownMethod,
5645 )
5646 .expect("encoding a framework error should never fail")
5647 .await?;
5648 Ok(())
5649 }
5650 }
5651 }
5652 }
5653}
5654
5655pub trait AllocatorClientHandler<
5659 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5660 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5661>
5662{
5663 fn on_unknown_interaction(
5664 &mut self,
5665 ordinal: u64,
5666 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5667 ::core::future::ready(())
5668 }
5669}
5670
5671impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Allocator
5672where
5673 ___H: AllocatorClientHandler<___T> + ::core::marker::Send,
5674 ___T: ::fidl_next::Transport,
5675{
5676 async fn on_event(
5677 handler: &mut ___H,
5678 mut message: ::fidl_next::Message<___T>,
5679 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5680 match *message.header().ordinal {
5681 ordinal => {
5682 handler.on_unknown_interaction(ordinal).await;
5683 if ::core::matches!(
5684 message.header().flexibility(),
5685 ::fidl_next::protocol::Flexibility::Strict
5686 ) {
5687 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5688 } else {
5689 Ok(())
5690 }
5691 }
5692 }
5693 }
5694}
5695
5696pub trait AllocatorServerHandler<
5700 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5701 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5702>
5703{
5704 #[doc = " Allocates a buffer collection on behalf of a single client (aka\n initiator) who is also the only participant (from the point of view of\n sysmem).\n\n This call exists mainly for temp/testing purposes. This call skips the\n [`fuchsia.sysmem2/BufferCollectionToken`] stage, so there\'s no way to\n allow another participant to specify its constraints.\n\n Real clients are encouraged to use\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`] instead, and to\n let relevant participants directly convey their own constraints to\n sysmem by sending `BufferCollectionToken`s to those participants.\n\n + request `collection_request` The server end of the\n [`fuchsia.sysmem2/BufferCollection`].\n"]
5705 fn allocate_non_shared_collection(
5706 &mut self,
5707
5708 request: ::fidl_next::Request<allocator::AllocateNonSharedCollection, ___T>,
5709 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5710
5711 #[doc = " Creates a root [`fuchsia.sysmem2/BufferCollectionToken`].\n\n The `BufferCollectionToken` can be \"duplicated\" for distribution to\n participants by using\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`]. Each\n `BufferCollectionToken` can be converted into a\n [`fuchsia.sysmem2.BufferCollection`] using\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`].\n\n Buffer constraints can be set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n Success/failure to populate the buffer collection with buffers can be\n determined from\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n Closing the client end of a `BufferCollectionToken` or\n `BufferCollection` (without `Release` first) will fail all client ends\n in the same failure domain, which by default is all client ends of the\n buffer collection. See\n [`fuchsia.sysmem2/BufferCollection.SetDispensable`] and\n [`fuchsia.sysmem2/BufferCollection.AttachToken`] for ways to create\n separate failure domains within a buffer collection.\n"]
5712 fn allocate_shared_collection(
5713 &mut self,
5714
5715 request: ::fidl_next::Request<allocator::AllocateSharedCollection, ___T>,
5716 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5717
5718 #[doc = " Convert a [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n At the time of sending this message, the buffer collection hasn\'t yet\n been populated with buffers - the participant must first also send\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] via the\n `BufferCollection` client end.\n\n All `BufferCollectionToken`(s) duplicated from a root\n `BufferCollectionToken` (created via `AllocateSharedCollection`) must be\n \"turned in\" via `BindSharedCollection` (or `Release`ed), and all\n existing `BufferCollection` client ends must have sent `SetConstraints`\n before the logical BufferCollection will be populated with buffers (or\n will fail if the overall set of constraints can\'t be satisfied).\n\n + request `token` The client endpoint of a channel whose server end was\n sent to sysmem using\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`] or whose server\n end was sent to sysmem using\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`]. The token is\n being \"turned in\" in exchange for a\n [`fuchsia.sysmem2/BufferCollection`].\n + request `buffer_collection_request` The server end of a\n [`fuchsia.sysmem2/BufferCollection`] channel. The sender retains the\n client end. The `BufferCollection` channel is a single participant\'s\n connection to the logical buffer collection. Typically there will be\n other participants with their own `BufferCollection` channel to the\n logical buffer collection.\n"]
5719 fn bind_shared_collection(
5720 &mut self,
5721
5722 request: ::fidl_next::Request<allocator::BindSharedCollection, ___T>,
5723 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5724
5725 #[doc = " Checks whether a [`fuchsia.sysmem2/BufferCollectionToken`] is known to\n the sysmem server.\n\n With this call, the client can determine whether an incoming token is a\n real sysmem token that is known to the sysmem server, without any risk\n of getting stuck waiting forever on a potentially fake token to complete\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] or\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] (or any other two-way\n FIDL message). In cases where the client trusts the source of the token\n to provide a real token, this call is not typically needed outside of\n debugging.\n\n If the validate fails sometimes but succeeds other times, the source of\n the token may itself not be calling\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] or\n [`fuchsia.sysmem2/BufferCollection.Sync`] after creating/duplicating the\n token but before sending the token to the current client. It may be more\n convenient for the source to use\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] to duplicate\n token(s), since that call has the sync step built in. Or, the buffer\n collection may be failing before this call is processed by the sysmem\n server, as buffer collection failure cleans up sysmem\'s tracking of\n associated tokens.\n\n This call has no effect on any token.\n\n + request `token_server_koid` The koid of the server end of a channel\n that might be a BufferCollectionToken channel. This can be obtained\n via `zx_object_get_info` `ZX_INFO_HANDLE_BASIC` `related_koid`.\n - response `is_known` true means sysmem knew of the token at the time\n sysmem processed the request, but doesn\'t guarantee that the token is\n still valid by the time the client receives the reply. What it does\n guarantee is that the token at least was a real token, so a two-way\n call to the token won\'t stall forever (will fail or succeed fairly\n quickly, not stall). This can already be known implicitly if the\n source of the token can be trusted to provide a real token. A false\n value means the token wasn\'t known to sysmem at the time sysmem\n processed this call, but the token may have previously been valid, or\n may yet become valid. Or if the sender of the token isn\'t trusted to\n provide a real token, the token may be fake. It\'s the responsibility\n of the sender to sync with sysmem to ensure that previously\n created/duplicated token(s) are known to sysmem, before sending the\n token(s) to other participants.\n"]
5726 fn validate_buffer_collection_token(
5727 &mut self,
5728
5729 request: ::fidl_next::Request<allocator::ValidateBufferCollectionToken, ___T>,
5730
5731 responder: ::fidl_next::Responder<allocator::ValidateBufferCollectionToken, ___T>,
5732 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5733
5734 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on all [`fuchsia.sysmem2/Node`](s)\n subsequently created by this this [`fuchsia.sysmem2/Allocator`]\n including any [`fuchsia.sysmem2/BufferCollection`](s) created via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] (in the absence of\n any prior call to [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`],\n these `BufferCollection`(s) have the same initial debug client info as\n the token turned in to create the `BufferCollection`).\n\n This info can be subsequently overridden on a per-`Node` basis by\n sending [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
5735 fn set_debug_client_info(
5736 &mut self,
5737
5738 request: ::fidl_next::Request<allocator::SetDebugClientInfo, ___T>,
5739 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5740
5741 #[doc = " Given a handle to a sysmem-provided VMO, this returns additional info\n about the corresponding sysmem logical buffer.\n\n Most callers will duplicate a VMO handle first and send the duplicate to\n this call.\n\n If the client has created a child VMO of a sysmem-provided VMO, that\n child VMO isn\'t considered a \"sysmem VMO\" for purposes of this call.\n\n + request `vmo` A handle to a sysmem-provided VMO (or see errors).\n + request `need_weak` Iff set to true, the response will have weak_vmo\n set to a weak VMO for the buffer, regardless of whether `vmo` in the\n request was weak or strong.\n - response `buffer_collection_id` The buffer collection ID, which is\n unique per logical buffer collection per boot.\n - response `buffer_index` The buffer index of the buffer within the\n buffer collection. This is the same as the index of the buffer within\n [`fuchsia.sysmem2/BufferCollectionInfo.buffers`]. The `buffer_index`\n is the same for all sysmem-delivered VMOs corresponding to the same\n logical buffer, even if the VMO koids differ. The `buffer_index` is\n only unique across buffers of a buffer collection. For a given buffer,\n the combination of `buffer_collection_id` and `buffer_index` is unique\n per boot.\n - response `close_weak_asap` Iff `vmo` is a handle to a weak sysmem VMO\n OR need_weak is set to true, the `close_weak_asap` field will be set\n in the response. This handle will signal `ZX_EVENTPAIR_PEER_CLOSED`\n when all weak VMO handles to the buffer should be closed as soon as\n possible. This is signalled shortly after all strong sysmem VMOs to\n the buffer are closed (including any held indirectly via strong\n `BufferCollectionToken` or strong `BufferCollection`). Failure to\n close all weak sysmem VMO handles to the buffer quickly upon\n `ZX_EVENTPAIR_PEER_CLOSED` is considered a VMO leak caused by the\n client still holding a weak sysmem VMO handle and results in loud\n complaints to the log by sysmem (after a delay). The buffers of a\n collection can be freed independently of each other. The\n `ZX_EVENTPAIR_PEER_CLOSED` may already be signalled before the\n response arrives at the client. A client that isn\'t prepared to\n directly handle weak sysmem VMOs and waiting on close_weak_asap, on\n seeing this field set in response to a request that had need_weak\n un-set, typically should ignore the fact that the vmo handle was a\n weak vmo handle; typically another participant that\'s also a client of\n this participant via some other protocol has taken responsibility for\n ensuring that this participant will close all handles to the buffer,\n typically by shutting down this participant\'s context holding a vmo\n handle in some other way. That said, it is not harmful for both\n participants to directly handle close_weak_asap, even if one\n participant can take responsibility for handling close_weak_asap. See\n also `[fuchsia.sysmem2/Node.SetWeakOk]` for_child_nodes_also.\n - response `weak_vmo` This field is set in the response iff the request\n had `need_weak` set to true. When set, this is a weak VMO handle to\n the same buffer as `vmo` in the request, but may not have the same\n koid as `vmo` had (this applies regardless of whether `vmo` was strong\n or weak).\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` - the vmo isn\'t a sysmem\n VMO. Both strong and weak sysmem VMOs can be passed to this call, and\n the VMO handle passed in to this call itself keeps the VMO\'s info\n alive for purposes of responding to this call. Because of this,\n ZX_ERR_NOT_FOUND errors are unambiguous (even if there are no other\n handles to the VMO when calling; even if other handles are closed\n before the GetVmoInfo response arrives at the client).\n * error `[fuchsia.sysmem2/Error.UNSPECIFIED]` The request failed for an\n unspecified reason. See the log for more info.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The vmo field\n wasn\'t set, or there was some other problem with the request field(s).\n See the log.\n"]
5742 fn get_vmo_info(
5743 &mut self,
5744
5745 request: ::fidl_next::Request<allocator::GetVmoInfo, ___T>,
5746
5747 responder: ::fidl_next::Responder<allocator::GetVmoInfo, ___T>,
5748 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5749
5750 fn on_unknown_interaction(
5751 &mut self,
5752 ordinal: u64,
5753 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5754 ::core::future::ready(())
5755 }
5756}
5757
5758impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Allocator
5759where
5760 ___H: AllocatorServerHandler<___T> + ::core::marker::Send,
5761 ___T: ::fidl_next::Transport,
5762 for<'de> crate::wire::AllocatorAllocateNonSharedCollectionRequest<'de>: ::fidl_next::Decode<
5763 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5764 Constraint = (),
5765 >,
5766 for<'de> crate::wire::AllocatorAllocateSharedCollectionRequest<'de>: ::fidl_next::Decode<
5767 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5768 Constraint = (),
5769 >,
5770 for<'de> crate::wire::AllocatorBindSharedCollectionRequest<'de>: ::fidl_next::Decode<
5771 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5772 Constraint = (),
5773 >,
5774 for<'de> crate::wire::AllocatorValidateBufferCollectionTokenRequest<'de>: ::fidl_next::Decode<
5775 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5776 Constraint = (),
5777 >,
5778 for<'de> crate::wire::AllocatorSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
5779 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5780 Constraint = (),
5781 >,
5782 for<'de> crate::wire::AllocatorGetVmoInfoRequest<'de>: ::fidl_next::Decode<
5783 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5784 Constraint = (),
5785 >,
5786{
5787 async fn on_one_way(
5788 handler: &mut ___H,
5789 mut message: ::fidl_next::Message<___T>,
5790 ) -> ::core::result::Result<
5791 (),
5792 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5793 > {
5794 match *message.header().ordinal {
5795 6676166366047243844 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
5796 Ok(decoded) => {
5797 handler
5798 .allocate_non_shared_collection(::fidl_next::Request::from_decoded(decoded))
5799 .await;
5800 Ok(())
5801 }
5802 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5803 ordinal: 6676166366047243844,
5804 error,
5805 }),
5806 },
5807
5808 1270472445031827905 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
5809 Ok(decoded) => {
5810 handler
5811 .allocate_shared_collection(::fidl_next::Request::from_decoded(decoded))
5812 .await;
5813 Ok(())
5814 }
5815 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5816 ordinal: 1270472445031827905,
5817 error,
5818 }),
5819 },
5820
5821 6127453716877237070 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
5822 Ok(decoded) => {
5823 handler
5824 .bind_shared_collection(::fidl_next::Request::from_decoded(decoded))
5825 .await;
5826 Ok(())
5827 }
5828 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5829 ordinal: 6127453716877237070,
5830 error,
5831 }),
5832 },
5833
5834 8027931980577414221 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
5835 Ok(decoded) => {
5836 handler
5837 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
5838 .await;
5839 Ok(())
5840 }
5841 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5842 ordinal: 8027931980577414221,
5843 error,
5844 }),
5845 },
5846
5847 ordinal => {
5848 handler.on_unknown_interaction(ordinal).await;
5849 if ::core::matches!(
5850 message.header().flexibility(),
5851 ::fidl_next::protocol::Flexibility::Strict
5852 ) {
5853 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5854 } else {
5855 Ok(())
5856 }
5857 }
5858 }
5859 }
5860
5861 async fn on_two_way(
5862 handler: &mut ___H,
5863 mut message: ::fidl_next::Message<___T>,
5864 responder: ::fidl_next::protocol::Responder<___T>,
5865 ) -> ::core::result::Result<
5866 (),
5867 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5868 > {
5869 match *message.header().ordinal {
5870 5503092096911271565 => {
5871 let responder = ::fidl_next::Responder::from_untyped(responder);
5872
5873 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5874 Ok(decoded) => {
5875 handler
5876 .validate_buffer_collection_token(
5877 ::fidl_next::Request::from_decoded(decoded),
5878 responder,
5879 )
5880 .await;
5881 Ok(())
5882 }
5883 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5884 ordinal: 5503092096911271565,
5885 error,
5886 }),
5887 }
5888 }
5889
5890 2425330313826721273 => {
5891 let responder = ::fidl_next::Responder::from_untyped(responder);
5892
5893 match ::fidl_next::AsDecoderExt::into_decoded(message) {
5894 Ok(decoded) => {
5895 handler
5896 .get_vmo_info(::fidl_next::Request::from_decoded(decoded), responder)
5897 .await;
5898 Ok(())
5899 }
5900 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5901 ordinal: 2425330313826721273,
5902 error,
5903 }),
5904 }
5905 }
5906
5907 ordinal => {
5908 handler.on_unknown_interaction(ordinal).await;
5909 if ::core::matches!(
5910 message.header().flexibility(),
5911 ::fidl_next::protocol::Flexibility::Strict
5912 ) {
5913 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5914 } else {
5915 responder
5916 .respond_framework_error(
5917 ordinal,
5918 ::fidl_next::FrameworkError::UnknownMethod,
5919 )
5920 .expect("encoding a framework error should never fail")
5921 .await?;
5922 Ok(())
5923 }
5924 }
5925 }
5926 }
5927}
5928
5929impl<___T> AllocatorClientHandler<___T> for ::fidl_next::IgnoreEvents
5930where
5931 ___T: ::fidl_next::Transport,
5932{
5933 async fn on_unknown_interaction(&mut self, _: u64) {}
5934}
5935
5936impl<___H, ___T> AllocatorLocalClientHandler<___T> for ::fidl_next::Local<___H>
5937where
5938 ___H: AllocatorClientHandler<___T>,
5939 ___T: ::fidl_next::Transport,
5940{
5941 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5942 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5943 }
5944}
5945
5946impl<___H, ___T> AllocatorLocalServerHandler<___T> for ::fidl_next::Local<___H>
5947where
5948 ___H: AllocatorServerHandler<___T>,
5949 ___T: ::fidl_next::Transport,
5950{
5951 async fn allocate_non_shared_collection(
5952 &mut self,
5953
5954 request: ::fidl_next::Request<allocator::AllocateNonSharedCollection, ___T>,
5955 ) {
5956 ___H::allocate_non_shared_collection(&mut self.0, request).await
5957 }
5958
5959 async fn allocate_shared_collection(
5960 &mut self,
5961
5962 request: ::fidl_next::Request<allocator::AllocateSharedCollection, ___T>,
5963 ) {
5964 ___H::allocate_shared_collection(&mut self.0, request).await
5965 }
5966
5967 async fn bind_shared_collection(
5968 &mut self,
5969
5970 request: ::fidl_next::Request<allocator::BindSharedCollection, ___T>,
5971 ) {
5972 ___H::bind_shared_collection(&mut self.0, request).await
5973 }
5974
5975 async fn validate_buffer_collection_token(
5976 &mut self,
5977
5978 request: ::fidl_next::Request<allocator::ValidateBufferCollectionToken, ___T>,
5979
5980 responder: ::fidl_next::Responder<allocator::ValidateBufferCollectionToken, ___T>,
5981 ) {
5982 ___H::validate_buffer_collection_token(&mut self.0, request, responder).await
5983 }
5984
5985 async fn set_debug_client_info(
5986 &mut self,
5987
5988 request: ::fidl_next::Request<allocator::SetDebugClientInfo, ___T>,
5989 ) {
5990 ___H::set_debug_client_info(&mut self.0, request).await
5991 }
5992
5993 async fn get_vmo_info(
5994 &mut self,
5995
5996 request: ::fidl_next::Request<allocator::GetVmoInfo, ___T>,
5997
5998 responder: ::fidl_next::Responder<allocator::GetVmoInfo, ___T>,
5999 ) {
6000 ___H::get_vmo_info(&mut self.0, request, responder).await
6001 }
6002
6003 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6004 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6005 }
6006}
6007
6008#[doc = " This protocol is the parent protocol for all nodes in the tree established\n by [`fuchsia.sysmem2/BufferCollectionToken`] creation and\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] creation, including\n [`fuchsia.sysmem2/BufferCollectionToken`](s) which have since been converted\n to a [`fuchsia.sysmem2/BufferCollection`] channel.\n\n Epitaphs are not used in this protocol.\n"]
6010#[derive(PartialEq, Debug)]
6011pub struct Node;
6012
6013#[cfg(target_os = "fuchsia")]
6014impl ::fidl_next::HasTransport for Node {
6015 type Transport = ::fidl_next::fuchsia::zx::Channel;
6016}
6017
6018pub mod node {
6019 pub mod prelude {
6020 pub use crate::{
6021 Node, NodeClientHandler, NodeLocalClientHandler, NodeLocalServerHandler,
6022 NodeServerHandler, node,
6023 };
6024
6025 pub use crate::natural::Error;
6026
6027 pub use crate::natural::NodeAttachNodeTrackingRequest;
6028
6029 pub use crate::natural::NodeIsAlternateForRequest;
6030
6031 pub use crate::natural::NodeSetDebugClientInfoRequest;
6032
6033 pub use crate::natural::NodeSetDebugTimeoutLogDeadlineRequest;
6034
6035 pub use crate::natural::NodeSetNameRequest;
6036
6037 pub use crate::natural::NodeSetWeakOkRequest;
6038
6039 pub use crate::natural::NodeGetBufferCollectionIdResponse;
6040
6041 pub use crate::natural::NodeGetNodeRefResponse;
6042
6043 pub use crate::natural::NodeIsAlternateForResponse;
6044
6045 pub use crate::natural::NodeSyncResponse;
6046 }
6047
6048 pub struct Sync;
6049
6050 impl ::fidl_next::Method for Sync {
6051 const ORDINAL: u64 = 1273433845120064340;
6052 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6053 ::fidl_next::protocol::Flexibility::Flexible;
6054
6055 type Protocol = crate::Node;
6056
6057 type Request = ::fidl_next::wire::EmptyMessageBody;
6058 }
6059
6060 impl ::fidl_next::TwoWayMethod for Sync {
6061 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::NodeSyncResponse>;
6062 }
6063
6064 impl<___R> ::fidl_next::Respond<___R> for Sync {
6065 type Output = ::fidl_next::Flexible<___R>;
6066
6067 fn respond(response: ___R) -> Self::Output {
6068 ::fidl_next::Flexible(response)
6069 }
6070 }
6071
6072 pub struct Release;
6073
6074 impl ::fidl_next::Method for Release {
6075 const ORDINAL: u64 = 7664192519607813318;
6076 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6077 ::fidl_next::protocol::Flexibility::Flexible;
6078
6079 type Protocol = crate::Node;
6080
6081 type Request = ::fidl_next::wire::EmptyMessageBody;
6082 }
6083
6084 pub struct SetName;
6085
6086 impl ::fidl_next::Method for SetName {
6087 const ORDINAL: u64 = 811194812442657257;
6088 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6089 ::fidl_next::protocol::Flexibility::Flexible;
6090
6091 type Protocol = crate::Node;
6092
6093 type Request = crate::wire::NodeSetNameRequest<'static>;
6094 }
6095
6096 pub struct SetDebugClientInfo;
6097
6098 impl ::fidl_next::Method for SetDebugClientInfo {
6099 const ORDINAL: u64 = 6691936816931379633;
6100 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6101 ::fidl_next::protocol::Flexibility::Flexible;
6102
6103 type Protocol = crate::Node;
6104
6105 type Request = crate::wire::NodeSetDebugClientInfoRequest<'static>;
6106 }
6107
6108 pub struct SetDebugTimeoutLogDeadline;
6109
6110 impl ::fidl_next::Method for SetDebugTimeoutLogDeadline {
6111 const ORDINAL: u64 = 8172637980026734598;
6112 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6113 ::fidl_next::protocol::Flexibility::Flexible;
6114
6115 type Protocol = crate::Node;
6116
6117 type Request = crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>;
6118 }
6119
6120 pub struct SetVerboseLogging;
6121
6122 impl ::fidl_next::Method for SetVerboseLogging {
6123 const ORDINAL: u64 = 5911475287294795693;
6124 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6125 ::fidl_next::protocol::Flexibility::Flexible;
6126
6127 type Protocol = crate::Node;
6128
6129 type Request = ::fidl_next::wire::EmptyMessageBody;
6130 }
6131
6132 pub struct GetNodeRef;
6133
6134 impl ::fidl_next::Method for GetNodeRef {
6135 const ORDINAL: u64 = 6574426773718429779;
6136 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6137 ::fidl_next::protocol::Flexibility::Flexible;
6138
6139 type Protocol = crate::Node;
6140
6141 type Request = ::fidl_next::wire::EmptyMessageBody;
6142 }
6143
6144 impl ::fidl_next::TwoWayMethod for GetNodeRef {
6145 type Response =
6146 ::fidl_next::wire::Flexible<'static, crate::wire::NodeGetNodeRefResponse<'static>>;
6147 }
6148
6149 impl<___R> ::fidl_next::Respond<___R> for GetNodeRef {
6150 type Output = ::fidl_next::Flexible<___R>;
6151
6152 fn respond(response: ___R) -> Self::Output {
6153 ::fidl_next::Flexible(response)
6154 }
6155 }
6156
6157 pub struct IsAlternateFor;
6158
6159 impl ::fidl_next::Method for IsAlternateFor {
6160 const ORDINAL: u64 = 262772284282767397;
6161 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6162 ::fidl_next::protocol::Flexibility::Flexible;
6163
6164 type Protocol = crate::Node;
6165
6166 type Request = crate::wire::NodeIsAlternateForRequest<'static>;
6167 }
6168
6169 impl ::fidl_next::TwoWayMethod for IsAlternateFor {
6170 type Response = ::fidl_next::wire::Result<
6171 'static,
6172 crate::wire::NodeIsAlternateForResponse<'static>,
6173 crate::wire::Error,
6174 >;
6175 }
6176
6177 impl<___R> ::fidl_next::Respond<___R> for IsAlternateFor {
6178 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
6179
6180 fn respond(response: ___R) -> Self::Output {
6181 ::core::result::Result::Ok(response)
6182 }
6183 }
6184
6185 impl<___R> ::fidl_next::RespondErr<___R> for IsAlternateFor {
6186 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
6187
6188 fn respond_err(response: ___R) -> Self::Output {
6189 ::core::result::Result::Err(response)
6190 }
6191 }
6192
6193 pub struct GetBufferCollectionId;
6194
6195 impl ::fidl_next::Method for GetBufferCollectionId {
6196 const ORDINAL: u64 = 8633851600235444876;
6197 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6198 ::fidl_next::protocol::Flexibility::Flexible;
6199
6200 type Protocol = crate::Node;
6201
6202 type Request = ::fidl_next::wire::EmptyMessageBody;
6203 }
6204
6205 impl ::fidl_next::TwoWayMethod for GetBufferCollectionId {
6206 type Response = ::fidl_next::wire::Flexible<
6207 'static,
6208 crate::wire::NodeGetBufferCollectionIdResponse<'static>,
6209 >;
6210 }
6211
6212 impl<___R> ::fidl_next::Respond<___R> for GetBufferCollectionId {
6213 type Output = ::fidl_next::Flexible<___R>;
6214
6215 fn respond(response: ___R) -> Self::Output {
6216 ::fidl_next::Flexible(response)
6217 }
6218 }
6219
6220 pub struct SetWeak;
6221
6222 impl ::fidl_next::Method for SetWeak {
6223 const ORDINAL: u64 = 2512233045884338145;
6224 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6225 ::fidl_next::protocol::Flexibility::Flexible;
6226
6227 type Protocol = crate::Node;
6228
6229 type Request = ::fidl_next::wire::EmptyMessageBody;
6230 }
6231
6232 pub struct SetWeakOk;
6233
6234 impl ::fidl_next::Method for SetWeakOk {
6235 const ORDINAL: u64 = 4081474869151288297;
6236 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6237 ::fidl_next::protocol::Flexibility::Flexible;
6238
6239 type Protocol = crate::Node;
6240
6241 type Request = crate::wire::NodeSetWeakOkRequest<'static>;
6242 }
6243
6244 pub struct AttachNodeTracking;
6245
6246 impl ::fidl_next::Method for AttachNodeTracking {
6247 const ORDINAL: u64 = 4549465353676377516;
6248 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6249 ::fidl_next::protocol::Flexibility::Flexible;
6250
6251 type Protocol = crate::Node;
6252
6253 type Request = crate::wire::NodeAttachNodeTrackingRequest<'static>;
6254 }
6255
6256 mod ___detail {
6257 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Node
6258 where
6259 ___T: ::fidl_next::Transport,
6260 {
6261 type Client = NodeClient<___T>;
6262 type Server = NodeServer<___T>;
6263 }
6264
6265 #[repr(transparent)]
6267 pub struct NodeClient<___T: ::fidl_next::Transport> {
6268 #[allow(dead_code)]
6269 client: ::fidl_next::protocol::Client<___T>,
6270 }
6271
6272 impl<___T> NodeClient<___T>
6273 where
6274 ___T: ::fidl_next::Transport,
6275 {
6276 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
6277 pub fn sync(&self) -> ::fidl_next::TwoWayFuture<'_, super::Sync, ___T> {
6278 ::fidl_next::TwoWayFuture::from_untyped(
6279 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
6280 1273433845120064340,
6281 <super::Sync as ::fidl_next::Method>::FLEXIBILITY,
6282 (),
6283 ),
6284 )
6285 }
6286
6287 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
6288 pub fn release(&self) -> ::fidl_next::SendFuture<'_, ___T> {
6289 ::fidl_next::SendFuture::from_untyped(
6290 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
6291 7664192519607813318,
6292 <super::Release as ::fidl_next::Method>::FLEXIBILITY,
6293 (),
6294 ),
6295 )
6296 }
6297
6298 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
6299 pub fn set_name_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
6300 where
6301 ___R: ::fidl_next::Encode<
6302 crate::wire::NodeSetNameRequest<'static>,
6303 <___T as ::fidl_next::Transport>::SendBuffer,
6304 >,
6305 {
6306 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
6307 811194812442657257,
6308 <super::SetName as ::fidl_next::Method>::FLEXIBILITY,
6309 request,
6310 ))
6311 }
6312
6313 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
6314 pub fn set_debug_client_info_with<___R>(
6315 &self,
6316 request: ___R,
6317 ) -> ::fidl_next::SendFuture<'_, ___T>
6318 where
6319 ___R: ::fidl_next::Encode<
6320 crate::wire::NodeSetDebugClientInfoRequest<'static>,
6321 <___T as ::fidl_next::Transport>::SendBuffer,
6322 >,
6323 {
6324 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
6325 6691936816931379633,
6326 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
6327 request,
6328 ))
6329 }
6330
6331 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
6332 pub fn set_debug_timeout_log_deadline_with<___R>(
6333 &self,
6334 request: ___R,
6335 ) -> ::fidl_next::SendFuture<'_, ___T>
6336 where
6337 ___R: ::fidl_next::Encode<
6338 crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>,
6339 <___T as ::fidl_next::Transport>::SendBuffer,
6340 >,
6341 {
6342 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
6343 8172637980026734598,
6344 <super::SetDebugTimeoutLogDeadline as ::fidl_next::Method>::FLEXIBILITY,
6345 request,
6346 ))
6347 }
6348
6349 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
6350 pub fn set_verbose_logging(&self) -> ::fidl_next::SendFuture<'_, ___T> {
6351 ::fidl_next::SendFuture::from_untyped(
6352 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
6353 5911475287294795693,
6354 <super::SetVerboseLogging as ::fidl_next::Method>::FLEXIBILITY,
6355 (),
6356 ),
6357 )
6358 }
6359
6360 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
6361 pub fn get_node_ref(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetNodeRef, ___T> {
6362 ::fidl_next::TwoWayFuture::from_untyped(
6363 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
6364 6574426773718429779,
6365 <super::GetNodeRef as ::fidl_next::Method>::FLEXIBILITY,
6366 (),
6367 ),
6368 )
6369 }
6370
6371 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
6372 pub fn is_alternate_for_with<___R>(
6373 &self,
6374 request: ___R,
6375 ) -> ::fidl_next::TwoWayFuture<'_, super::IsAlternateFor, ___T>
6376 where
6377 ___R: ::fidl_next::Encode<
6378 crate::wire::NodeIsAlternateForRequest<'static>,
6379 <___T as ::fidl_next::Transport>::SendBuffer,
6380 >,
6381 {
6382 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
6383 262772284282767397,
6384 <super::IsAlternateFor as ::fidl_next::Method>::FLEXIBILITY,
6385 request,
6386 ))
6387 }
6388
6389 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
6390 pub fn get_buffer_collection_id(
6391 &self,
6392 ) -> ::fidl_next::TwoWayFuture<'_, super::GetBufferCollectionId, ___T> {
6393 ::fidl_next::TwoWayFuture::from_untyped(
6394 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
6395 8633851600235444876,
6396 <super::GetBufferCollectionId as ::fidl_next::Method>::FLEXIBILITY,
6397 (),
6398 ),
6399 )
6400 }
6401
6402 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
6403 pub fn set_weak(&self) -> ::fidl_next::SendFuture<'_, ___T> {
6404 ::fidl_next::SendFuture::from_untyped(
6405 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
6406 2512233045884338145,
6407 <super::SetWeak as ::fidl_next::Method>::FLEXIBILITY,
6408 (),
6409 ),
6410 )
6411 }
6412
6413 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
6414 pub fn set_weak_ok_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
6415 where
6416 ___R: ::fidl_next::Encode<
6417 crate::wire::NodeSetWeakOkRequest<'static>,
6418 <___T as ::fidl_next::Transport>::SendBuffer,
6419 >,
6420 {
6421 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
6422 4081474869151288297,
6423 <super::SetWeakOk as ::fidl_next::Method>::FLEXIBILITY,
6424 request,
6425 ))
6426 }
6427
6428 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
6429 pub fn attach_node_tracking_with<___R>(
6430 &self,
6431 request: ___R,
6432 ) -> ::fidl_next::SendFuture<'_, ___T>
6433 where
6434 ___R: ::fidl_next::Encode<
6435 crate::wire::NodeAttachNodeTrackingRequest<'static>,
6436 <___T as ::fidl_next::Transport>::SendBuffer,
6437 >,
6438 {
6439 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
6440 4549465353676377516,
6441 <super::AttachNodeTracking as ::fidl_next::Method>::FLEXIBILITY,
6442 request,
6443 ))
6444 }
6445 }
6446
6447 #[repr(transparent)]
6449 pub struct NodeServer<___T: ::fidl_next::Transport> {
6450 server: ::fidl_next::protocol::Server<___T>,
6451 }
6452
6453 impl<___T> NodeServer<___T> where ___T: ::fidl_next::Transport {}
6454 }
6455}
6456
6457#[diagnostic::on_unimplemented(
6458 note = "If {Self} implements the non-local NodeClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
6459)]
6460
6461pub trait NodeLocalClientHandler<
6465 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6466 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6467>
6468{
6469 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
6470 ::core::future::ready(())
6471 }
6472}
6473
6474impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Node
6475where
6476 ___H: NodeLocalClientHandler<___T>,
6477 ___T: ::fidl_next::Transport,
6478{
6479 async fn on_event(
6480 handler: &mut ___H,
6481 mut message: ::fidl_next::Message<___T>,
6482 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
6483 match *message.header().ordinal {
6484 ordinal => {
6485 handler.on_unknown_interaction(ordinal).await;
6486 if ::core::matches!(
6487 message.header().flexibility(),
6488 ::fidl_next::protocol::Flexibility::Strict
6489 ) {
6490 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6491 } else {
6492 Ok(())
6493 }
6494 }
6495 }
6496 }
6497}
6498
6499#[diagnostic::on_unimplemented(
6500 note = "If {Self} implements the non-local NodeServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
6501)]
6502
6503pub trait NodeLocalServerHandler<
6507 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6508 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6509>
6510{
6511 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
6512 fn sync(
6513 &mut self,
6514
6515 responder: ::fidl_next::Responder<node::Sync, ___T>,
6516 ) -> impl ::core::future::Future<Output = ()>;
6517
6518 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
6519 fn release(&mut self) -> impl ::core::future::Future<Output = ()>;
6520
6521 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
6522 fn set_name(
6523 &mut self,
6524
6525 request: ::fidl_next::Request<node::SetName, ___T>,
6526 ) -> impl ::core::future::Future<Output = ()>;
6527
6528 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
6529 fn set_debug_client_info(
6530 &mut self,
6531
6532 request: ::fidl_next::Request<node::SetDebugClientInfo, ___T>,
6533 ) -> impl ::core::future::Future<Output = ()>;
6534
6535 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
6536 fn set_debug_timeout_log_deadline(
6537 &mut self,
6538
6539 request: ::fidl_next::Request<node::SetDebugTimeoutLogDeadline, ___T>,
6540 ) -> impl ::core::future::Future<Output = ()>;
6541
6542 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
6543 fn set_verbose_logging(&mut self) -> impl ::core::future::Future<Output = ()>;
6544
6545 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
6546 fn get_node_ref(
6547 &mut self,
6548
6549 responder: ::fidl_next::Responder<node::GetNodeRef, ___T>,
6550 ) -> impl ::core::future::Future<Output = ()>;
6551
6552 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
6553 fn is_alternate_for(
6554 &mut self,
6555
6556 request: ::fidl_next::Request<node::IsAlternateFor, ___T>,
6557
6558 responder: ::fidl_next::Responder<node::IsAlternateFor, ___T>,
6559 ) -> impl ::core::future::Future<Output = ()>;
6560
6561 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
6562 fn get_buffer_collection_id(
6563 &mut self,
6564
6565 responder: ::fidl_next::Responder<node::GetBufferCollectionId, ___T>,
6566 ) -> impl ::core::future::Future<Output = ()>;
6567
6568 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
6569 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()>;
6570
6571 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
6572 fn set_weak_ok(
6573 &mut self,
6574
6575 request: ::fidl_next::Request<node::SetWeakOk, ___T>,
6576 ) -> impl ::core::future::Future<Output = ()>;
6577
6578 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
6579 fn attach_node_tracking(
6580 &mut self,
6581
6582 request: ::fidl_next::Request<node::AttachNodeTracking, ___T>,
6583 ) -> impl ::core::future::Future<Output = ()>;
6584
6585 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
6586 ::core::future::ready(())
6587 }
6588}
6589
6590impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Node
6591where
6592 ___H: NodeLocalServerHandler<___T>,
6593 ___T: ::fidl_next::Transport,
6594 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
6595 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6596 Constraint = (),
6597 >,
6598 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
6599 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6600 Constraint = (),
6601 >,
6602 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
6603 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6604 Constraint = (),
6605 >,
6606 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
6607 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6608 Constraint = (),
6609 >,
6610 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
6611 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6612 Constraint = (),
6613 >,
6614 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
6615 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6616 Constraint = (),
6617 >,
6618{
6619 async fn on_one_way(
6620 handler: &mut ___H,
6621 mut message: ::fidl_next::Message<___T>,
6622 ) -> ::core::result::Result<
6623 (),
6624 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6625 > {
6626 match *message.header().ordinal {
6627 7664192519607813318 => {
6628 handler.release().await;
6629 Ok(())
6630 }
6631
6632 811194812442657257 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
6633 Ok(decoded) => {
6634 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
6635 Ok(())
6636 }
6637 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6638 ordinal: 811194812442657257,
6639 error,
6640 }),
6641 },
6642
6643 6691936816931379633 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
6644 Ok(decoded) => {
6645 handler
6646 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
6647 .await;
6648 Ok(())
6649 }
6650 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6651 ordinal: 6691936816931379633,
6652 error,
6653 }),
6654 },
6655
6656 8172637980026734598 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
6657 Ok(decoded) => {
6658 handler
6659 .set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded))
6660 .await;
6661 Ok(())
6662 }
6663 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6664 ordinal: 8172637980026734598,
6665 error,
6666 }),
6667 },
6668
6669 5911475287294795693 => {
6670 handler.set_verbose_logging().await;
6671 Ok(())
6672 }
6673
6674 2512233045884338145 => {
6675 handler.set_weak().await;
6676 Ok(())
6677 }
6678
6679 4081474869151288297 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
6680 Ok(decoded) => {
6681 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
6682 Ok(())
6683 }
6684 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6685 ordinal: 4081474869151288297,
6686 error,
6687 }),
6688 },
6689
6690 4549465353676377516 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
6691 Ok(decoded) => {
6692 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
6693 Ok(())
6694 }
6695 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6696 ordinal: 4549465353676377516,
6697 error,
6698 }),
6699 },
6700
6701 ordinal => {
6702 handler.on_unknown_interaction(ordinal).await;
6703 if ::core::matches!(
6704 message.header().flexibility(),
6705 ::fidl_next::protocol::Flexibility::Strict
6706 ) {
6707 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6708 } else {
6709 Ok(())
6710 }
6711 }
6712 }
6713 }
6714
6715 async fn on_two_way(
6716 handler: &mut ___H,
6717 mut message: ::fidl_next::Message<___T>,
6718 responder: ::fidl_next::protocol::Responder<___T>,
6719 ) -> ::core::result::Result<
6720 (),
6721 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6722 > {
6723 match *message.header().ordinal {
6724 1273433845120064340 => {
6725 let responder = ::fidl_next::Responder::from_untyped(responder);
6726
6727 handler.sync(responder).await;
6728 Ok(())
6729 }
6730
6731 6574426773718429779 => {
6732 let responder = ::fidl_next::Responder::from_untyped(responder);
6733
6734 handler.get_node_ref(responder).await;
6735 Ok(())
6736 }
6737
6738 262772284282767397 => {
6739 let responder = ::fidl_next::Responder::from_untyped(responder);
6740
6741 match ::fidl_next::AsDecoderExt::into_decoded(message) {
6742 Ok(decoded) => {
6743 handler
6744 .is_alternate_for(
6745 ::fidl_next::Request::from_decoded(decoded),
6746 responder,
6747 )
6748 .await;
6749 Ok(())
6750 }
6751 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6752 ordinal: 262772284282767397,
6753 error,
6754 }),
6755 }
6756 }
6757
6758 8633851600235444876 => {
6759 let responder = ::fidl_next::Responder::from_untyped(responder);
6760
6761 handler.get_buffer_collection_id(responder).await;
6762 Ok(())
6763 }
6764
6765 ordinal => {
6766 handler.on_unknown_interaction(ordinal).await;
6767 if ::core::matches!(
6768 message.header().flexibility(),
6769 ::fidl_next::protocol::Flexibility::Strict
6770 ) {
6771 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6772 } else {
6773 responder
6774 .respond_framework_error(
6775 ordinal,
6776 ::fidl_next::FrameworkError::UnknownMethod,
6777 )
6778 .expect("encoding a framework error should never fail")
6779 .await?;
6780 Ok(())
6781 }
6782 }
6783 }
6784 }
6785}
6786
6787pub trait NodeClientHandler<
6791 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6792 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6793>
6794{
6795 fn on_unknown_interaction(
6796 &mut self,
6797 ordinal: u64,
6798 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
6799 ::core::future::ready(())
6800 }
6801}
6802
6803impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Node
6804where
6805 ___H: NodeClientHandler<___T> + ::core::marker::Send,
6806 ___T: ::fidl_next::Transport,
6807{
6808 async fn on_event(
6809 handler: &mut ___H,
6810 mut message: ::fidl_next::Message<___T>,
6811 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
6812 match *message.header().ordinal {
6813 ordinal => {
6814 handler.on_unknown_interaction(ordinal).await;
6815 if ::core::matches!(
6816 message.header().flexibility(),
6817 ::fidl_next::protocol::Flexibility::Strict
6818 ) {
6819 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6820 } else {
6821 Ok(())
6822 }
6823 }
6824 }
6825 }
6826}
6827
6828pub trait NodeServerHandler<
6832 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6833 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6834>
6835{
6836 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
6837 fn sync(
6838 &mut self,
6839
6840 responder: ::fidl_next::Responder<node::Sync, ___T>,
6841 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6842
6843 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
6844 fn release(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6845
6846 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
6847 fn set_name(
6848 &mut self,
6849
6850 request: ::fidl_next::Request<node::SetName, ___T>,
6851 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6852
6853 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
6854 fn set_debug_client_info(
6855 &mut self,
6856
6857 request: ::fidl_next::Request<node::SetDebugClientInfo, ___T>,
6858 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6859
6860 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
6861 fn set_debug_timeout_log_deadline(
6862 &mut self,
6863
6864 request: ::fidl_next::Request<node::SetDebugTimeoutLogDeadline, ___T>,
6865 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6866
6867 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
6868 fn set_verbose_logging(
6869 &mut self,
6870 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6871
6872 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
6873 fn get_node_ref(
6874 &mut self,
6875
6876 responder: ::fidl_next::Responder<node::GetNodeRef, ___T>,
6877 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6878
6879 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
6880 fn is_alternate_for(
6881 &mut self,
6882
6883 request: ::fidl_next::Request<node::IsAlternateFor, ___T>,
6884
6885 responder: ::fidl_next::Responder<node::IsAlternateFor, ___T>,
6886 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6887
6888 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
6889 fn get_buffer_collection_id(
6890 &mut self,
6891
6892 responder: ::fidl_next::Responder<node::GetBufferCollectionId, ___T>,
6893 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6894
6895 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
6896 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6897
6898 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
6899 fn set_weak_ok(
6900 &mut self,
6901
6902 request: ::fidl_next::Request<node::SetWeakOk, ___T>,
6903 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6904
6905 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
6906 fn attach_node_tracking(
6907 &mut self,
6908
6909 request: ::fidl_next::Request<node::AttachNodeTracking, ___T>,
6910 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6911
6912 fn on_unknown_interaction(
6913 &mut self,
6914 ordinal: u64,
6915 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
6916 ::core::future::ready(())
6917 }
6918}
6919
6920impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Node
6921where
6922 ___H: NodeServerHandler<___T> + ::core::marker::Send,
6923 ___T: ::fidl_next::Transport,
6924 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
6925 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6926 Constraint = (),
6927 >,
6928 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
6929 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6930 Constraint = (),
6931 >,
6932 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
6933 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6934 Constraint = (),
6935 >,
6936 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
6937 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6938 Constraint = (),
6939 >,
6940 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
6941 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6942 Constraint = (),
6943 >,
6944 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
6945 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6946 Constraint = (),
6947 >,
6948{
6949 async fn on_one_way(
6950 handler: &mut ___H,
6951 mut message: ::fidl_next::Message<___T>,
6952 ) -> ::core::result::Result<
6953 (),
6954 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6955 > {
6956 match *message.header().ordinal {
6957 7664192519607813318 => {
6958 handler.release().await;
6959 Ok(())
6960 }
6961
6962 811194812442657257 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
6963 Ok(decoded) => {
6964 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
6965 Ok(())
6966 }
6967 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6968 ordinal: 811194812442657257,
6969 error,
6970 }),
6971 },
6972
6973 6691936816931379633 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
6974 Ok(decoded) => {
6975 handler
6976 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
6977 .await;
6978 Ok(())
6979 }
6980 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6981 ordinal: 6691936816931379633,
6982 error,
6983 }),
6984 },
6985
6986 8172637980026734598 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
6987 Ok(decoded) => {
6988 handler
6989 .set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded))
6990 .await;
6991 Ok(())
6992 }
6993 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6994 ordinal: 8172637980026734598,
6995 error,
6996 }),
6997 },
6998
6999 5911475287294795693 => {
7000 handler.set_verbose_logging().await;
7001 Ok(())
7002 }
7003
7004 2512233045884338145 => {
7005 handler.set_weak().await;
7006 Ok(())
7007 }
7008
7009 4081474869151288297 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
7010 Ok(decoded) => {
7011 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
7012 Ok(())
7013 }
7014 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7015 ordinal: 4081474869151288297,
7016 error,
7017 }),
7018 },
7019
7020 4549465353676377516 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
7021 Ok(decoded) => {
7022 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
7023 Ok(())
7024 }
7025 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7026 ordinal: 4549465353676377516,
7027 error,
7028 }),
7029 },
7030
7031 ordinal => {
7032 handler.on_unknown_interaction(ordinal).await;
7033 if ::core::matches!(
7034 message.header().flexibility(),
7035 ::fidl_next::protocol::Flexibility::Strict
7036 ) {
7037 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7038 } else {
7039 Ok(())
7040 }
7041 }
7042 }
7043 }
7044
7045 async fn on_two_way(
7046 handler: &mut ___H,
7047 mut message: ::fidl_next::Message<___T>,
7048 responder: ::fidl_next::protocol::Responder<___T>,
7049 ) -> ::core::result::Result<
7050 (),
7051 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7052 > {
7053 match *message.header().ordinal {
7054 1273433845120064340 => {
7055 let responder = ::fidl_next::Responder::from_untyped(responder);
7056
7057 handler.sync(responder).await;
7058 Ok(())
7059 }
7060
7061 6574426773718429779 => {
7062 let responder = ::fidl_next::Responder::from_untyped(responder);
7063
7064 handler.get_node_ref(responder).await;
7065 Ok(())
7066 }
7067
7068 262772284282767397 => {
7069 let responder = ::fidl_next::Responder::from_untyped(responder);
7070
7071 match ::fidl_next::AsDecoderExt::into_decoded(message) {
7072 Ok(decoded) => {
7073 handler
7074 .is_alternate_for(
7075 ::fidl_next::Request::from_decoded(decoded),
7076 responder,
7077 )
7078 .await;
7079 Ok(())
7080 }
7081 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7082 ordinal: 262772284282767397,
7083 error,
7084 }),
7085 }
7086 }
7087
7088 8633851600235444876 => {
7089 let responder = ::fidl_next::Responder::from_untyped(responder);
7090
7091 handler.get_buffer_collection_id(responder).await;
7092 Ok(())
7093 }
7094
7095 ordinal => {
7096 handler.on_unknown_interaction(ordinal).await;
7097 if ::core::matches!(
7098 message.header().flexibility(),
7099 ::fidl_next::protocol::Flexibility::Strict
7100 ) {
7101 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7102 } else {
7103 responder
7104 .respond_framework_error(
7105 ordinal,
7106 ::fidl_next::FrameworkError::UnknownMethod,
7107 )
7108 .expect("encoding a framework error should never fail")
7109 .await?;
7110 Ok(())
7111 }
7112 }
7113 }
7114 }
7115}
7116
7117impl<___T> NodeClientHandler<___T> for ::fidl_next::IgnoreEvents
7118where
7119 ___T: ::fidl_next::Transport,
7120{
7121 async fn on_unknown_interaction(&mut self, _: u64) {}
7122}
7123
7124impl<___H, ___T> NodeLocalClientHandler<___T> for ::fidl_next::Local<___H>
7125where
7126 ___H: NodeClientHandler<___T>,
7127 ___T: ::fidl_next::Transport,
7128{
7129 async fn on_unknown_interaction(&mut self, ordinal: u64) {
7130 ___H::on_unknown_interaction(&mut self.0, ordinal).await
7131 }
7132}
7133
7134impl<___H, ___T> NodeLocalServerHandler<___T> for ::fidl_next::Local<___H>
7135where
7136 ___H: NodeServerHandler<___T>,
7137 ___T: ::fidl_next::Transport,
7138{
7139 async fn sync(&mut self, responder: ::fidl_next::Responder<node::Sync, ___T>) {
7140 ___H::sync(&mut self.0, responder).await
7141 }
7142
7143 async fn release(&mut self) {
7144 ___H::release(&mut self.0).await
7145 }
7146
7147 async fn set_name(&mut self, request: ::fidl_next::Request<node::SetName, ___T>) {
7148 ___H::set_name(&mut self.0, request).await
7149 }
7150
7151 async fn set_debug_client_info(
7152 &mut self,
7153
7154 request: ::fidl_next::Request<node::SetDebugClientInfo, ___T>,
7155 ) {
7156 ___H::set_debug_client_info(&mut self.0, request).await
7157 }
7158
7159 async fn set_debug_timeout_log_deadline(
7160 &mut self,
7161
7162 request: ::fidl_next::Request<node::SetDebugTimeoutLogDeadline, ___T>,
7163 ) {
7164 ___H::set_debug_timeout_log_deadline(&mut self.0, request).await
7165 }
7166
7167 async fn set_verbose_logging(&mut self) {
7168 ___H::set_verbose_logging(&mut self.0).await
7169 }
7170
7171 async fn get_node_ref(&mut self, responder: ::fidl_next::Responder<node::GetNodeRef, ___T>) {
7172 ___H::get_node_ref(&mut self.0, responder).await
7173 }
7174
7175 async fn is_alternate_for(
7176 &mut self,
7177
7178 request: ::fidl_next::Request<node::IsAlternateFor, ___T>,
7179
7180 responder: ::fidl_next::Responder<node::IsAlternateFor, ___T>,
7181 ) {
7182 ___H::is_alternate_for(&mut self.0, request, responder).await
7183 }
7184
7185 async fn get_buffer_collection_id(
7186 &mut self,
7187
7188 responder: ::fidl_next::Responder<node::GetBufferCollectionId, ___T>,
7189 ) {
7190 ___H::get_buffer_collection_id(&mut self.0, responder).await
7191 }
7192
7193 async fn set_weak(&mut self) {
7194 ___H::set_weak(&mut self.0).await
7195 }
7196
7197 async fn set_weak_ok(&mut self, request: ::fidl_next::Request<node::SetWeakOk, ___T>) {
7198 ___H::set_weak_ok(&mut self.0, request).await
7199 }
7200
7201 async fn attach_node_tracking(
7202 &mut self,
7203
7204 request: ::fidl_next::Request<node::AttachNodeTracking, ___T>,
7205 ) {
7206 ___H::attach_node_tracking(&mut self.0, request).await
7207 }
7208
7209 async fn on_unknown_interaction(&mut self, ordinal: u64) {
7210 ___H::on_unknown_interaction(&mut self.0, ordinal).await
7211 }
7212}
7213
7214#[doc = " [`fuchsia.sysmem2/BufferCollection`] is a connection directly from a\n participant to sysmem re. a buffer collection; often the buffer collection\n is shared with other participants which have their own `BufferCollection`\n client end(s) associated with the same buffer collection. In other words,\n an instance of the `BufferCollection` interface is a view of a buffer\n collection, not the buffer collection itself.\n\n The `BufferCollection` connection exists to facilitate async indication of\n when the buffer collection has been populated with buffers.\n\n Also, the channel\'s closure by the sysmem server is an indication to the\n client that the client should close all VMO handles that were obtained from\n the `BufferCollection` ASAP.\n\n Some buffer collections can use enough memory that it can be worth avoiding\n allocation overlap (in time) using\n [`fuchsia.sysmem2/BufferCollection.AttachLifetimeTracking`] so that the\n initiator can tell when enough buffers of the buffer collection have been\n fully deallocated prior to the initiator allocating a new buffer collection.\n\n Epitaphs are not used in this protocol.\n"]
7216#[derive(PartialEq, Debug)]
7217pub struct BufferCollection;
7218
7219#[cfg(target_os = "fuchsia")]
7220impl ::fidl_next::HasTransport for BufferCollection {
7221 type Transport = ::fidl_next::fuchsia::zx::Channel;
7222}
7223
7224pub mod buffer_collection {
7225 pub mod prelude {
7226 pub use crate::{
7227 BufferCollection, BufferCollectionClientHandler, BufferCollectionLocalClientHandler,
7228 BufferCollectionLocalServerHandler, BufferCollectionServerHandler, buffer_collection,
7229 };
7230
7231 pub use crate::natural::BufferCollectionAttachLifetimeTrackingRequest;
7232
7233 pub use crate::natural::BufferCollectionAttachTokenRequest;
7234
7235 pub use crate::natural::BufferCollectionSetConstraintsRequest;
7236
7237 pub use crate::natural::BufferCollectionCheckAllBuffersAllocatedResponse;
7238
7239 pub use crate::natural::BufferCollectionWaitForAllBuffersAllocatedResponse;
7240
7241 pub use crate::natural::Error;
7242
7243 pub use crate::natural::NodeAttachNodeTrackingRequest;
7244
7245 pub use crate::natural::NodeIsAlternateForRequest;
7246
7247 pub use crate::natural::NodeSetDebugClientInfoRequest;
7248
7249 pub use crate::natural::NodeSetDebugTimeoutLogDeadlineRequest;
7250
7251 pub use crate::natural::NodeSetNameRequest;
7252
7253 pub use crate::natural::NodeSetWeakOkRequest;
7254
7255 pub use crate::natural::NodeGetBufferCollectionIdResponse;
7256
7257 pub use crate::natural::NodeGetNodeRefResponse;
7258
7259 pub use crate::natural::NodeIsAlternateForResponse;
7260
7261 pub use crate::natural::NodeSyncResponse;
7262 }
7263
7264 pub struct Sync;
7265
7266 impl ::fidl_next::Method for Sync {
7267 const ORDINAL: u64 = 1273433845120064340;
7268 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7269 ::fidl_next::protocol::Flexibility::Flexible;
7270
7271 type Protocol = crate::BufferCollection;
7272
7273 type Request = ::fidl_next::wire::EmptyMessageBody;
7274 }
7275
7276 impl ::fidl_next::TwoWayMethod for Sync {
7277 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::NodeSyncResponse>;
7278 }
7279
7280 impl<___R> ::fidl_next::Respond<___R> for Sync {
7281 type Output = ::fidl_next::Flexible<___R>;
7282
7283 fn respond(response: ___R) -> Self::Output {
7284 ::fidl_next::Flexible(response)
7285 }
7286 }
7287
7288 pub struct Release;
7289
7290 impl ::fidl_next::Method for Release {
7291 const ORDINAL: u64 = 7664192519607813318;
7292 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7293 ::fidl_next::protocol::Flexibility::Flexible;
7294
7295 type Protocol = crate::BufferCollection;
7296
7297 type Request = ::fidl_next::wire::EmptyMessageBody;
7298 }
7299
7300 pub struct SetName;
7301
7302 impl ::fidl_next::Method for SetName {
7303 const ORDINAL: u64 = 811194812442657257;
7304 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7305 ::fidl_next::protocol::Flexibility::Flexible;
7306
7307 type Protocol = crate::BufferCollection;
7308
7309 type Request = crate::wire::NodeSetNameRequest<'static>;
7310 }
7311
7312 pub struct SetDebugClientInfo;
7313
7314 impl ::fidl_next::Method for SetDebugClientInfo {
7315 const ORDINAL: u64 = 6691936816931379633;
7316 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7317 ::fidl_next::protocol::Flexibility::Flexible;
7318
7319 type Protocol = crate::BufferCollection;
7320
7321 type Request = crate::wire::NodeSetDebugClientInfoRequest<'static>;
7322 }
7323
7324 pub struct SetDebugTimeoutLogDeadline;
7325
7326 impl ::fidl_next::Method for SetDebugTimeoutLogDeadline {
7327 const ORDINAL: u64 = 8172637980026734598;
7328 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7329 ::fidl_next::protocol::Flexibility::Flexible;
7330
7331 type Protocol = crate::BufferCollection;
7332
7333 type Request = crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>;
7334 }
7335
7336 pub struct SetVerboseLogging;
7337
7338 impl ::fidl_next::Method for SetVerboseLogging {
7339 const ORDINAL: u64 = 5911475287294795693;
7340 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7341 ::fidl_next::protocol::Flexibility::Flexible;
7342
7343 type Protocol = crate::BufferCollection;
7344
7345 type Request = ::fidl_next::wire::EmptyMessageBody;
7346 }
7347
7348 pub struct GetNodeRef;
7349
7350 impl ::fidl_next::Method for GetNodeRef {
7351 const ORDINAL: u64 = 6574426773718429779;
7352 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7353 ::fidl_next::protocol::Flexibility::Flexible;
7354
7355 type Protocol = crate::BufferCollection;
7356
7357 type Request = ::fidl_next::wire::EmptyMessageBody;
7358 }
7359
7360 impl ::fidl_next::TwoWayMethod for GetNodeRef {
7361 type Response =
7362 ::fidl_next::wire::Flexible<'static, crate::wire::NodeGetNodeRefResponse<'static>>;
7363 }
7364
7365 impl<___R> ::fidl_next::Respond<___R> for GetNodeRef {
7366 type Output = ::fidl_next::Flexible<___R>;
7367
7368 fn respond(response: ___R) -> Self::Output {
7369 ::fidl_next::Flexible(response)
7370 }
7371 }
7372
7373 pub struct IsAlternateFor;
7374
7375 impl ::fidl_next::Method for IsAlternateFor {
7376 const ORDINAL: u64 = 262772284282767397;
7377 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7378 ::fidl_next::protocol::Flexibility::Flexible;
7379
7380 type Protocol = crate::BufferCollection;
7381
7382 type Request = crate::wire::NodeIsAlternateForRequest<'static>;
7383 }
7384
7385 impl ::fidl_next::TwoWayMethod for IsAlternateFor {
7386 type Response = ::fidl_next::wire::Result<
7387 'static,
7388 crate::wire::NodeIsAlternateForResponse<'static>,
7389 crate::wire::Error,
7390 >;
7391 }
7392
7393 impl<___R> ::fidl_next::Respond<___R> for IsAlternateFor {
7394 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7395
7396 fn respond(response: ___R) -> Self::Output {
7397 ::core::result::Result::Ok(response)
7398 }
7399 }
7400
7401 impl<___R> ::fidl_next::RespondErr<___R> for IsAlternateFor {
7402 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7403
7404 fn respond_err(response: ___R) -> Self::Output {
7405 ::core::result::Result::Err(response)
7406 }
7407 }
7408
7409 pub struct GetBufferCollectionId;
7410
7411 impl ::fidl_next::Method for GetBufferCollectionId {
7412 const ORDINAL: u64 = 8633851600235444876;
7413 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7414 ::fidl_next::protocol::Flexibility::Flexible;
7415
7416 type Protocol = crate::BufferCollection;
7417
7418 type Request = ::fidl_next::wire::EmptyMessageBody;
7419 }
7420
7421 impl ::fidl_next::TwoWayMethod for GetBufferCollectionId {
7422 type Response = ::fidl_next::wire::Flexible<
7423 'static,
7424 crate::wire::NodeGetBufferCollectionIdResponse<'static>,
7425 >;
7426 }
7427
7428 impl<___R> ::fidl_next::Respond<___R> for GetBufferCollectionId {
7429 type Output = ::fidl_next::Flexible<___R>;
7430
7431 fn respond(response: ___R) -> Self::Output {
7432 ::fidl_next::Flexible(response)
7433 }
7434 }
7435
7436 pub struct SetWeak;
7437
7438 impl ::fidl_next::Method for SetWeak {
7439 const ORDINAL: u64 = 2512233045884338145;
7440 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7441 ::fidl_next::protocol::Flexibility::Flexible;
7442
7443 type Protocol = crate::BufferCollection;
7444
7445 type Request = ::fidl_next::wire::EmptyMessageBody;
7446 }
7447
7448 pub struct SetWeakOk;
7449
7450 impl ::fidl_next::Method for SetWeakOk {
7451 const ORDINAL: u64 = 4081474869151288297;
7452 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7453 ::fidl_next::protocol::Flexibility::Flexible;
7454
7455 type Protocol = crate::BufferCollection;
7456
7457 type Request = crate::wire::NodeSetWeakOkRequest<'static>;
7458 }
7459
7460 pub struct AttachNodeTracking;
7461
7462 impl ::fidl_next::Method for AttachNodeTracking {
7463 const ORDINAL: u64 = 4549465353676377516;
7464 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7465 ::fidl_next::protocol::Flexibility::Flexible;
7466
7467 type Protocol = crate::BufferCollection;
7468
7469 type Request = crate::wire::NodeAttachNodeTrackingRequest<'static>;
7470 }
7471
7472 pub struct SetConstraints;
7473
7474 impl ::fidl_next::Method for SetConstraints {
7475 const ORDINAL: u64 = 2296289463649704315;
7476 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7477 ::fidl_next::protocol::Flexibility::Flexible;
7478
7479 type Protocol = crate::BufferCollection;
7480
7481 type Request = crate::wire::BufferCollectionSetConstraintsRequest<'static>;
7482 }
7483
7484 pub struct WaitForAllBuffersAllocated;
7485
7486 impl ::fidl_next::Method for WaitForAllBuffersAllocated {
7487 const ORDINAL: u64 = 442197413015404622;
7488 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7489 ::fidl_next::protocol::Flexibility::Flexible;
7490
7491 type Protocol = crate::BufferCollection;
7492
7493 type Request = ::fidl_next::wire::EmptyMessageBody;
7494 }
7495
7496 impl ::fidl_next::TwoWayMethod for WaitForAllBuffersAllocated {
7497 type Response = ::fidl_next::wire::Result<
7498 'static,
7499 crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'static>,
7500 crate::wire::Error,
7501 >;
7502 }
7503
7504 impl<___R> ::fidl_next::Respond<___R> for WaitForAllBuffersAllocated {
7505 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7506
7507 fn respond(response: ___R) -> Self::Output {
7508 ::core::result::Result::Ok(response)
7509 }
7510 }
7511
7512 impl<___R> ::fidl_next::RespondErr<___R> for WaitForAllBuffersAllocated {
7513 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7514
7515 fn respond_err(response: ___R) -> Self::Output {
7516 ::core::result::Result::Err(response)
7517 }
7518 }
7519
7520 pub struct CheckAllBuffersAllocated;
7521
7522 impl ::fidl_next::Method for CheckAllBuffersAllocated {
7523 const ORDINAL: u64 = 3865775645687782416;
7524 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7525 ::fidl_next::protocol::Flexibility::Flexible;
7526
7527 type Protocol = crate::BufferCollection;
7528
7529 type Request = ::fidl_next::wire::EmptyMessageBody;
7530 }
7531
7532 impl ::fidl_next::TwoWayMethod for CheckAllBuffersAllocated {
7533 type Response = ::fidl_next::wire::Result<
7534 'static,
7535 crate::wire::BufferCollectionCheckAllBuffersAllocatedResponse,
7536 crate::wire::Error,
7537 >;
7538 }
7539
7540 impl<___R> ::fidl_next::Respond<___R> for CheckAllBuffersAllocated {
7541 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
7542
7543 fn respond(response: ___R) -> Self::Output {
7544 ::core::result::Result::Ok(response)
7545 }
7546 }
7547
7548 impl<___R> ::fidl_next::RespondErr<___R> for CheckAllBuffersAllocated {
7549 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
7550
7551 fn respond_err(response: ___R) -> Self::Output {
7552 ::core::result::Result::Err(response)
7553 }
7554 }
7555
7556 pub struct AttachToken;
7557
7558 impl ::fidl_next::Method for AttachToken {
7559 const ORDINAL: u64 = 5092582717741672834;
7560 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7561 ::fidl_next::protocol::Flexibility::Flexible;
7562
7563 type Protocol = crate::BufferCollection;
7564
7565 type Request = crate::wire::BufferCollectionAttachTokenRequest<'static>;
7566 }
7567
7568 pub struct AttachLifetimeTracking;
7569
7570 impl ::fidl_next::Method for AttachLifetimeTracking {
7571 const ORDINAL: u64 = 4524799315680521679;
7572 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
7573 ::fidl_next::protocol::Flexibility::Flexible;
7574
7575 type Protocol = crate::BufferCollection;
7576
7577 type Request = crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'static>;
7578 }
7579
7580 mod ___detail {
7581 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::BufferCollection
7582 where
7583 ___T: ::fidl_next::Transport,
7584 {
7585 type Client = BufferCollectionClient<___T>;
7586 type Server = BufferCollectionServer<___T>;
7587 }
7588
7589 #[repr(transparent)]
7591 pub struct BufferCollectionClient<___T: ::fidl_next::Transport> {
7592 #[allow(dead_code)]
7593 client: ::fidl_next::protocol::Client<___T>,
7594 }
7595
7596 impl<___T> BufferCollectionClient<___T>
7597 where
7598 ___T: ::fidl_next::Transport,
7599 {
7600 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
7601 pub fn sync(&self) -> ::fidl_next::TwoWayFuture<'_, super::Sync, ___T> {
7602 ::fidl_next::TwoWayFuture::from_untyped(
7603 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7604 1273433845120064340,
7605 <super::Sync as ::fidl_next::Method>::FLEXIBILITY,
7606 (),
7607 ),
7608 )
7609 }
7610
7611 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
7612 pub fn release(&self) -> ::fidl_next::SendFuture<'_, ___T> {
7613 ::fidl_next::SendFuture::from_untyped(
7614 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
7615 7664192519607813318,
7616 <super::Release as ::fidl_next::Method>::FLEXIBILITY,
7617 (),
7618 ),
7619 )
7620 }
7621
7622 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
7623 pub fn set_name_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
7624 where
7625 ___R: ::fidl_next::Encode<
7626 crate::wire::NodeSetNameRequest<'static>,
7627 <___T as ::fidl_next::Transport>::SendBuffer,
7628 >,
7629 {
7630 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7631 811194812442657257,
7632 <super::SetName as ::fidl_next::Method>::FLEXIBILITY,
7633 request,
7634 ))
7635 }
7636
7637 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
7638 pub fn set_debug_client_info_with<___R>(
7639 &self,
7640 request: ___R,
7641 ) -> ::fidl_next::SendFuture<'_, ___T>
7642 where
7643 ___R: ::fidl_next::Encode<
7644 crate::wire::NodeSetDebugClientInfoRequest<'static>,
7645 <___T as ::fidl_next::Transport>::SendBuffer,
7646 >,
7647 {
7648 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7649 6691936816931379633,
7650 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
7651 request,
7652 ))
7653 }
7654
7655 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
7656 pub fn set_debug_timeout_log_deadline_with<___R>(
7657 &self,
7658 request: ___R,
7659 ) -> ::fidl_next::SendFuture<'_, ___T>
7660 where
7661 ___R: ::fidl_next::Encode<
7662 crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>,
7663 <___T as ::fidl_next::Transport>::SendBuffer,
7664 >,
7665 {
7666 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7667 8172637980026734598,
7668 <super::SetDebugTimeoutLogDeadline as ::fidl_next::Method>::FLEXIBILITY,
7669 request,
7670 ))
7671 }
7672
7673 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
7674 pub fn set_verbose_logging(&self) -> ::fidl_next::SendFuture<'_, ___T> {
7675 ::fidl_next::SendFuture::from_untyped(
7676 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
7677 5911475287294795693,
7678 <super::SetVerboseLogging as ::fidl_next::Method>::FLEXIBILITY,
7679 (),
7680 ),
7681 )
7682 }
7683
7684 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
7685 pub fn get_node_ref(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetNodeRef, ___T> {
7686 ::fidl_next::TwoWayFuture::from_untyped(
7687 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7688 6574426773718429779,
7689 <super::GetNodeRef as ::fidl_next::Method>::FLEXIBILITY,
7690 (),
7691 ),
7692 )
7693 }
7694
7695 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
7696 pub fn is_alternate_for_with<___R>(
7697 &self,
7698 request: ___R,
7699 ) -> ::fidl_next::TwoWayFuture<'_, super::IsAlternateFor, ___T>
7700 where
7701 ___R: ::fidl_next::Encode<
7702 crate::wire::NodeIsAlternateForRequest<'static>,
7703 <___T as ::fidl_next::Transport>::SendBuffer,
7704 >,
7705 {
7706 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
7707 262772284282767397,
7708 <super::IsAlternateFor as ::fidl_next::Method>::FLEXIBILITY,
7709 request,
7710 ))
7711 }
7712
7713 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
7714 pub fn get_buffer_collection_id(
7715 &self,
7716 ) -> ::fidl_next::TwoWayFuture<'_, super::GetBufferCollectionId, ___T> {
7717 ::fidl_next::TwoWayFuture::from_untyped(
7718 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7719 8633851600235444876,
7720 <super::GetBufferCollectionId as ::fidl_next::Method>::FLEXIBILITY,
7721 (),
7722 ),
7723 )
7724 }
7725
7726 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
7727 pub fn set_weak(&self) -> ::fidl_next::SendFuture<'_, ___T> {
7728 ::fidl_next::SendFuture::from_untyped(
7729 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
7730 2512233045884338145,
7731 <super::SetWeak as ::fidl_next::Method>::FLEXIBILITY,
7732 (),
7733 ),
7734 )
7735 }
7736
7737 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
7738 pub fn set_weak_ok_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
7739 where
7740 ___R: ::fidl_next::Encode<
7741 crate::wire::NodeSetWeakOkRequest<'static>,
7742 <___T as ::fidl_next::Transport>::SendBuffer,
7743 >,
7744 {
7745 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7746 4081474869151288297,
7747 <super::SetWeakOk as ::fidl_next::Method>::FLEXIBILITY,
7748 request,
7749 ))
7750 }
7751
7752 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
7753 pub fn attach_node_tracking_with<___R>(
7754 &self,
7755 request: ___R,
7756 ) -> ::fidl_next::SendFuture<'_, ___T>
7757 where
7758 ___R: ::fidl_next::Encode<
7759 crate::wire::NodeAttachNodeTrackingRequest<'static>,
7760 <___T as ::fidl_next::Transport>::SendBuffer,
7761 >,
7762 {
7763 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7764 4549465353676377516,
7765 <super::AttachNodeTracking as ::fidl_next::Method>::FLEXIBILITY,
7766 request,
7767 ))
7768 }
7769
7770 #[doc = " Provide [`fuchsia.sysmem2/BufferCollectionConstraints`] to the buffer\n collection.\n\n A participant may only call\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] up to once per\n [`fuchsia.sysmem2/BufferCollection`].\n\n For buffer allocation to be attempted, all holders of a\n `BufferCollection` client end need to call `SetConstraints` before\n sysmem will attempt to allocate buffers.\n"]
7771 pub fn set_constraints_with<___R>(
7772 &self,
7773 request: ___R,
7774 ) -> ::fidl_next::SendFuture<'_, ___T>
7775 where
7776 ___R: ::fidl_next::Encode<
7777 crate::wire::BufferCollectionSetConstraintsRequest<'static>,
7778 <___T as ::fidl_next::Transport>::SendBuffer,
7779 >,
7780 {
7781 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7782 2296289463649704315,
7783 <super::SetConstraints as ::fidl_next::Method>::FLEXIBILITY,
7784 request,
7785 ))
7786 }
7787
7788 #[doc = " Wait until all buffers are allocated.\n\n This FIDL call completes when buffers have been allocated, or completes\n with some failure detail if allocation has been attempted but failed.\n\n The following must occur before buffers will be allocated:\n * All [`fuchsia.sysmem2/BufferCollectionToken`](s) of the buffer\n collection must be turned in via `BindSharedCollection` to get a\n [`fuchsia.sysmem2/BufferCollection`] (for brevity, this is assuming\n [`fuchsia.sysmem2/BufferCollection.AttachToken`] isn\'t being used),\n or have had [`fuchsia.sysmem2/BufferCollectionToken.Release`] sent\n to them.\n * All [`fuchsia.sysmem2/BufferCollection`](s) of the buffer collection\n must have had [`fuchsia.sysmem2/BufferCollection.SetConstraints`]\n sent to them, or had [`fuchsia.sysmem2/BufferCollection.Release`]\n sent to them.\n\n - result `buffer_collection_info` The VMO handles and other related\n info.\n * error `[fuchsia.sysmem2/Error.NO_MEMORY]` The request is valid but\n cannot be fulfilled due to resource exhaustion.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION`] The request is\n malformed.\n * error `[fuchsia.sysmem2/Error.CONSTRAINTS_INTERSECTION_EMPTY`] The\n request is valid but cannot be satisfied, perhaps due to hardware\n limitations. This can happen if participants have incompatible\n constraints (empty intersection, roughly speaking). See the log for\n more info. In cases where a participant could potentially be treated\n as optional, see [`BufferCollectionTokenGroup`]. When using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], this will be the\n error code if there aren\'t enough buffers in the pre-existing\n collection to satisfy the constraints set on the attached token and\n any sub-tree of tokens derived from the attached token.\n"]
7789 pub fn wait_for_all_buffers_allocated(
7790 &self,
7791 ) -> ::fidl_next::TwoWayFuture<'_, super::WaitForAllBuffersAllocated, ___T>
7792 {
7793 ::fidl_next::TwoWayFuture::from_untyped(
7794 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7795 442197413015404622,
7796 <super::WaitForAllBuffersAllocated as ::fidl_next::Method>::FLEXIBILITY,
7797 (),
7798 ),
7799 )
7800 }
7801
7802 #[doc = " Checks whether all the buffers have been allocated, in a polling\n fashion.\n\n * If the buffer collection has been allocated, returns success.\n * If the buffer collection failed allocation, returns the same\n [`fuchsia.sysmem2/Error`] as\n [`fuchsia.sysmem2/BufferCollection/WaitForAllBuffersAllocated`] would\n return.\n * error [`fuchsia.sysmem2/Error.PENDING`] The buffer collection hasn\'t\n attempted allocation yet. This means that WaitForAllBuffersAllocated\n would not respond quickly.\n"]
7803 pub fn check_all_buffers_allocated(
7804 &self,
7805 ) -> ::fidl_next::TwoWayFuture<'_, super::CheckAllBuffersAllocated, ___T> {
7806 ::fidl_next::TwoWayFuture::from_untyped(
7807 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7808 3865775645687782416,
7809 <super::CheckAllBuffersAllocated as ::fidl_next::Method>::FLEXIBILITY,
7810 (),
7811 ),
7812 )
7813 }
7814
7815 #[doc = " Create a new token to add a new participant to an existing logical\n buffer collection, if the existing collection\'s buffer counts,\n constraints, and participants allow.\n\n This can be useful in replacing a failed participant, and/or in\n adding/re-adding a participant after buffers have already been\n allocated.\n\n When [`fuchsia.sysmem2/BufferCollection.AttachToken`] is used, the sub\n tree rooted at the attached [`fuchsia.sysmem2/BufferCollectionToken`]\n goes through the normal procedure of setting constraints or closing\n [`fuchsia.sysmem2/Node`](s), and then appearing to allocate buffers from\n clients\' point of view, despite the possibility that all the buffers\n were actually allocated previously. This process is called \"logical\n allocation\". Most instances of \"allocation\" in docs for other messages\n can also be read as \"allocation or logical allocation\" while remaining\n valid, but we just say \"allocation\" in most places for brevity/clarity\n of explanation, with the details of \"logical allocation\" left for the\n docs here on `AttachToken`.\n\n Failure of an attached `Node` does not propagate to the parent of the\n attached `Node`. More generally, failure of a child `Node` is blocked\n from reaching its parent `Node` if the child is attached, or if the\n child is dispensable and the failure occurred after logical allocation\n (see [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`]).\n\n A participant may in some scenarios choose to initially use a\n dispensable token for a given instance of a delegate participant, and\n then later if the first instance of that delegate participant fails, a\n new second instance of that delegate participant my be given a token\n created with `AttachToken`.\n\n From the point of view of the [`fuchsia.sysmem2/BufferCollectionToken`]\n client end, the token acts like any other token. The client can\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] the token as needed,\n and can send the token to a different process/participant. The\n `BufferCollectionToken` `Node` should be converted to a\n `BufferCollection` `Node` as normal by sending\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or can be closed\n without causing subtree failure by sending\n [`fuchsia.sysmem2/BufferCollectionToken.Release`]. Assuming the former,\n the [`fuchsia.sysmem2/BufferCollection.SetConstraints`] message or\n [`fuchsia.sysmem2/BufferCollection.Release`] message should be sent to\n the `BufferCollection`.\n\n Within the subtree, a success result from\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`] means\n the subtree participants\' constraints were satisfiable using the\n already-existing buffer collection, the already-established\n [`fuchsia.sysmem2/BufferCollectionInfo`] including image format\n constraints, and the already-existing other participants (already added\n via successful logical allocation) and their specified buffer counts in\n their constraints. A failure result means the new participants\'\n constraints cannot be satisfied using the existing buffer collection and\n its already-added participants. Creating a new collection instead may\n allow all participants\' constraints to be satisfied, assuming\n `SetDispensable` is used in place of `AttachToken`, or a normal token is\n used.\n\n A token created with `AttachToken` performs constraints aggregation with\n all constraints currently in effect on the buffer collection, plus the\n attached token under consideration plus child tokens under the attached\n token which are not themselves an attached token or under such a token.\n Further subtrees under this subtree are considered for logical\n allocation only after this subtree has completed logical allocation.\n\n Assignment of existing buffers to participants\'\n [`fuchsia.sysmem2/BufferCollectionConstraints.min_buffer_count_for_camping`]\n etc is first-come first-served, but a child can\'t logically allocate\n before all its parents have sent `SetConstraints`.\n\n See also [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`], which\n in contrast to `AttachToken`, has the created token `Node` + child\n `Node`(s) (in the created subtree but not in any subtree under this\n subtree) participate in constraints aggregation along with its parent\n during the parent\'s allocation or logical allocation.\n\n Similar to [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`], the\n newly created token needs to be [`fuchsia.sysmem2/Node.Sync`]ed to\n sysmem before the new token can be passed to `BindSharedCollection`. The\n `Sync` of the new token can be accomplished with\n [`fuchsia.sysmem2/BufferCollection.Sync`] after converting the created\n `BufferCollectionToken` to a `BufferCollection`. Alternately,\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on the new token also\n works. Or using [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`]\n works. As usual, a `BufferCollectionToken.Sync` can be started after any\n `BufferCollectionToken.Duplicate` messages have been sent via the newly\n created token, to also sync those additional tokens to sysmem using a\n single round-trip.\n\n All table fields are currently required.\n\n + request `rights_attentuation_mask` This allows attenuating the VMO\n rights of the subtree. These values for `rights_attenuation_mask`\n result in no attenuation (note that 0 is not on this list):\n + ZX_RIGHT_SAME_RIGHTS (preferred)\n + 0xFFFFFFFF (this is reasonable when an attenuation mask is computed)\n + request `token_request` The server end of the `BufferCollectionToken`\n channel. The client retains the client end.\n"]
7816 pub fn attach_token_with<___R>(
7817 &self,
7818 request: ___R,
7819 ) -> ::fidl_next::SendFuture<'_, ___T>
7820 where
7821 ___R: ::fidl_next::Encode<
7822 crate::wire::BufferCollectionAttachTokenRequest<'static>,
7823 <___T as ::fidl_next::Transport>::SendBuffer,
7824 >,
7825 {
7826 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7827 5092582717741672834,
7828 <super::AttachToken as ::fidl_next::Method>::FLEXIBILITY,
7829 request,
7830 ))
7831 }
7832
7833 #[doc = " Set up an eventpair to be signalled (`ZX_EVENTPAIR_PEER_CLOSED`) when\n buffers have been allocated and only the specified number of buffers (or\n fewer) remain in the buffer collection.\n\n [`fuchsia.sysmem2/BufferCollection.AttachLifetimeTracking`] allows a\n client to wait until an old buffer collection is fully or mostly\n deallocated before attempting allocation of a new buffer collection. The\n eventpair is only signalled when the buffers of this collection have\n been fully deallocated (not just un-referenced by clients, but all the\n memory consumed by those buffers has been fully reclaimed/recycled), or\n when allocation or logical allocation fails for the tree or subtree\n including this [`fuchsia.sysmem2/BufferCollection`].\n\n The eventpair won\'t be signalled until allocation or logical allocation\n has completed; until then, the collection\'s current buffer count is\n ignored.\n\n If logical allocation fails for an attached subtree (using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]), the server end of the\n eventpair will close during that failure regardless of the number of\n buffers potenitally allocated in the overall buffer collection. This is\n for logical allocation consistency with normal allocation.\n\n The lifetime signalled by this event includes asynchronous cleanup of\n allocated buffers, and this asynchronous cleanup cannot occur until all\n holders of VMO handles to the buffers have closed those VMO handles.\n Therefore, clients should take care not to become blocked forever\n waiting for `ZX_EVENTPAIR_PEER_CLOSED` to be signalled if any of the\n participants using the logical buffer collection (including the waiter\n itself) are less trusted, less reliable, or potentially blocked by the\n wait itself. Waiting asynchronously is recommended. Setting a deadline\n for the client wait may be prudent, depending on details of how the\n collection and/or its VMOs are used or shared. Failure to allocate a\n new/replacement buffer collection is better than getting stuck forever.\n\n The sysmem server itself intentionally does not perform any waiting on\n already-failed collections\' VMOs to finish cleaning up before attempting\n a new allocation, and the sysmem server intentionally doesn\'t retry\n allocation if a new allocation fails due to out of memory, even if that\n failure is potentially due to continued existence of an old collection\'s\n VMOs. This `AttachLifetimeTracking` message is how an initiator can\n mitigate too much overlap of old VMO lifetimes with new VMO lifetimes,\n as long as the waiting client is careful to not create a deadlock.\n\n Continued existence of old collections that are still cleaning up is not\n the only reason that a new allocation may fail due to insufficient\n memory, even if the new allocation is allocating physically contiguous\n buffers. Overall system memory pressure can also be the cause of failure\n to allocate a new collection. See also\n [`fuchsia.memorypressure/Provider`].\n\n `AttachLifetimeTracking` is meant to be compatible with other protocols\n with a similar `AttachLifetimeTracking` message; duplicates of the same\n `eventpair` handle (server end) can be sent via more than one\n `AttachLifetimeTracking` message to different protocols, and the\n `ZX_EVENTPAIR_PEER_CLOSED` will be signalled for the client end when all\n the conditions are met (all holders of duplicates have closed their\n server end handle(s)). Also, thanks to how eventpair endponts work, the\n client end can (also) be duplicated without preventing the\n `ZX_EVENTPAIR_PEER_CLOSED` signal.\n\n The server intentionally doesn\'t \"trust\" any signals set on the\n `server_end`. This mechanism intentionally uses only\n `ZX_EVENTPAIR_PEER_CLOSED` set on the client end, which can\'t be set\n \"early\", and is only set when all handles to the server end eventpair\n are closed. No meaning is associated with any of the other signals, and\n clients should ignore any other signal bits on either end of the\n `eventpair`.\n\n The `server_end` may lack `ZX_RIGHT_SIGNAL` or `ZX_RIGHT_SIGNAL_PEER`,\n but must have `ZX_RIGHT_DUPLICATE` (and must have `ZX_RIGHT_TRANSFER` to\n transfer without causing `BufferCollection` channel failure).\n\n All table fields are currently required.\n\n + request `server_end` This eventpair handle will be closed by the\n sysmem server when buffers have been allocated initially and the\n number of buffers is then less than or equal to `buffers_remaining`.\n + request `buffers_remaining` Wait for all but `buffers_remaining` (or\n fewer) buffers to be fully deallocated. A number greater than zero can\n be useful in situations where a known number of buffers are\n intentionally not closed so that the data can continue to be used,\n such as for keeping the last available video frame displayed in the UI\n even if the video stream was using protected output buffers. It\'s\n outside the scope of the `BufferCollection` interface (at least for\n now) to determine how many buffers may be held without closing, but\n it\'ll typically be in the range 0-2.\n"]
7834 pub fn attach_lifetime_tracking_with<___R>(
7835 &self,
7836 request: ___R,
7837 ) -> ::fidl_next::SendFuture<'_, ___T>
7838 where
7839 ___R: ::fidl_next::Encode<
7840 crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'static>,
7841 <___T as ::fidl_next::Transport>::SendBuffer,
7842 >,
7843 {
7844 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7845 4524799315680521679,
7846 <super::AttachLifetimeTracking as ::fidl_next::Method>::FLEXIBILITY,
7847 request,
7848 ))
7849 }
7850 }
7851
7852 #[repr(transparent)]
7854 pub struct BufferCollectionServer<___T: ::fidl_next::Transport> {
7855 server: ::fidl_next::protocol::Server<___T>,
7856 }
7857
7858 impl<___T> BufferCollectionServer<___T> where ___T: ::fidl_next::Transport {}
7859 }
7860}
7861
7862#[diagnostic::on_unimplemented(
7863 note = "If {Self} implements the non-local BufferCollectionClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
7864)]
7865
7866pub trait BufferCollectionLocalClientHandler<
7870 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7871 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7872>
7873{
7874 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
7875 ::core::future::ready(())
7876 }
7877}
7878
7879impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for BufferCollection
7880where
7881 ___H: BufferCollectionLocalClientHandler<___T>,
7882 ___T: ::fidl_next::Transport,
7883{
7884 async fn on_event(
7885 handler: &mut ___H,
7886 mut message: ::fidl_next::Message<___T>,
7887 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
7888 match *message.header().ordinal {
7889 ordinal => {
7890 handler.on_unknown_interaction(ordinal).await;
7891 if ::core::matches!(
7892 message.header().flexibility(),
7893 ::fidl_next::protocol::Flexibility::Strict
7894 ) {
7895 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7896 } else {
7897 Ok(())
7898 }
7899 }
7900 }
7901 }
7902}
7903
7904#[diagnostic::on_unimplemented(
7905 note = "If {Self} implements the non-local BufferCollectionServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
7906)]
7907
7908pub trait BufferCollectionLocalServerHandler<
7912 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7913 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7914>
7915{
7916 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
7917 fn sync(
7918 &mut self,
7919
7920 responder: ::fidl_next::Responder<buffer_collection::Sync, ___T>,
7921 ) -> impl ::core::future::Future<Output = ()>;
7922
7923 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
7924 fn release(&mut self) -> impl ::core::future::Future<Output = ()>;
7925
7926 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
7927 fn set_name(
7928 &mut self,
7929
7930 request: ::fidl_next::Request<buffer_collection::SetName, ___T>,
7931 ) -> impl ::core::future::Future<Output = ()>;
7932
7933 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
7934 fn set_debug_client_info(
7935 &mut self,
7936
7937 request: ::fidl_next::Request<buffer_collection::SetDebugClientInfo, ___T>,
7938 ) -> impl ::core::future::Future<Output = ()>;
7939
7940 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
7941 fn set_debug_timeout_log_deadline(
7942 &mut self,
7943
7944 request: ::fidl_next::Request<buffer_collection::SetDebugTimeoutLogDeadline, ___T>,
7945 ) -> impl ::core::future::Future<Output = ()>;
7946
7947 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
7948 fn set_verbose_logging(&mut self) -> impl ::core::future::Future<Output = ()>;
7949
7950 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
7951 fn get_node_ref(
7952 &mut self,
7953
7954 responder: ::fidl_next::Responder<buffer_collection::GetNodeRef, ___T>,
7955 ) -> impl ::core::future::Future<Output = ()>;
7956
7957 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
7958 fn is_alternate_for(
7959 &mut self,
7960
7961 request: ::fidl_next::Request<buffer_collection::IsAlternateFor, ___T>,
7962
7963 responder: ::fidl_next::Responder<buffer_collection::IsAlternateFor, ___T>,
7964 ) -> impl ::core::future::Future<Output = ()>;
7965
7966 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
7967 fn get_buffer_collection_id(
7968 &mut self,
7969
7970 responder: ::fidl_next::Responder<buffer_collection::GetBufferCollectionId, ___T>,
7971 ) -> impl ::core::future::Future<Output = ()>;
7972
7973 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
7974 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()>;
7975
7976 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
7977 fn set_weak_ok(
7978 &mut self,
7979
7980 request: ::fidl_next::Request<buffer_collection::SetWeakOk, ___T>,
7981 ) -> impl ::core::future::Future<Output = ()>;
7982
7983 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
7984 fn attach_node_tracking(
7985 &mut self,
7986
7987 request: ::fidl_next::Request<buffer_collection::AttachNodeTracking, ___T>,
7988 ) -> impl ::core::future::Future<Output = ()>;
7989
7990 #[doc = " Provide [`fuchsia.sysmem2/BufferCollectionConstraints`] to the buffer\n collection.\n\n A participant may only call\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] up to once per\n [`fuchsia.sysmem2/BufferCollection`].\n\n For buffer allocation to be attempted, all holders of a\n `BufferCollection` client end need to call `SetConstraints` before\n sysmem will attempt to allocate buffers.\n"]
7991 fn set_constraints(
7992 &mut self,
7993
7994 request: ::fidl_next::Request<buffer_collection::SetConstraints, ___T>,
7995 ) -> impl ::core::future::Future<Output = ()>;
7996
7997 #[doc = " Wait until all buffers are allocated.\n\n This FIDL call completes when buffers have been allocated, or completes\n with some failure detail if allocation has been attempted but failed.\n\n The following must occur before buffers will be allocated:\n * All [`fuchsia.sysmem2/BufferCollectionToken`](s) of the buffer\n collection must be turned in via `BindSharedCollection` to get a\n [`fuchsia.sysmem2/BufferCollection`] (for brevity, this is assuming\n [`fuchsia.sysmem2/BufferCollection.AttachToken`] isn\'t being used),\n or have had [`fuchsia.sysmem2/BufferCollectionToken.Release`] sent\n to them.\n * All [`fuchsia.sysmem2/BufferCollection`](s) of the buffer collection\n must have had [`fuchsia.sysmem2/BufferCollection.SetConstraints`]\n sent to them, or had [`fuchsia.sysmem2/BufferCollection.Release`]\n sent to them.\n\n - result `buffer_collection_info` The VMO handles and other related\n info.\n * error `[fuchsia.sysmem2/Error.NO_MEMORY]` The request is valid but\n cannot be fulfilled due to resource exhaustion.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION`] The request is\n malformed.\n * error `[fuchsia.sysmem2/Error.CONSTRAINTS_INTERSECTION_EMPTY`] The\n request is valid but cannot be satisfied, perhaps due to hardware\n limitations. This can happen if participants have incompatible\n constraints (empty intersection, roughly speaking). See the log for\n more info. In cases where a participant could potentially be treated\n as optional, see [`BufferCollectionTokenGroup`]. When using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], this will be the\n error code if there aren\'t enough buffers in the pre-existing\n collection to satisfy the constraints set on the attached token and\n any sub-tree of tokens derived from the attached token.\n"]
7998 fn wait_for_all_buffers_allocated(
7999 &mut self,
8000
8001 responder: ::fidl_next::Responder<buffer_collection::WaitForAllBuffersAllocated, ___T>,
8002 ) -> impl ::core::future::Future<Output = ()>;
8003
8004 #[doc = " Checks whether all the buffers have been allocated, in a polling\n fashion.\n\n * If the buffer collection has been allocated, returns success.\n * If the buffer collection failed allocation, returns the same\n [`fuchsia.sysmem2/Error`] as\n [`fuchsia.sysmem2/BufferCollection/WaitForAllBuffersAllocated`] would\n return.\n * error [`fuchsia.sysmem2/Error.PENDING`] The buffer collection hasn\'t\n attempted allocation yet. This means that WaitForAllBuffersAllocated\n would not respond quickly.\n"]
8005 fn check_all_buffers_allocated(
8006 &mut self,
8007
8008 responder: ::fidl_next::Responder<buffer_collection::CheckAllBuffersAllocated, ___T>,
8009 ) -> impl ::core::future::Future<Output = ()>;
8010
8011 #[doc = " Create a new token to add a new participant to an existing logical\n buffer collection, if the existing collection\'s buffer counts,\n constraints, and participants allow.\n\n This can be useful in replacing a failed participant, and/or in\n adding/re-adding a participant after buffers have already been\n allocated.\n\n When [`fuchsia.sysmem2/BufferCollection.AttachToken`] is used, the sub\n tree rooted at the attached [`fuchsia.sysmem2/BufferCollectionToken`]\n goes through the normal procedure of setting constraints or closing\n [`fuchsia.sysmem2/Node`](s), and then appearing to allocate buffers from\n clients\' point of view, despite the possibility that all the buffers\n were actually allocated previously. This process is called \"logical\n allocation\". Most instances of \"allocation\" in docs for other messages\n can also be read as \"allocation or logical allocation\" while remaining\n valid, but we just say \"allocation\" in most places for brevity/clarity\n of explanation, with the details of \"logical allocation\" left for the\n docs here on `AttachToken`.\n\n Failure of an attached `Node` does not propagate to the parent of the\n attached `Node`. More generally, failure of a child `Node` is blocked\n from reaching its parent `Node` if the child is attached, or if the\n child is dispensable and the failure occurred after logical allocation\n (see [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`]).\n\n A participant may in some scenarios choose to initially use a\n dispensable token for a given instance of a delegate participant, and\n then later if the first instance of that delegate participant fails, a\n new second instance of that delegate participant my be given a token\n created with `AttachToken`.\n\n From the point of view of the [`fuchsia.sysmem2/BufferCollectionToken`]\n client end, the token acts like any other token. The client can\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] the token as needed,\n and can send the token to a different process/participant. The\n `BufferCollectionToken` `Node` should be converted to a\n `BufferCollection` `Node` as normal by sending\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or can be closed\n without causing subtree failure by sending\n [`fuchsia.sysmem2/BufferCollectionToken.Release`]. Assuming the former,\n the [`fuchsia.sysmem2/BufferCollection.SetConstraints`] message or\n [`fuchsia.sysmem2/BufferCollection.Release`] message should be sent to\n the `BufferCollection`.\n\n Within the subtree, a success result from\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`] means\n the subtree participants\' constraints were satisfiable using the\n already-existing buffer collection, the already-established\n [`fuchsia.sysmem2/BufferCollectionInfo`] including image format\n constraints, and the already-existing other participants (already added\n via successful logical allocation) and their specified buffer counts in\n their constraints. A failure result means the new participants\'\n constraints cannot be satisfied using the existing buffer collection and\n its already-added participants. Creating a new collection instead may\n allow all participants\' constraints to be satisfied, assuming\n `SetDispensable` is used in place of `AttachToken`, or a normal token is\n used.\n\n A token created with `AttachToken` performs constraints aggregation with\n all constraints currently in effect on the buffer collection, plus the\n attached token under consideration plus child tokens under the attached\n token which are not themselves an attached token or under such a token.\n Further subtrees under this subtree are considered for logical\n allocation only after this subtree has completed logical allocation.\n\n Assignment of existing buffers to participants\'\n [`fuchsia.sysmem2/BufferCollectionConstraints.min_buffer_count_for_camping`]\n etc is first-come first-served, but a child can\'t logically allocate\n before all its parents have sent `SetConstraints`.\n\n See also [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`], which\n in contrast to `AttachToken`, has the created token `Node` + child\n `Node`(s) (in the created subtree but not in any subtree under this\n subtree) participate in constraints aggregation along with its parent\n during the parent\'s allocation or logical allocation.\n\n Similar to [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`], the\n newly created token needs to be [`fuchsia.sysmem2/Node.Sync`]ed to\n sysmem before the new token can be passed to `BindSharedCollection`. The\n `Sync` of the new token can be accomplished with\n [`fuchsia.sysmem2/BufferCollection.Sync`] after converting the created\n `BufferCollectionToken` to a `BufferCollection`. Alternately,\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on the new token also\n works. Or using [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`]\n works. As usual, a `BufferCollectionToken.Sync` can be started after any\n `BufferCollectionToken.Duplicate` messages have been sent via the newly\n created token, to also sync those additional tokens to sysmem using a\n single round-trip.\n\n All table fields are currently required.\n\n + request `rights_attentuation_mask` This allows attenuating the VMO\n rights of the subtree. These values for `rights_attenuation_mask`\n result in no attenuation (note that 0 is not on this list):\n + ZX_RIGHT_SAME_RIGHTS (preferred)\n + 0xFFFFFFFF (this is reasonable when an attenuation mask is computed)\n + request `token_request` The server end of the `BufferCollectionToken`\n channel. The client retains the client end.\n"]
8012 fn attach_token(
8013 &mut self,
8014
8015 request: ::fidl_next::Request<buffer_collection::AttachToken, ___T>,
8016 ) -> impl ::core::future::Future<Output = ()>;
8017
8018 #[doc = " Set up an eventpair to be signalled (`ZX_EVENTPAIR_PEER_CLOSED`) when\n buffers have been allocated and only the specified number of buffers (or\n fewer) remain in the buffer collection.\n\n [`fuchsia.sysmem2/BufferCollection.AttachLifetimeTracking`] allows a\n client to wait until an old buffer collection is fully or mostly\n deallocated before attempting allocation of a new buffer collection. The\n eventpair is only signalled when the buffers of this collection have\n been fully deallocated (not just un-referenced by clients, but all the\n memory consumed by those buffers has been fully reclaimed/recycled), or\n when allocation or logical allocation fails for the tree or subtree\n including this [`fuchsia.sysmem2/BufferCollection`].\n\n The eventpair won\'t be signalled until allocation or logical allocation\n has completed; until then, the collection\'s current buffer count is\n ignored.\n\n If logical allocation fails for an attached subtree (using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]), the server end of the\n eventpair will close during that failure regardless of the number of\n buffers potenitally allocated in the overall buffer collection. This is\n for logical allocation consistency with normal allocation.\n\n The lifetime signalled by this event includes asynchronous cleanup of\n allocated buffers, and this asynchronous cleanup cannot occur until all\n holders of VMO handles to the buffers have closed those VMO handles.\n Therefore, clients should take care not to become blocked forever\n waiting for `ZX_EVENTPAIR_PEER_CLOSED` to be signalled if any of the\n participants using the logical buffer collection (including the waiter\n itself) are less trusted, less reliable, or potentially blocked by the\n wait itself. Waiting asynchronously is recommended. Setting a deadline\n for the client wait may be prudent, depending on details of how the\n collection and/or its VMOs are used or shared. Failure to allocate a\n new/replacement buffer collection is better than getting stuck forever.\n\n The sysmem server itself intentionally does not perform any waiting on\n already-failed collections\' VMOs to finish cleaning up before attempting\n a new allocation, and the sysmem server intentionally doesn\'t retry\n allocation if a new allocation fails due to out of memory, even if that\n failure is potentially due to continued existence of an old collection\'s\n VMOs. This `AttachLifetimeTracking` message is how an initiator can\n mitigate too much overlap of old VMO lifetimes with new VMO lifetimes,\n as long as the waiting client is careful to not create a deadlock.\n\n Continued existence of old collections that are still cleaning up is not\n the only reason that a new allocation may fail due to insufficient\n memory, even if the new allocation is allocating physically contiguous\n buffers. Overall system memory pressure can also be the cause of failure\n to allocate a new collection. See also\n [`fuchsia.memorypressure/Provider`].\n\n `AttachLifetimeTracking` is meant to be compatible with other protocols\n with a similar `AttachLifetimeTracking` message; duplicates of the same\n `eventpair` handle (server end) can be sent via more than one\n `AttachLifetimeTracking` message to different protocols, and the\n `ZX_EVENTPAIR_PEER_CLOSED` will be signalled for the client end when all\n the conditions are met (all holders of duplicates have closed their\n server end handle(s)). Also, thanks to how eventpair endponts work, the\n client end can (also) be duplicated without preventing the\n `ZX_EVENTPAIR_PEER_CLOSED` signal.\n\n The server intentionally doesn\'t \"trust\" any signals set on the\n `server_end`. This mechanism intentionally uses only\n `ZX_EVENTPAIR_PEER_CLOSED` set on the client end, which can\'t be set\n \"early\", and is only set when all handles to the server end eventpair\n are closed. No meaning is associated with any of the other signals, and\n clients should ignore any other signal bits on either end of the\n `eventpair`.\n\n The `server_end` may lack `ZX_RIGHT_SIGNAL` or `ZX_RIGHT_SIGNAL_PEER`,\n but must have `ZX_RIGHT_DUPLICATE` (and must have `ZX_RIGHT_TRANSFER` to\n transfer without causing `BufferCollection` channel failure).\n\n All table fields are currently required.\n\n + request `server_end` This eventpair handle will be closed by the\n sysmem server when buffers have been allocated initially and the\n number of buffers is then less than or equal to `buffers_remaining`.\n + request `buffers_remaining` Wait for all but `buffers_remaining` (or\n fewer) buffers to be fully deallocated. A number greater than zero can\n be useful in situations where a known number of buffers are\n intentionally not closed so that the data can continue to be used,\n such as for keeping the last available video frame displayed in the UI\n even if the video stream was using protected output buffers. It\'s\n outside the scope of the `BufferCollection` interface (at least for\n now) to determine how many buffers may be held without closing, but\n it\'ll typically be in the range 0-2.\n"]
8019 fn attach_lifetime_tracking(
8020 &mut self,
8021
8022 request: ::fidl_next::Request<buffer_collection::AttachLifetimeTracking, ___T>,
8023 ) -> impl ::core::future::Future<Output = ()>;
8024
8025 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
8026 ::core::future::ready(())
8027 }
8028}
8029
8030impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for BufferCollection
8031where
8032 ___H: BufferCollectionLocalServerHandler<___T>,
8033 ___T: ::fidl_next::Transport,
8034 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
8035 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8036 Constraint = (),
8037 >,
8038 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
8039 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8040 Constraint = (),
8041 >,
8042 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
8043 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8044 Constraint = (),
8045 >,
8046 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
8047 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8048 Constraint = (),
8049 >,
8050 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
8051 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8052 Constraint = (),
8053 >,
8054 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
8055 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8056 Constraint = (),
8057 >,
8058 for<'de> crate::wire::BufferCollectionSetConstraintsRequest<'de>: ::fidl_next::Decode<
8059 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8060 Constraint = (),
8061 >,
8062 for<'de> crate::wire::BufferCollectionAttachTokenRequest<'de>: ::fidl_next::Decode<
8063 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8064 Constraint = (),
8065 >,
8066 for<'de> crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'de>: ::fidl_next::Decode<
8067 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8068 Constraint = (),
8069 >,
8070{
8071 async fn on_one_way(
8072 handler: &mut ___H,
8073 mut message: ::fidl_next::Message<___T>,
8074 ) -> ::core::result::Result<
8075 (),
8076 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
8077 > {
8078 match *message.header().ordinal {
8079 7664192519607813318 => {
8080 handler.release().await;
8081 Ok(())
8082 }
8083
8084 811194812442657257 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8085 Ok(decoded) => {
8086 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
8087 Ok(())
8088 }
8089 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8090 ordinal: 811194812442657257,
8091 error,
8092 }),
8093 },
8094
8095 6691936816931379633 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8096 Ok(decoded) => {
8097 handler
8098 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
8099 .await;
8100 Ok(())
8101 }
8102 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8103 ordinal: 6691936816931379633,
8104 error,
8105 }),
8106 },
8107
8108 8172637980026734598 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8109 Ok(decoded) => {
8110 handler
8111 .set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded))
8112 .await;
8113 Ok(())
8114 }
8115 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8116 ordinal: 8172637980026734598,
8117 error,
8118 }),
8119 },
8120
8121 5911475287294795693 => {
8122 handler.set_verbose_logging().await;
8123 Ok(())
8124 }
8125
8126 2512233045884338145 => {
8127 handler.set_weak().await;
8128 Ok(())
8129 }
8130
8131 4081474869151288297 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8132 Ok(decoded) => {
8133 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
8134 Ok(())
8135 }
8136 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8137 ordinal: 4081474869151288297,
8138 error,
8139 }),
8140 },
8141
8142 4549465353676377516 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8143 Ok(decoded) => {
8144 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
8145 Ok(())
8146 }
8147 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8148 ordinal: 4549465353676377516,
8149 error,
8150 }),
8151 },
8152
8153 2296289463649704315 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8154 Ok(decoded) => {
8155 handler.set_constraints(::fidl_next::Request::from_decoded(decoded)).await;
8156 Ok(())
8157 }
8158 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8159 ordinal: 2296289463649704315,
8160 error,
8161 }),
8162 },
8163
8164 5092582717741672834 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8165 Ok(decoded) => {
8166 handler.attach_token(::fidl_next::Request::from_decoded(decoded)).await;
8167 Ok(())
8168 }
8169 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8170 ordinal: 5092582717741672834,
8171 error,
8172 }),
8173 },
8174
8175 4524799315680521679 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8176 Ok(decoded) => {
8177 handler
8178 .attach_lifetime_tracking(::fidl_next::Request::from_decoded(decoded))
8179 .await;
8180 Ok(())
8181 }
8182 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8183 ordinal: 4524799315680521679,
8184 error,
8185 }),
8186 },
8187
8188 ordinal => {
8189 handler.on_unknown_interaction(ordinal).await;
8190 if ::core::matches!(
8191 message.header().flexibility(),
8192 ::fidl_next::protocol::Flexibility::Strict
8193 ) {
8194 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
8195 } else {
8196 Ok(())
8197 }
8198 }
8199 }
8200 }
8201
8202 async fn on_two_way(
8203 handler: &mut ___H,
8204 mut message: ::fidl_next::Message<___T>,
8205 responder: ::fidl_next::protocol::Responder<___T>,
8206 ) -> ::core::result::Result<
8207 (),
8208 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
8209 > {
8210 match *message.header().ordinal {
8211 1273433845120064340 => {
8212 let responder = ::fidl_next::Responder::from_untyped(responder);
8213
8214 handler.sync(responder).await;
8215 Ok(())
8216 }
8217
8218 6574426773718429779 => {
8219 let responder = ::fidl_next::Responder::from_untyped(responder);
8220
8221 handler.get_node_ref(responder).await;
8222 Ok(())
8223 }
8224
8225 262772284282767397 => {
8226 let responder = ::fidl_next::Responder::from_untyped(responder);
8227
8228 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8229 Ok(decoded) => {
8230 handler
8231 .is_alternate_for(
8232 ::fidl_next::Request::from_decoded(decoded),
8233 responder,
8234 )
8235 .await;
8236 Ok(())
8237 }
8238 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8239 ordinal: 262772284282767397,
8240 error,
8241 }),
8242 }
8243 }
8244
8245 8633851600235444876 => {
8246 let responder = ::fidl_next::Responder::from_untyped(responder);
8247
8248 handler.get_buffer_collection_id(responder).await;
8249 Ok(())
8250 }
8251
8252 442197413015404622 => {
8253 let responder = ::fidl_next::Responder::from_untyped(responder);
8254
8255 handler.wait_for_all_buffers_allocated(responder).await;
8256 Ok(())
8257 }
8258
8259 3865775645687782416 => {
8260 let responder = ::fidl_next::Responder::from_untyped(responder);
8261
8262 handler.check_all_buffers_allocated(responder).await;
8263 Ok(())
8264 }
8265
8266 ordinal => {
8267 handler.on_unknown_interaction(ordinal).await;
8268 if ::core::matches!(
8269 message.header().flexibility(),
8270 ::fidl_next::protocol::Flexibility::Strict
8271 ) {
8272 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
8273 } else {
8274 responder
8275 .respond_framework_error(
8276 ordinal,
8277 ::fidl_next::FrameworkError::UnknownMethod,
8278 )
8279 .expect("encoding a framework error should never fail")
8280 .await?;
8281 Ok(())
8282 }
8283 }
8284 }
8285 }
8286}
8287
8288pub trait BufferCollectionClientHandler<
8292 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
8293 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
8294>
8295{
8296 fn on_unknown_interaction(
8297 &mut self,
8298 ordinal: u64,
8299 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
8300 ::core::future::ready(())
8301 }
8302}
8303
8304impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for BufferCollection
8305where
8306 ___H: BufferCollectionClientHandler<___T> + ::core::marker::Send,
8307 ___T: ::fidl_next::Transport,
8308{
8309 async fn on_event(
8310 handler: &mut ___H,
8311 mut message: ::fidl_next::Message<___T>,
8312 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
8313 match *message.header().ordinal {
8314 ordinal => {
8315 handler.on_unknown_interaction(ordinal).await;
8316 if ::core::matches!(
8317 message.header().flexibility(),
8318 ::fidl_next::protocol::Flexibility::Strict
8319 ) {
8320 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
8321 } else {
8322 Ok(())
8323 }
8324 }
8325 }
8326 }
8327}
8328
8329pub trait BufferCollectionServerHandler<
8333 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
8334 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
8335>
8336{
8337 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
8338 fn sync(
8339 &mut self,
8340
8341 responder: ::fidl_next::Responder<buffer_collection::Sync, ___T>,
8342 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8343
8344 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
8345 fn release(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8346
8347 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
8348 fn set_name(
8349 &mut self,
8350
8351 request: ::fidl_next::Request<buffer_collection::SetName, ___T>,
8352 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8353
8354 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
8355 fn set_debug_client_info(
8356 &mut self,
8357
8358 request: ::fidl_next::Request<buffer_collection::SetDebugClientInfo, ___T>,
8359 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8360
8361 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
8362 fn set_debug_timeout_log_deadline(
8363 &mut self,
8364
8365 request: ::fidl_next::Request<buffer_collection::SetDebugTimeoutLogDeadline, ___T>,
8366 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8367
8368 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
8369 fn set_verbose_logging(
8370 &mut self,
8371 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8372
8373 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
8374 fn get_node_ref(
8375 &mut self,
8376
8377 responder: ::fidl_next::Responder<buffer_collection::GetNodeRef, ___T>,
8378 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8379
8380 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
8381 fn is_alternate_for(
8382 &mut self,
8383
8384 request: ::fidl_next::Request<buffer_collection::IsAlternateFor, ___T>,
8385
8386 responder: ::fidl_next::Responder<buffer_collection::IsAlternateFor, ___T>,
8387 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8388
8389 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
8390 fn get_buffer_collection_id(
8391 &mut self,
8392
8393 responder: ::fidl_next::Responder<buffer_collection::GetBufferCollectionId, ___T>,
8394 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8395
8396 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
8397 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8398
8399 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
8400 fn set_weak_ok(
8401 &mut self,
8402
8403 request: ::fidl_next::Request<buffer_collection::SetWeakOk, ___T>,
8404 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8405
8406 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
8407 fn attach_node_tracking(
8408 &mut self,
8409
8410 request: ::fidl_next::Request<buffer_collection::AttachNodeTracking, ___T>,
8411 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8412
8413 #[doc = " Provide [`fuchsia.sysmem2/BufferCollectionConstraints`] to the buffer\n collection.\n\n A participant may only call\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] up to once per\n [`fuchsia.sysmem2/BufferCollection`].\n\n For buffer allocation to be attempted, all holders of a\n `BufferCollection` client end need to call `SetConstraints` before\n sysmem will attempt to allocate buffers.\n"]
8414 fn set_constraints(
8415 &mut self,
8416
8417 request: ::fidl_next::Request<buffer_collection::SetConstraints, ___T>,
8418 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8419
8420 #[doc = " Wait until all buffers are allocated.\n\n This FIDL call completes when buffers have been allocated, or completes\n with some failure detail if allocation has been attempted but failed.\n\n The following must occur before buffers will be allocated:\n * All [`fuchsia.sysmem2/BufferCollectionToken`](s) of the buffer\n collection must be turned in via `BindSharedCollection` to get a\n [`fuchsia.sysmem2/BufferCollection`] (for brevity, this is assuming\n [`fuchsia.sysmem2/BufferCollection.AttachToken`] isn\'t being used),\n or have had [`fuchsia.sysmem2/BufferCollectionToken.Release`] sent\n to them.\n * All [`fuchsia.sysmem2/BufferCollection`](s) of the buffer collection\n must have had [`fuchsia.sysmem2/BufferCollection.SetConstraints`]\n sent to them, or had [`fuchsia.sysmem2/BufferCollection.Release`]\n sent to them.\n\n - result `buffer_collection_info` The VMO handles and other related\n info.\n * error `[fuchsia.sysmem2/Error.NO_MEMORY]` The request is valid but\n cannot be fulfilled due to resource exhaustion.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION`] The request is\n malformed.\n * error `[fuchsia.sysmem2/Error.CONSTRAINTS_INTERSECTION_EMPTY`] The\n request is valid but cannot be satisfied, perhaps due to hardware\n limitations. This can happen if participants have incompatible\n constraints (empty intersection, roughly speaking). See the log for\n more info. In cases where a participant could potentially be treated\n as optional, see [`BufferCollectionTokenGroup`]. When using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], this will be the\n error code if there aren\'t enough buffers in the pre-existing\n collection to satisfy the constraints set on the attached token and\n any sub-tree of tokens derived from the attached token.\n"]
8421 fn wait_for_all_buffers_allocated(
8422 &mut self,
8423
8424 responder: ::fidl_next::Responder<buffer_collection::WaitForAllBuffersAllocated, ___T>,
8425 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8426
8427 #[doc = " Checks whether all the buffers have been allocated, in a polling\n fashion.\n\n * If the buffer collection has been allocated, returns success.\n * If the buffer collection failed allocation, returns the same\n [`fuchsia.sysmem2/Error`] as\n [`fuchsia.sysmem2/BufferCollection/WaitForAllBuffersAllocated`] would\n return.\n * error [`fuchsia.sysmem2/Error.PENDING`] The buffer collection hasn\'t\n attempted allocation yet. This means that WaitForAllBuffersAllocated\n would not respond quickly.\n"]
8428 fn check_all_buffers_allocated(
8429 &mut self,
8430
8431 responder: ::fidl_next::Responder<buffer_collection::CheckAllBuffersAllocated, ___T>,
8432 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8433
8434 #[doc = " Create a new token to add a new participant to an existing logical\n buffer collection, if the existing collection\'s buffer counts,\n constraints, and participants allow.\n\n This can be useful in replacing a failed participant, and/or in\n adding/re-adding a participant after buffers have already been\n allocated.\n\n When [`fuchsia.sysmem2/BufferCollection.AttachToken`] is used, the sub\n tree rooted at the attached [`fuchsia.sysmem2/BufferCollectionToken`]\n goes through the normal procedure of setting constraints or closing\n [`fuchsia.sysmem2/Node`](s), and then appearing to allocate buffers from\n clients\' point of view, despite the possibility that all the buffers\n were actually allocated previously. This process is called \"logical\n allocation\". Most instances of \"allocation\" in docs for other messages\n can also be read as \"allocation or logical allocation\" while remaining\n valid, but we just say \"allocation\" in most places for brevity/clarity\n of explanation, with the details of \"logical allocation\" left for the\n docs here on `AttachToken`.\n\n Failure of an attached `Node` does not propagate to the parent of the\n attached `Node`. More generally, failure of a child `Node` is blocked\n from reaching its parent `Node` if the child is attached, or if the\n child is dispensable and the failure occurred after logical allocation\n (see [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`]).\n\n A participant may in some scenarios choose to initially use a\n dispensable token for a given instance of a delegate participant, and\n then later if the first instance of that delegate participant fails, a\n new second instance of that delegate participant my be given a token\n created with `AttachToken`.\n\n From the point of view of the [`fuchsia.sysmem2/BufferCollectionToken`]\n client end, the token acts like any other token. The client can\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] the token as needed,\n and can send the token to a different process/participant. The\n `BufferCollectionToken` `Node` should be converted to a\n `BufferCollection` `Node` as normal by sending\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or can be closed\n without causing subtree failure by sending\n [`fuchsia.sysmem2/BufferCollectionToken.Release`]. Assuming the former,\n the [`fuchsia.sysmem2/BufferCollection.SetConstraints`] message or\n [`fuchsia.sysmem2/BufferCollection.Release`] message should be sent to\n the `BufferCollection`.\n\n Within the subtree, a success result from\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`] means\n the subtree participants\' constraints were satisfiable using the\n already-existing buffer collection, the already-established\n [`fuchsia.sysmem2/BufferCollectionInfo`] including image format\n constraints, and the already-existing other participants (already added\n via successful logical allocation) and their specified buffer counts in\n their constraints. A failure result means the new participants\'\n constraints cannot be satisfied using the existing buffer collection and\n its already-added participants. Creating a new collection instead may\n allow all participants\' constraints to be satisfied, assuming\n `SetDispensable` is used in place of `AttachToken`, or a normal token is\n used.\n\n A token created with `AttachToken` performs constraints aggregation with\n all constraints currently in effect on the buffer collection, plus the\n attached token under consideration plus child tokens under the attached\n token which are not themselves an attached token or under such a token.\n Further subtrees under this subtree are considered for logical\n allocation only after this subtree has completed logical allocation.\n\n Assignment of existing buffers to participants\'\n [`fuchsia.sysmem2/BufferCollectionConstraints.min_buffer_count_for_camping`]\n etc is first-come first-served, but a child can\'t logically allocate\n before all its parents have sent `SetConstraints`.\n\n See also [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`], which\n in contrast to `AttachToken`, has the created token `Node` + child\n `Node`(s) (in the created subtree but not in any subtree under this\n subtree) participate in constraints aggregation along with its parent\n during the parent\'s allocation or logical allocation.\n\n Similar to [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`], the\n newly created token needs to be [`fuchsia.sysmem2/Node.Sync`]ed to\n sysmem before the new token can be passed to `BindSharedCollection`. The\n `Sync` of the new token can be accomplished with\n [`fuchsia.sysmem2/BufferCollection.Sync`] after converting the created\n `BufferCollectionToken` to a `BufferCollection`. Alternately,\n [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on the new token also\n works. Or using [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`]\n works. As usual, a `BufferCollectionToken.Sync` can be started after any\n `BufferCollectionToken.Duplicate` messages have been sent via the newly\n created token, to also sync those additional tokens to sysmem using a\n single round-trip.\n\n All table fields are currently required.\n\n + request `rights_attentuation_mask` This allows attenuating the VMO\n rights of the subtree. These values for `rights_attenuation_mask`\n result in no attenuation (note that 0 is not on this list):\n + ZX_RIGHT_SAME_RIGHTS (preferred)\n + 0xFFFFFFFF (this is reasonable when an attenuation mask is computed)\n + request `token_request` The server end of the `BufferCollectionToken`\n channel. The client retains the client end.\n"]
8435 fn attach_token(
8436 &mut self,
8437
8438 request: ::fidl_next::Request<buffer_collection::AttachToken, ___T>,
8439 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8440
8441 #[doc = " Set up an eventpair to be signalled (`ZX_EVENTPAIR_PEER_CLOSED`) when\n buffers have been allocated and only the specified number of buffers (or\n fewer) remain in the buffer collection.\n\n [`fuchsia.sysmem2/BufferCollection.AttachLifetimeTracking`] allows a\n client to wait until an old buffer collection is fully or mostly\n deallocated before attempting allocation of a new buffer collection. The\n eventpair is only signalled when the buffers of this collection have\n been fully deallocated (not just un-referenced by clients, but all the\n memory consumed by those buffers has been fully reclaimed/recycled), or\n when allocation or logical allocation fails for the tree or subtree\n including this [`fuchsia.sysmem2/BufferCollection`].\n\n The eventpair won\'t be signalled until allocation or logical allocation\n has completed; until then, the collection\'s current buffer count is\n ignored.\n\n If logical allocation fails for an attached subtree (using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]), the server end of the\n eventpair will close during that failure regardless of the number of\n buffers potenitally allocated in the overall buffer collection. This is\n for logical allocation consistency with normal allocation.\n\n The lifetime signalled by this event includes asynchronous cleanup of\n allocated buffers, and this asynchronous cleanup cannot occur until all\n holders of VMO handles to the buffers have closed those VMO handles.\n Therefore, clients should take care not to become blocked forever\n waiting for `ZX_EVENTPAIR_PEER_CLOSED` to be signalled if any of the\n participants using the logical buffer collection (including the waiter\n itself) are less trusted, less reliable, or potentially blocked by the\n wait itself. Waiting asynchronously is recommended. Setting a deadline\n for the client wait may be prudent, depending on details of how the\n collection and/or its VMOs are used or shared. Failure to allocate a\n new/replacement buffer collection is better than getting stuck forever.\n\n The sysmem server itself intentionally does not perform any waiting on\n already-failed collections\' VMOs to finish cleaning up before attempting\n a new allocation, and the sysmem server intentionally doesn\'t retry\n allocation if a new allocation fails due to out of memory, even if that\n failure is potentially due to continued existence of an old collection\'s\n VMOs. This `AttachLifetimeTracking` message is how an initiator can\n mitigate too much overlap of old VMO lifetimes with new VMO lifetimes,\n as long as the waiting client is careful to not create a deadlock.\n\n Continued existence of old collections that are still cleaning up is not\n the only reason that a new allocation may fail due to insufficient\n memory, even if the new allocation is allocating physically contiguous\n buffers. Overall system memory pressure can also be the cause of failure\n to allocate a new collection. See also\n [`fuchsia.memorypressure/Provider`].\n\n `AttachLifetimeTracking` is meant to be compatible with other protocols\n with a similar `AttachLifetimeTracking` message; duplicates of the same\n `eventpair` handle (server end) can be sent via more than one\n `AttachLifetimeTracking` message to different protocols, and the\n `ZX_EVENTPAIR_PEER_CLOSED` will be signalled for the client end when all\n the conditions are met (all holders of duplicates have closed their\n server end handle(s)). Also, thanks to how eventpair endponts work, the\n client end can (also) be duplicated without preventing the\n `ZX_EVENTPAIR_PEER_CLOSED` signal.\n\n The server intentionally doesn\'t \"trust\" any signals set on the\n `server_end`. This mechanism intentionally uses only\n `ZX_EVENTPAIR_PEER_CLOSED` set on the client end, which can\'t be set\n \"early\", and is only set when all handles to the server end eventpair\n are closed. No meaning is associated with any of the other signals, and\n clients should ignore any other signal bits on either end of the\n `eventpair`.\n\n The `server_end` may lack `ZX_RIGHT_SIGNAL` or `ZX_RIGHT_SIGNAL_PEER`,\n but must have `ZX_RIGHT_DUPLICATE` (and must have `ZX_RIGHT_TRANSFER` to\n transfer without causing `BufferCollection` channel failure).\n\n All table fields are currently required.\n\n + request `server_end` This eventpair handle will be closed by the\n sysmem server when buffers have been allocated initially and the\n number of buffers is then less than or equal to `buffers_remaining`.\n + request `buffers_remaining` Wait for all but `buffers_remaining` (or\n fewer) buffers to be fully deallocated. A number greater than zero can\n be useful in situations where a known number of buffers are\n intentionally not closed so that the data can continue to be used,\n such as for keeping the last available video frame displayed in the UI\n even if the video stream was using protected output buffers. It\'s\n outside the scope of the `BufferCollection` interface (at least for\n now) to determine how many buffers may be held without closing, but\n it\'ll typically be in the range 0-2.\n"]
8442 fn attach_lifetime_tracking(
8443 &mut self,
8444
8445 request: ::fidl_next::Request<buffer_collection::AttachLifetimeTracking, ___T>,
8446 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
8447
8448 fn on_unknown_interaction(
8449 &mut self,
8450 ordinal: u64,
8451 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
8452 ::core::future::ready(())
8453 }
8454}
8455
8456impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for BufferCollection
8457where
8458 ___H: BufferCollectionServerHandler<___T> + ::core::marker::Send,
8459 ___T: ::fidl_next::Transport,
8460 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
8461 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8462 Constraint = (),
8463 >,
8464 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
8465 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8466 Constraint = (),
8467 >,
8468 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
8469 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8470 Constraint = (),
8471 >,
8472 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
8473 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8474 Constraint = (),
8475 >,
8476 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
8477 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8478 Constraint = (),
8479 >,
8480 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
8481 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8482 Constraint = (),
8483 >,
8484 for<'de> crate::wire::BufferCollectionSetConstraintsRequest<'de>: ::fidl_next::Decode<
8485 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8486 Constraint = (),
8487 >,
8488 for<'de> crate::wire::BufferCollectionAttachTokenRequest<'de>: ::fidl_next::Decode<
8489 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8490 Constraint = (),
8491 >,
8492 for<'de> crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'de>: ::fidl_next::Decode<
8493 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8494 Constraint = (),
8495 >,
8496{
8497 async fn on_one_way(
8498 handler: &mut ___H,
8499 mut message: ::fidl_next::Message<___T>,
8500 ) -> ::core::result::Result<
8501 (),
8502 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
8503 > {
8504 match *message.header().ordinal {
8505 7664192519607813318 => {
8506 handler.release().await;
8507 Ok(())
8508 }
8509
8510 811194812442657257 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8511 Ok(decoded) => {
8512 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
8513 Ok(())
8514 }
8515 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8516 ordinal: 811194812442657257,
8517 error,
8518 }),
8519 },
8520
8521 6691936816931379633 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8522 Ok(decoded) => {
8523 handler
8524 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
8525 .await;
8526 Ok(())
8527 }
8528 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8529 ordinal: 6691936816931379633,
8530 error,
8531 }),
8532 },
8533
8534 8172637980026734598 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8535 Ok(decoded) => {
8536 handler
8537 .set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded))
8538 .await;
8539 Ok(())
8540 }
8541 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8542 ordinal: 8172637980026734598,
8543 error,
8544 }),
8545 },
8546
8547 5911475287294795693 => {
8548 handler.set_verbose_logging().await;
8549 Ok(())
8550 }
8551
8552 2512233045884338145 => {
8553 handler.set_weak().await;
8554 Ok(())
8555 }
8556
8557 4081474869151288297 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8558 Ok(decoded) => {
8559 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
8560 Ok(())
8561 }
8562 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8563 ordinal: 4081474869151288297,
8564 error,
8565 }),
8566 },
8567
8568 4549465353676377516 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8569 Ok(decoded) => {
8570 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
8571 Ok(())
8572 }
8573 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8574 ordinal: 4549465353676377516,
8575 error,
8576 }),
8577 },
8578
8579 2296289463649704315 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8580 Ok(decoded) => {
8581 handler.set_constraints(::fidl_next::Request::from_decoded(decoded)).await;
8582 Ok(())
8583 }
8584 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8585 ordinal: 2296289463649704315,
8586 error,
8587 }),
8588 },
8589
8590 5092582717741672834 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8591 Ok(decoded) => {
8592 handler.attach_token(::fidl_next::Request::from_decoded(decoded)).await;
8593 Ok(())
8594 }
8595 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8596 ordinal: 5092582717741672834,
8597 error,
8598 }),
8599 },
8600
8601 4524799315680521679 => match ::fidl_next::AsDecoderExt::into_decoded(message) {
8602 Ok(decoded) => {
8603 handler
8604 .attach_lifetime_tracking(::fidl_next::Request::from_decoded(decoded))
8605 .await;
8606 Ok(())
8607 }
8608 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8609 ordinal: 4524799315680521679,
8610 error,
8611 }),
8612 },
8613
8614 ordinal => {
8615 handler.on_unknown_interaction(ordinal).await;
8616 if ::core::matches!(
8617 message.header().flexibility(),
8618 ::fidl_next::protocol::Flexibility::Strict
8619 ) {
8620 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
8621 } else {
8622 Ok(())
8623 }
8624 }
8625 }
8626 }
8627
8628 async fn on_two_way(
8629 handler: &mut ___H,
8630 mut message: ::fidl_next::Message<___T>,
8631 responder: ::fidl_next::protocol::Responder<___T>,
8632 ) -> ::core::result::Result<
8633 (),
8634 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
8635 > {
8636 match *message.header().ordinal {
8637 1273433845120064340 => {
8638 let responder = ::fidl_next::Responder::from_untyped(responder);
8639
8640 handler.sync(responder).await;
8641 Ok(())
8642 }
8643
8644 6574426773718429779 => {
8645 let responder = ::fidl_next::Responder::from_untyped(responder);
8646
8647 handler.get_node_ref(responder).await;
8648 Ok(())
8649 }
8650
8651 262772284282767397 => {
8652 let responder = ::fidl_next::Responder::from_untyped(responder);
8653
8654 match ::fidl_next::AsDecoderExt::into_decoded(message) {
8655 Ok(decoded) => {
8656 handler
8657 .is_alternate_for(
8658 ::fidl_next::Request::from_decoded(decoded),
8659 responder,
8660 )
8661 .await;
8662 Ok(())
8663 }
8664 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8665 ordinal: 262772284282767397,
8666 error,
8667 }),
8668 }
8669 }
8670
8671 8633851600235444876 => {
8672 let responder = ::fidl_next::Responder::from_untyped(responder);
8673
8674 handler.get_buffer_collection_id(responder).await;
8675 Ok(())
8676 }
8677
8678 442197413015404622 => {
8679 let responder = ::fidl_next::Responder::from_untyped(responder);
8680
8681 handler.wait_for_all_buffers_allocated(responder).await;
8682 Ok(())
8683 }
8684
8685 3865775645687782416 => {
8686 let responder = ::fidl_next::Responder::from_untyped(responder);
8687
8688 handler.check_all_buffers_allocated(responder).await;
8689 Ok(())
8690 }
8691
8692 ordinal => {
8693 handler.on_unknown_interaction(ordinal).await;
8694 if ::core::matches!(
8695 message.header().flexibility(),
8696 ::fidl_next::protocol::Flexibility::Strict
8697 ) {
8698 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
8699 } else {
8700 responder
8701 .respond_framework_error(
8702 ordinal,
8703 ::fidl_next::FrameworkError::UnknownMethod,
8704 )
8705 .expect("encoding a framework error should never fail")
8706 .await?;
8707 Ok(())
8708 }
8709 }
8710 }
8711 }
8712}
8713
8714impl<___T> BufferCollectionClientHandler<___T> for ::fidl_next::IgnoreEvents
8715where
8716 ___T: ::fidl_next::Transport,
8717{
8718 async fn on_unknown_interaction(&mut self, _: u64) {}
8719}
8720
8721impl<___H, ___T> BufferCollectionLocalClientHandler<___T> for ::fidl_next::Local<___H>
8722where
8723 ___H: BufferCollectionClientHandler<___T>,
8724 ___T: ::fidl_next::Transport,
8725{
8726 async fn on_unknown_interaction(&mut self, ordinal: u64) {
8727 ___H::on_unknown_interaction(&mut self.0, ordinal).await
8728 }
8729}
8730
8731impl<___H, ___T> BufferCollectionLocalServerHandler<___T> for ::fidl_next::Local<___H>
8732where
8733 ___H: BufferCollectionServerHandler<___T>,
8734 ___T: ::fidl_next::Transport,
8735{
8736 async fn sync(&mut self, responder: ::fidl_next::Responder<buffer_collection::Sync, ___T>) {
8737 ___H::sync(&mut self.0, responder).await
8738 }
8739
8740 async fn release(&mut self) {
8741 ___H::release(&mut self.0).await
8742 }
8743
8744 async fn set_name(&mut self, request: ::fidl_next::Request<buffer_collection::SetName, ___T>) {
8745 ___H::set_name(&mut self.0, request).await
8746 }
8747
8748 async fn set_debug_client_info(
8749 &mut self,
8750
8751 request: ::fidl_next::Request<buffer_collection::SetDebugClientInfo, ___T>,
8752 ) {
8753 ___H::set_debug_client_info(&mut self.0, request).await
8754 }
8755
8756 async fn set_debug_timeout_log_deadline(
8757 &mut self,
8758
8759 request: ::fidl_next::Request<buffer_collection::SetDebugTimeoutLogDeadline, ___T>,
8760 ) {
8761 ___H::set_debug_timeout_log_deadline(&mut self.0, request).await
8762 }
8763
8764 async fn set_verbose_logging(&mut self) {
8765 ___H::set_verbose_logging(&mut self.0).await
8766 }
8767
8768 async fn get_node_ref(
8769 &mut self,
8770
8771 responder: ::fidl_next::Responder<buffer_collection::GetNodeRef, ___T>,
8772 ) {
8773 ___H::get_node_ref(&mut self.0, responder).await
8774 }
8775
8776 async fn is_alternate_for(
8777 &mut self,
8778
8779 request: ::fidl_next::Request<buffer_collection::IsAlternateFor, ___T>,
8780
8781 responder: ::fidl_next::Responder<buffer_collection::IsAlternateFor, ___T>,
8782 ) {
8783 ___H::is_alternate_for(&mut self.0, request, responder).await
8784 }
8785
8786 async fn get_buffer_collection_id(
8787 &mut self,
8788
8789 responder: ::fidl_next::Responder<buffer_collection::GetBufferCollectionId, ___T>,
8790 ) {
8791 ___H::get_buffer_collection_id(&mut self.0, responder).await
8792 }
8793
8794 async fn set_weak(&mut self) {
8795 ___H::set_weak(&mut self.0).await
8796 }
8797
8798 async fn set_weak_ok(
8799 &mut self,
8800
8801 request: ::fidl_next::Request<buffer_collection::SetWeakOk, ___T>,
8802 ) {
8803 ___H::set_weak_ok(&mut self.0, request).await
8804 }
8805
8806 async fn attach_node_tracking(
8807 &mut self,
8808
8809 request: ::fidl_next::Request<buffer_collection::AttachNodeTracking, ___T>,
8810 ) {
8811 ___H::attach_node_tracking(&mut self.0, request).await
8812 }
8813
8814 async fn set_constraints(
8815 &mut self,
8816
8817 request: ::fidl_next::Request<buffer_collection::SetConstraints, ___T>,
8818 ) {
8819 ___H::set_constraints(&mut self.0, request).await
8820 }
8821
8822 async fn wait_for_all_buffers_allocated(
8823 &mut self,
8824
8825 responder: ::fidl_next::Responder<buffer_collection::WaitForAllBuffersAllocated, ___T>,
8826 ) {
8827 ___H::wait_for_all_buffers_allocated(&mut self.0, responder).await
8828 }
8829
8830 async fn check_all_buffers_allocated(
8831 &mut self,
8832
8833 responder: ::fidl_next::Responder<buffer_collection::CheckAllBuffersAllocated, ___T>,
8834 ) {
8835 ___H::check_all_buffers_allocated(&mut self.0, responder).await
8836 }
8837
8838 async fn attach_token(
8839 &mut self,
8840
8841 request: ::fidl_next::Request<buffer_collection::AttachToken, ___T>,
8842 ) {
8843 ___H::attach_token(&mut self.0, request).await
8844 }
8845
8846 async fn attach_lifetime_tracking(
8847 &mut self,
8848
8849 request: ::fidl_next::Request<buffer_collection::AttachLifetimeTracking, ___T>,
8850 ) {
8851 ___H::attach_lifetime_tracking(&mut self.0, request).await
8852 }
8853
8854 async fn on_unknown_interaction(&mut self, ordinal: u64) {
8855 ___H::on_unknown_interaction(&mut self.0, ordinal).await
8856 }
8857}
8858
8859#[doc = " A [`fuchsia.sysmem2/BufferCollectionToken`] is not a buffer collection, but\n rather is a way to identify a specific potential shared buffer collection,\n and a way to distribute that potential shared buffer collection to\n additional participants prior to the buffer collection allocating any\n buffers.\n\n Epitaphs are not used in this protocol.\n\n We use a channel for the `BufferCollectionToken` instead of a single\n `eventpair` (pair) because this way we can detect error conditions like a\n participant failing mid-create.\n"]
8861#[derive(PartialEq, Debug)]
8862pub struct BufferCollectionToken;
8863
8864#[cfg(target_os = "fuchsia")]
8865impl ::fidl_next::HasTransport for BufferCollectionToken {
8866 type Transport = ::fidl_next::fuchsia::zx::Channel;
8867}
8868
8869pub mod buffer_collection_token {
8870 pub mod prelude {
8871 pub use crate::{
8872 BufferCollectionToken, BufferCollectionTokenClientHandler,
8873 BufferCollectionTokenLocalClientHandler, BufferCollectionTokenLocalServerHandler,
8874 BufferCollectionTokenServerHandler, buffer_collection_token,
8875 };
8876
8877 pub use crate::natural::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest;
8878
8879 pub use crate::natural::BufferCollectionTokenDuplicateRequest;
8880
8881 pub use crate::natural::BufferCollectionTokenDuplicateSyncRequest;
8882
8883 pub use crate::natural::BufferCollectionTokenDuplicateSyncResponse;
8884
8885 pub use crate::natural::Error;
8886
8887 pub use crate::natural::NodeAttachNodeTrackingRequest;
8888
8889 pub use crate::natural::NodeIsAlternateForRequest;
8890
8891 pub use crate::natural::NodeSetDebugClientInfoRequest;
8892
8893 pub use crate::natural::NodeSetDebugTimeoutLogDeadlineRequest;
8894
8895 pub use crate::natural::NodeSetNameRequest;
8896
8897 pub use crate::natural::NodeSetWeakOkRequest;
8898
8899 pub use crate::natural::NodeGetBufferCollectionIdResponse;
8900
8901 pub use crate::natural::NodeGetNodeRefResponse;
8902
8903 pub use crate::natural::NodeIsAlternateForResponse;
8904
8905 pub use crate::natural::NodeSyncResponse;
8906 }
8907
8908 pub struct Sync;
8909
8910 impl ::fidl_next::Method for Sync {
8911 const ORDINAL: u64 = 1273433845120064340;
8912 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8913 ::fidl_next::protocol::Flexibility::Flexible;
8914
8915 type Protocol = crate::BufferCollectionToken;
8916
8917 type Request = ::fidl_next::wire::EmptyMessageBody;
8918 }
8919
8920 impl ::fidl_next::TwoWayMethod for Sync {
8921 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::NodeSyncResponse>;
8922 }
8923
8924 impl<___R> ::fidl_next::Respond<___R> for Sync {
8925 type Output = ::fidl_next::Flexible<___R>;
8926
8927 fn respond(response: ___R) -> Self::Output {
8928 ::fidl_next::Flexible(response)
8929 }
8930 }
8931
8932 pub struct Release;
8933
8934 impl ::fidl_next::Method for Release {
8935 const ORDINAL: u64 = 7664192519607813318;
8936 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8937 ::fidl_next::protocol::Flexibility::Flexible;
8938
8939 type Protocol = crate::BufferCollectionToken;
8940
8941 type Request = ::fidl_next::wire::EmptyMessageBody;
8942 }
8943
8944 pub struct SetName;
8945
8946 impl ::fidl_next::Method for SetName {
8947 const ORDINAL: u64 = 811194812442657257;
8948 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8949 ::fidl_next::protocol::Flexibility::Flexible;
8950
8951 type Protocol = crate::BufferCollectionToken;
8952
8953 type Request = crate::wire::NodeSetNameRequest<'static>;
8954 }
8955
8956 pub struct SetDebugClientInfo;
8957
8958 impl ::fidl_next::Method for SetDebugClientInfo {
8959 const ORDINAL: u64 = 6691936816931379633;
8960 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8961 ::fidl_next::protocol::Flexibility::Flexible;
8962
8963 type Protocol = crate::BufferCollectionToken;
8964
8965 type Request = crate::wire::NodeSetDebugClientInfoRequest<'static>;
8966 }
8967
8968 pub struct SetDebugTimeoutLogDeadline;
8969
8970 impl ::fidl_next::Method for SetDebugTimeoutLogDeadline {
8971 const ORDINAL: u64 = 8172637980026734598;
8972 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8973 ::fidl_next::protocol::Flexibility::Flexible;
8974
8975 type Protocol = crate::BufferCollectionToken;
8976
8977 type Request = crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>;
8978 }
8979
8980 pub struct SetVerboseLogging;
8981
8982 impl ::fidl_next::Method for SetVerboseLogging {
8983 const ORDINAL: u64 = 5911475287294795693;
8984 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8985 ::fidl_next::protocol::Flexibility::Flexible;
8986
8987 type Protocol = crate::BufferCollectionToken;
8988
8989 type Request = ::fidl_next::wire::EmptyMessageBody;
8990 }
8991
8992 pub struct GetNodeRef;
8993
8994 impl ::fidl_next::Method for GetNodeRef {
8995 const ORDINAL: u64 = 6574426773718429779;
8996 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8997 ::fidl_next::protocol::Flexibility::Flexible;
8998
8999 type Protocol = crate::BufferCollectionToken;
9000
9001 type Request = ::fidl_next::wire::EmptyMessageBody;
9002 }
9003
9004 impl ::fidl_next::TwoWayMethod for GetNodeRef {
9005 type Response =
9006 ::fidl_next::wire::Flexible<'static, crate::wire::NodeGetNodeRefResponse<'static>>;
9007 }
9008
9009 impl<___R> ::fidl_next::Respond<___R> for GetNodeRef {
9010 type Output = ::fidl_next::Flexible<___R>;
9011
9012 fn respond(response: ___R) -> Self::Output {
9013 ::fidl_next::Flexible(response)
9014 }
9015 }
9016
9017 pub struct IsAlternateFor;
9018
9019 impl ::fidl_next::Method for IsAlternateFor {
9020 const ORDINAL: u64 = 262772284282767397;
9021 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9022 ::fidl_next::protocol::Flexibility::Flexible;
9023
9024 type Protocol = crate::BufferCollectionToken;
9025
9026 type Request = crate::wire::NodeIsAlternateForRequest<'static>;
9027 }
9028
9029 impl ::fidl_next::TwoWayMethod for IsAlternateFor {
9030 type Response = ::fidl_next::wire::Result<
9031 'static,
9032 crate::wire::NodeIsAlternateForResponse<'static>,
9033 crate::wire::Error,
9034 >;
9035 }
9036
9037 impl<___R> ::fidl_next::Respond<___R> for IsAlternateFor {
9038 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
9039
9040 fn respond(response: ___R) -> Self::Output {
9041 ::core::result::Result::Ok(response)
9042 }
9043 }
9044
9045 impl<___R> ::fidl_next::RespondErr<___R> for IsAlternateFor {
9046 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
9047
9048 fn respond_err(response: ___R) -> Self::Output {
9049 ::core::result::Result::Err(response)
9050 }
9051 }
9052
9053 pub struct GetBufferCollectionId;
9054
9055 impl ::fidl_next::Method for GetBufferCollectionId {
9056 const ORDINAL: u64 = 8633851600235444876;
9057 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9058 ::fidl_next::protocol::Flexibility::Flexible;
9059
9060 type Protocol = crate::BufferCollectionToken;
9061
9062 type Request = ::fidl_next::wire::EmptyMessageBody;
9063 }
9064
9065 impl ::fidl_next::TwoWayMethod for GetBufferCollectionId {
9066 type Response = ::fidl_next::wire::Flexible<
9067 'static,
9068 crate::wire::NodeGetBufferCollectionIdResponse<'static>,
9069 >;
9070 }
9071
9072 impl<___R> ::fidl_next::Respond<___R> for GetBufferCollectionId {
9073 type Output = ::fidl_next::Flexible<___R>;
9074
9075 fn respond(response: ___R) -> Self::Output {
9076 ::fidl_next::Flexible(response)
9077 }
9078 }
9079
9080 pub struct SetWeak;
9081
9082 impl ::fidl_next::Method for SetWeak {
9083 const ORDINAL: u64 = 2512233045884338145;
9084 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9085 ::fidl_next::protocol::Flexibility::Flexible;
9086
9087 type Protocol = crate::BufferCollectionToken;
9088
9089 type Request = ::fidl_next::wire::EmptyMessageBody;
9090 }
9091
9092 pub struct SetWeakOk;
9093
9094 impl ::fidl_next::Method for SetWeakOk {
9095 const ORDINAL: u64 = 4081474869151288297;
9096 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9097 ::fidl_next::protocol::Flexibility::Flexible;
9098
9099 type Protocol = crate::BufferCollectionToken;
9100
9101 type Request = crate::wire::NodeSetWeakOkRequest<'static>;
9102 }
9103
9104 pub struct AttachNodeTracking;
9105
9106 impl ::fidl_next::Method for AttachNodeTracking {
9107 const ORDINAL: u64 = 4549465353676377516;
9108 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9109 ::fidl_next::protocol::Flexibility::Flexible;
9110
9111 type Protocol = crate::BufferCollectionToken;
9112
9113 type Request = crate::wire::NodeAttachNodeTrackingRequest<'static>;
9114 }
9115
9116 pub struct DuplicateSync;
9117
9118 impl ::fidl_next::Method for DuplicateSync {
9119 const ORDINAL: u64 = 2025205386257933404;
9120 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9121 ::fidl_next::protocol::Flexibility::Flexible;
9122
9123 type Protocol = crate::BufferCollectionToken;
9124
9125 type Request = crate::wire::BufferCollectionTokenDuplicateSyncRequest<'static>;
9126 }
9127
9128 impl ::fidl_next::TwoWayMethod for DuplicateSync {
9129 type Response = ::fidl_next::wire::Flexible<
9130 'static,
9131 crate::wire::BufferCollectionTokenDuplicateSyncResponse<'static>,
9132 >;
9133 }
9134
9135 impl<___R> ::fidl_next::Respond<___R> for DuplicateSync {
9136 type Output = ::fidl_next::Flexible<___R>;
9137
9138 fn respond(response: ___R) -> Self::Output {
9139 ::fidl_next::Flexible(response)
9140 }
9141 }
9142
9143 pub struct Duplicate;
9144
9145 impl ::fidl_next::Method for Duplicate {
9146 const ORDINAL: u64 = 8351801895211219079;
9147 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9148 ::fidl_next::protocol::Flexibility::Flexible;
9149
9150 type Protocol = crate::BufferCollectionToken;
9151
9152 type Request = crate::wire::BufferCollectionTokenDuplicateRequest<'static>;
9153 }
9154
9155 pub struct SetDispensable;
9156
9157 impl ::fidl_next::Method for SetDispensable {
9158 const ORDINAL: u64 = 2489029993977667467;
9159 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9160 ::fidl_next::protocol::Flexibility::Flexible;
9161
9162 type Protocol = crate::BufferCollectionToken;
9163
9164 type Request = ::fidl_next::wire::EmptyMessageBody;
9165 }
9166
9167 pub struct CreateBufferCollectionTokenGroup;
9168
9169 impl ::fidl_next::Method for CreateBufferCollectionTokenGroup {
9170 const ORDINAL: u64 = 3528804016404117234;
9171 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
9172 ::fidl_next::protocol::Flexibility::Flexible;
9173
9174 type Protocol = crate::BufferCollectionToken;
9175
9176 type Request =
9177 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'static>;
9178 }
9179
9180 mod ___detail {
9181 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::BufferCollectionToken
9182 where
9183 ___T: ::fidl_next::Transport,
9184 {
9185 type Client = BufferCollectionTokenClient<___T>;
9186 type Server = BufferCollectionTokenServer<___T>;
9187 }
9188
9189 #[repr(transparent)]
9191 pub struct BufferCollectionTokenClient<___T: ::fidl_next::Transport> {
9192 #[allow(dead_code)]
9193 client: ::fidl_next::protocol::Client<___T>,
9194 }
9195
9196 impl<___T> BufferCollectionTokenClient<___T>
9197 where
9198 ___T: ::fidl_next::Transport,
9199 {
9200 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
9201 pub fn sync(&self) -> ::fidl_next::TwoWayFuture<'_, super::Sync, ___T> {
9202 ::fidl_next::TwoWayFuture::from_untyped(
9203 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
9204 1273433845120064340,
9205 <super::Sync as ::fidl_next::Method>::FLEXIBILITY,
9206 (),
9207 ),
9208 )
9209 }
9210
9211 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
9212 pub fn release(&self) -> ::fidl_next::SendFuture<'_, ___T> {
9213 ::fidl_next::SendFuture::from_untyped(
9214 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
9215 7664192519607813318,
9216 <super::Release as ::fidl_next::Method>::FLEXIBILITY,
9217 (),
9218 ),
9219 )
9220 }
9221
9222 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
9223 pub fn set_name_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
9224 where
9225 ___R: ::fidl_next::Encode<
9226 crate::wire::NodeSetNameRequest<'static>,
9227 <___T as ::fidl_next::Transport>::SendBuffer,
9228 >,
9229 {
9230 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
9231 811194812442657257,
9232 <super::SetName as ::fidl_next::Method>::FLEXIBILITY,
9233 request,
9234 ))
9235 }
9236
9237 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
9238 pub fn set_debug_client_info_with<___R>(
9239 &self,
9240 request: ___R,
9241 ) -> ::fidl_next::SendFuture<'_, ___T>
9242 where
9243 ___R: ::fidl_next::Encode<
9244 crate::wire::NodeSetDebugClientInfoRequest<'static>,
9245 <___T as ::fidl_next::Transport>::SendBuffer,
9246 >,
9247 {
9248 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
9249 6691936816931379633,
9250 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
9251 request,
9252 ))
9253 }
9254
9255 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
9256 pub fn set_debug_timeout_log_deadline_with<___R>(
9257 &self,
9258 request: ___R,
9259 ) -> ::fidl_next::SendFuture<'_, ___T>
9260 where
9261 ___R: ::fidl_next::Encode<
9262 crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>,
9263 <___T as ::fidl_next::Transport>::SendBuffer,
9264 >,
9265 {
9266 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
9267 8172637980026734598,
9268 <super::SetDebugTimeoutLogDeadline as ::fidl_next::Method>::FLEXIBILITY,
9269 request,
9270 ))
9271 }
9272
9273 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
9274 pub fn set_verbose_logging(&self) -> ::fidl_next::SendFuture<'_, ___T> {
9275 ::fidl_next::SendFuture::from_untyped(
9276 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
9277 5911475287294795693,
9278 <super::SetVerboseLogging as ::fidl_next::Method>::FLEXIBILITY,
9279 (),
9280 ),
9281 )
9282 }
9283
9284 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
9285 pub fn get_node_ref(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetNodeRef, ___T> {
9286 ::fidl_next::TwoWayFuture::from_untyped(
9287 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
9288 6574426773718429779,
9289 <super::GetNodeRef as ::fidl_next::Method>::FLEXIBILITY,
9290 (),
9291 ),
9292 )
9293 }
9294
9295 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
9296 pub fn is_alternate_for_with<___R>(
9297 &self,
9298 request: ___R,
9299 ) -> ::fidl_next::TwoWayFuture<'_, super::IsAlternateFor, ___T>
9300 where
9301 ___R: ::fidl_next::Encode<
9302 crate::wire::NodeIsAlternateForRequest<'static>,
9303 <___T as ::fidl_next::Transport>::SendBuffer,
9304 >,
9305 {
9306 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
9307 262772284282767397,
9308 <super::IsAlternateFor as ::fidl_next::Method>::FLEXIBILITY,
9309 request,
9310 ))
9311 }
9312
9313 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
9314 pub fn get_buffer_collection_id(
9315 &self,
9316 ) -> ::fidl_next::TwoWayFuture<'_, super::GetBufferCollectionId, ___T> {
9317 ::fidl_next::TwoWayFuture::from_untyped(
9318 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
9319 8633851600235444876,
9320 <super::GetBufferCollectionId as ::fidl_next::Method>::FLEXIBILITY,
9321 (),
9322 ),
9323 )
9324 }
9325
9326 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
9327 pub fn set_weak(&self) -> ::fidl_next::SendFuture<'_, ___T> {
9328 ::fidl_next::SendFuture::from_untyped(
9329 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
9330 2512233045884338145,
9331 <super::SetWeak as ::fidl_next::Method>::FLEXIBILITY,
9332 (),
9333 ),
9334 )
9335 }
9336
9337 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
9338 pub fn set_weak_ok_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
9339 where
9340 ___R: ::fidl_next::Encode<
9341 crate::wire::NodeSetWeakOkRequest<'static>,
9342 <___T as ::fidl_next::Transport>::SendBuffer,
9343 >,
9344 {
9345 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
9346 4081474869151288297,
9347 <super::SetWeakOk as ::fidl_next::Method>::FLEXIBILITY,
9348 request,
9349 ))
9350 }
9351
9352 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
9353 pub fn attach_node_tracking_with<___R>(
9354 &self,
9355 request: ___R,
9356 ) -> ::fidl_next::SendFuture<'_, ___T>
9357 where
9358 ___R: ::fidl_next::Encode<
9359 crate::wire::NodeAttachNodeTrackingRequest<'static>,
9360 <___T as ::fidl_next::Transport>::SendBuffer,
9361 >,
9362 {
9363 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
9364 4549465353676377516,
9365 <super::AttachNodeTracking as ::fidl_next::Method>::FLEXIBILITY,
9366 request,
9367 ))
9368 }
9369
9370 #[doc = " Create additional [`fuchsia.sysmem2/BufferCollectionToken`](s) from this\n one, referring to the same buffer collection.\n\n The created tokens are children of this token in the\n [`fuchsia.sysmem2/Node`] heirarchy.\n\n This method can be used to add more participants, by transferring the\n newly created tokens to additional participants.\n\n A new token will be returned for each entry in the\n `rights_attenuation_masks` array.\n\n If the called token may not actually be a valid token due to a\n potentially hostile/untrusted provider of the token, consider using\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] never responds\n due to the calling token not being a real token.\n\n In contrast to [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`], no\n separate [`fuchsia.sysmem2/Node.Sync`] is needed after calling this\n method, because the sync step is included in this call, at the cost of a\n round trip during this call.\n\n All tokens must be turned in to sysmem via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] or\n [`fuchsia.sysmem2/Node.Release`] for a `BufferCollection` to\n successfully allocate buffers (or to logically allocate buffers in the\n case of subtrees involving\n [`fuchsia.sysmem2/BufferCollectionToken.AttachToken`]).\n\n All table fields are currently required.\n\n + request `rights_attenuation_mask` In each entry of\n `rights_attenuation_masks`, rights bits that are zero will be absent\n in the buffer VMO rights obtainable via the corresponding returned\n token. This allows an initiator or intermediary participant to\n attenuate the rights available to a participant. This does not allow a\n participant to gain rights that the participant doesn\'t already have.\n The value `ZX_RIGHT_SAME_RIGHTS` can be used to specify that no\n attenuation should be applied.\n - response `tokens` The client ends of each newly created token.\n"]
9371 pub fn duplicate_sync_with<___R>(
9372 &self,
9373 request: ___R,
9374 ) -> ::fidl_next::TwoWayFuture<'_, super::DuplicateSync, ___T>
9375 where
9376 ___R: ::fidl_next::Encode<
9377 crate::wire::BufferCollectionTokenDuplicateSyncRequest<'static>,
9378 <___T as ::fidl_next::Transport>::SendBuffer,
9379 >,
9380 {
9381 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
9382 2025205386257933404,
9383 <super::DuplicateSync as ::fidl_next::Method>::FLEXIBILITY,
9384 request,
9385 ))
9386 }
9387
9388 #[doc = " Create an additional [`fuchsia.sysmem2/BufferCollectionToken`] from this\n one, referring to the same buffer collection.\n\n The created token is a child of this token in the\n [`fuchsia.sysmem2/Node`] heirarchy.\n\n This method can be used to add a participant, by transferring the newly\n created token to another participant.\n\n This one-way message can be used instead of the two-way\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] FIDL call in\n performance sensitive cases where it would be undesireable to wait for\n sysmem to respond to\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] or when the\n client code isn\'t structured to make it easy to duplicate all the needed\n tokens at once.\n\n After sending one or more `Duplicate` messages, and before sending the\n newly created child tokens to other participants (or to other\n [`fuchsia.sysmem2/Allocator`] channels), the client must send a\n [`fuchsia.sysmem2/Node.Sync`] and wait for the `Sync` response. The\n `Sync` call can be made on the token, or on the `BufferCollection`\n obtained by passing this token to `BindSharedCollection`. Either will\n ensure that the server knows about the tokens created via `Duplicate`\n before the other participant sends the token to the server via separate\n `Allocator` channel.\n\n All tokens must be turned in via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] or\n [`fuchsia.sysmem2/Node.Release`] for a `BufferCollection` to\n successfully allocate buffers.\n\n All table fields are currently required.\n\n + request `rights_attenuation_mask` The rights bits that are zero in\n this mask will be absent in the buffer VMO rights obtainable via the\n client end of `token_request`. This allows an initiator or\n intermediary participant to attenuate the rights available to a\n delegate participant. This does not allow a participant to gain rights\n that the participant doesn\'t already have. The value\n `ZX_RIGHT_SAME_RIGHTS` can be used to specify that no attenuation\n should be applied.\n + These values for rights_attenuation_mask result in no attenuation:\n + `ZX_RIGHT_SAME_RIGHTS` (preferred)\n + 0xFFFFFFFF (this is reasonable when an attenuation mask is\n computed)\n + 0 (deprecated - do not use 0 - an ERROR will go to the log)\n + request `token_request` is the server end of a `BufferCollectionToken`\n channel. The client end of this channel acts as another participant in\n the shared buffer collection.\n"]
9389 pub fn duplicate_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
9390 where
9391 ___R: ::fidl_next::Encode<
9392 crate::wire::BufferCollectionTokenDuplicateRequest<'static>,
9393 <___T as ::fidl_next::Transport>::SendBuffer,
9394 >,
9395 {
9396 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
9397 8351801895211219079,
9398 <super::Duplicate as ::fidl_next::Method>::FLEXIBILITY,
9399 request,
9400 ))
9401 }
9402
9403 #[doc = " Set this [`fuchsia.sysmem2/BufferCollectionToken`] to dispensable.\n\n When the `BufferCollectionToken` is converted to a\n [`fuchsia.sysmem2/BufferCollection`], the dispensable status applies to\n the `BufferCollection` also.\n\n Normally, if a client closes a [`fuchsia.sysmem2/BufferCollection`]\n client end without having sent\n [`fuchsia.sysmem2/BufferCollection.Release`] first, the\n `BufferCollection` [`fuchisa.sysmem2/Node`] will fail, which also\n propagates failure to the parent [`fuchsia.sysmem2/Node`] and so on up\n to the root `Node`, which fails the whole buffer collection. In\n contrast, a dispensable `Node` can fail after buffers are allocated\n without causing failure of its parent in the [`fuchsia.sysmem2/Node`]\n heirarchy.\n\n The dispensable `Node` participates in constraints aggregation along\n with its parent before buffer allocation. If the dispensable `Node`\n fails before buffers are allocated, the failure propagates to the\n dispensable `Node`\'s parent.\n\n After buffers are allocated, failure of the dispensable `Node` (or any\n child of the dispensable `Node`) does not propagate to the dispensable\n `Node`\'s parent. Failure does propagate from a normal child of a\n dispensable `Node` to the dispensable `Node`. Failure of a child is\n blocked from reaching its parent if the child is attached using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], or if the child is\n dispensable and the failure occurred after allocation.\n\n A dispensable `Node` can be used in cases where a participant needs to\n provide constraints, but after buffers are allocated, the participant\n can fail without causing buffer collection failure from the parent\n `Node`\'s point of view.\n\n In contrast, `BufferCollection.AttachToken` can be used to create a\n `BufferCollectionToken` which does not participate in constraints\n aggregation with its parent `Node`, and whose failure at any time does\n not propagate to its parent `Node`, and whose potential delay providing\n constraints does not prevent the parent `Node` from completing its\n buffer allocation.\n\n An initiator (creator of the root `Node` using\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`]) may in some\n scenarios choose to initially use a dispensable `Node` for a first\n instance of a participant, and then later if the first instance of that\n participant fails, a new second instance of that participant my be given\n a `BufferCollectionToken` created with `AttachToken`.\n\n Normally a client will `SetDispensable` on a `BufferCollectionToken`\n shortly before sending the dispensable `BufferCollectionToken` to a\n delegate participant. Because `SetDispensable` prevents propagation of\n child `Node` failure to parent `Node`(s), if the client was relying on\n noticing child failure via failure of the parent `Node` retained by the\n client, the client may instead need to notice failure via other means.\n If other means aren\'t available/convenient, the client can instead\n retain the dispensable `Node` and create a child `Node` under that to\n send to the delegate participant, retaining this `Node` in order to\n notice failure of the subtree rooted at this `Node` via this `Node`\'s\n ZX_CHANNEL_PEER_CLOSED signal, and take whatever action is appropriate\n (e.g. starting a new instance of the delegate participant and handing it\n a `BufferCollectionToken` created using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], or propagate failure\n and clean up in a client-specific way).\n\n While it is possible (and potentially useful) to `SetDispensable` on a\n direct child of a `BufferCollectionTokenGroup` `Node`, it isn\'t possible\n to later replace a failed dispensable `Node` that was a direct child of\n a `BufferCollectionTokenGroup` with a new token using `AttachToken`\n (since there\'s no `AttachToken` on a group). Instead, to enable\n `AttachToken` replacement in this case, create an additional\n non-dispensable token that\'s a direct child of the group and make the\n existing dispensable token a child of the additional token. This way,\n the additional token that is a direct child of the group has\n `BufferCollection.AttachToken` which can be used to replace the failed\n dispensable token.\n\n `SetDispensable` on an already-dispensable token is idempotent.\n"]
9404 pub fn set_dispensable(&self) -> ::fidl_next::SendFuture<'_, ___T> {
9405 ::fidl_next::SendFuture::from_untyped(
9406 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
9407 2489029993977667467,
9408 <super::SetDispensable as ::fidl_next::Method>::FLEXIBILITY,
9409 (),
9410 ),
9411 )
9412 }
9413
9414 #[doc = " Create a logical OR among a set of tokens, called a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n\n Most sysmem clients and many participants don\'t need to care about this\n message or about `BufferCollectionTokenGroup`(s). However, in some cases\n a participant wants to attempt to include one set of delegate\n participants, but if constraints don\'t combine successfully that way,\n fall back to a different (possibly overlapping) set of delegate\n participants, and/or fall back to a less demanding strategy (in terms of\n how strict the [`fuchisa.sysmem2/BufferCollectionConstraints`] are,\n across all involved delegate participants). In such cases, a\n `BufferCollectionTokenGroup` is useful.\n\n A `BufferCollectionTokenGroup` is used to create a 1 of N OR among N\n child [`fuchsia.sysmem2/BufferCollectionToken`](s). The child tokens\n which are not selected during aggregation will fail (close), which a\n potential participant should notice when their `BufferCollection`\n channel client endpoint sees PEER_CLOSED, allowing the participant to\n clean up the speculative usage that didn\'t end up happening (this is\n simimlar to a normal `BufferCollection` server end closing on failure to\n allocate a logical buffer collection or later async failure of a buffer\n collection).\n\n See comments on protocol `BufferCollectionTokenGroup`.\n\n Any `rights_attenuation_mask` or `AttachToken`/`SetDispensable` to be\n applied to the whole group can be achieved with a\n `BufferCollectionToken` for this purpose as a direct parent of the\n `BufferCollectionTokenGroup`.\n\n All table fields are currently required.\n\n + request `group_request` The server end of a\n `BufferCollectionTokenGroup` channel to be served by sysmem.\n"]
9415 pub fn create_buffer_collection_token_group_with<___R>(
9416 &self,
9417 request: ___R,
9418 ) -> ::fidl_next::SendFuture<'_, ___T>
9419 where
9420 ___R: ::fidl_next::Encode<
9421 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<
9422 'static,
9423 >,
9424 <___T as ::fidl_next::Transport>::SendBuffer,
9425 >,
9426 {
9427 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
9428 3528804016404117234,
9429 <super::CreateBufferCollectionTokenGroup as ::fidl_next::Method>::FLEXIBILITY,
9430 request,
9431 ))
9432 }
9433 }
9434
9435 #[repr(transparent)]
9437 pub struct BufferCollectionTokenServer<___T: ::fidl_next::Transport> {
9438 server: ::fidl_next::protocol::Server<___T>,
9439 }
9440
9441 impl<___T> BufferCollectionTokenServer<___T> where ___T: ::fidl_next::Transport {}
9442 }
9443}
9444
9445#[diagnostic::on_unimplemented(
9446 note = "If {Self} implements the non-local BufferCollectionTokenClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
9447)]
9448
9449pub trait BufferCollectionTokenLocalClientHandler<
9453 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
9454 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
9455>
9456{
9457 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
9458 ::core::future::ready(())
9459 }
9460}
9461
9462impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for BufferCollectionToken
9463where
9464 ___H: BufferCollectionTokenLocalClientHandler<___T>,
9465 ___T: ::fidl_next::Transport,
9466{
9467 async fn on_event(
9468 handler: &mut ___H,
9469 mut message: ::fidl_next::Message<___T>,
9470 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
9471 match *message.header().ordinal {
9472 ordinal => {
9473 handler.on_unknown_interaction(ordinal).await;
9474 if ::core::matches!(
9475 message.header().flexibility(),
9476 ::fidl_next::protocol::Flexibility::Strict
9477 ) {
9478 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
9479 } else {
9480 Ok(())
9481 }
9482 }
9483 }
9484 }
9485}
9486
9487#[diagnostic::on_unimplemented(
9488 note = "If {Self} implements the non-local BufferCollectionTokenServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
9489)]
9490
9491pub trait BufferCollectionTokenLocalServerHandler<
9495 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
9496 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
9497>
9498{
9499 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
9500 fn sync(
9501 &mut self,
9502
9503 responder: ::fidl_next::Responder<buffer_collection_token::Sync, ___T>,
9504 ) -> impl ::core::future::Future<Output = ()>;
9505
9506 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
9507 fn release(&mut self) -> impl ::core::future::Future<Output = ()>;
9508
9509 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
9510 fn set_name(
9511 &mut self,
9512
9513 request: ::fidl_next::Request<buffer_collection_token::SetName, ___T>,
9514 ) -> impl ::core::future::Future<Output = ()>;
9515
9516 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
9517 fn set_debug_client_info(
9518 &mut self,
9519
9520 request: ::fidl_next::Request<buffer_collection_token::SetDebugClientInfo, ___T>,
9521 ) -> impl ::core::future::Future<Output = ()>;
9522
9523 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
9524 fn set_debug_timeout_log_deadline(
9525 &mut self,
9526
9527 request: ::fidl_next::Request<buffer_collection_token::SetDebugTimeoutLogDeadline, ___T>,
9528 ) -> impl ::core::future::Future<Output = ()>;
9529
9530 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
9531 fn set_verbose_logging(&mut self) -> impl ::core::future::Future<Output = ()>;
9532
9533 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
9534 fn get_node_ref(
9535 &mut self,
9536
9537 responder: ::fidl_next::Responder<buffer_collection_token::GetNodeRef, ___T>,
9538 ) -> impl ::core::future::Future<Output = ()>;
9539
9540 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
9541 fn is_alternate_for(
9542 &mut self,
9543
9544 request: ::fidl_next::Request<buffer_collection_token::IsAlternateFor, ___T>,
9545
9546 responder: ::fidl_next::Responder<buffer_collection_token::IsAlternateFor, ___T>,
9547 ) -> impl ::core::future::Future<Output = ()>;
9548
9549 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
9550 fn get_buffer_collection_id(
9551 &mut self,
9552
9553 responder: ::fidl_next::Responder<buffer_collection_token::GetBufferCollectionId, ___T>,
9554 ) -> impl ::core::future::Future<Output = ()>;
9555
9556 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
9557 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()>;
9558
9559 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
9560 fn set_weak_ok(
9561 &mut self,
9562
9563 request: ::fidl_next::Request<buffer_collection_token::SetWeakOk, ___T>,
9564 ) -> impl ::core::future::Future<Output = ()>;
9565
9566 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
9567 fn attach_node_tracking(
9568 &mut self,
9569
9570 request: ::fidl_next::Request<buffer_collection_token::AttachNodeTracking, ___T>,
9571 ) -> impl ::core::future::Future<Output = ()>;
9572
9573 #[doc = " Create additional [`fuchsia.sysmem2/BufferCollectionToken`](s) from this\n one, referring to the same buffer collection.\n\n The created tokens are children of this token in the\n [`fuchsia.sysmem2/Node`] heirarchy.\n\n This method can be used to add more participants, by transferring the\n newly created tokens to additional participants.\n\n A new token will be returned for each entry in the\n `rights_attenuation_masks` array.\n\n If the called token may not actually be a valid token due to a\n potentially hostile/untrusted provider of the token, consider using\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] never responds\n due to the calling token not being a real token.\n\n In contrast to [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`], no\n separate [`fuchsia.sysmem2/Node.Sync`] is needed after calling this\n method, because the sync step is included in this call, at the cost of a\n round trip during this call.\n\n All tokens must be turned in to sysmem via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] or\n [`fuchsia.sysmem2/Node.Release`] for a `BufferCollection` to\n successfully allocate buffers (or to logically allocate buffers in the\n case of subtrees involving\n [`fuchsia.sysmem2/BufferCollectionToken.AttachToken`]).\n\n All table fields are currently required.\n\n + request `rights_attenuation_mask` In each entry of\n `rights_attenuation_masks`, rights bits that are zero will be absent\n in the buffer VMO rights obtainable via the corresponding returned\n token. This allows an initiator or intermediary participant to\n attenuate the rights available to a participant. This does not allow a\n participant to gain rights that the participant doesn\'t already have.\n The value `ZX_RIGHT_SAME_RIGHTS` can be used to specify that no\n attenuation should be applied.\n - response `tokens` The client ends of each newly created token.\n"]
9574 fn duplicate_sync(
9575 &mut self,
9576
9577 request: ::fidl_next::Request<buffer_collection_token::DuplicateSync, ___T>,
9578
9579 responder: ::fidl_next::Responder<buffer_collection_token::DuplicateSync, ___T>,
9580 ) -> impl ::core::future::Future<Output = ()>;
9581
9582 #[doc = " Create an additional [`fuchsia.sysmem2/BufferCollectionToken`] from this\n one, referring to the same buffer collection.\n\n The created token is a child of this token in the\n [`fuchsia.sysmem2/Node`] heirarchy.\n\n This method can be used to add a participant, by transferring the newly\n created token to another participant.\n\n This one-way message can be used instead of the two-way\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] FIDL call in\n performance sensitive cases where it would be undesireable to wait for\n sysmem to respond to\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] or when the\n client code isn\'t structured to make it easy to duplicate all the needed\n tokens at once.\n\n After sending one or more `Duplicate` messages, and before sending the\n newly created child tokens to other participants (or to other\n [`fuchsia.sysmem2/Allocator`] channels), the client must send a\n [`fuchsia.sysmem2/Node.Sync`] and wait for the `Sync` response. The\n `Sync` call can be made on the token, or on the `BufferCollection`\n obtained by passing this token to `BindSharedCollection`. Either will\n ensure that the server knows about the tokens created via `Duplicate`\n before the other participant sends the token to the server via separate\n `Allocator` channel.\n\n All tokens must be turned in via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] or\n [`fuchsia.sysmem2/Node.Release`] for a `BufferCollection` to\n successfully allocate buffers.\n\n All table fields are currently required.\n\n + request `rights_attenuation_mask` The rights bits that are zero in\n this mask will be absent in the buffer VMO rights obtainable via the\n client end of `token_request`. This allows an initiator or\n intermediary participant to attenuate the rights available to a\n delegate participant. This does not allow a participant to gain rights\n that the participant doesn\'t already have. The value\n `ZX_RIGHT_SAME_RIGHTS` can be used to specify that no attenuation\n should be applied.\n + These values for rights_attenuation_mask result in no attenuation:\n + `ZX_RIGHT_SAME_RIGHTS` (preferred)\n + 0xFFFFFFFF (this is reasonable when an attenuation mask is\n computed)\n + 0 (deprecated - do not use 0 - an ERROR will go to the log)\n + request `token_request` is the server end of a `BufferCollectionToken`\n channel. The client end of this channel acts as another participant in\n the shared buffer collection.\n"]
9583 fn duplicate(
9584 &mut self,
9585
9586 request: ::fidl_next::Request<buffer_collection_token::Duplicate, ___T>,
9587 ) -> impl ::core::future::Future<Output = ()>;
9588
9589 #[doc = " Set this [`fuchsia.sysmem2/BufferCollectionToken`] to dispensable.\n\n When the `BufferCollectionToken` is converted to a\n [`fuchsia.sysmem2/BufferCollection`], the dispensable status applies to\n the `BufferCollection` also.\n\n Normally, if a client closes a [`fuchsia.sysmem2/BufferCollection`]\n client end without having sent\n [`fuchsia.sysmem2/BufferCollection.Release`] first, the\n `BufferCollection` [`fuchisa.sysmem2/Node`] will fail, which also\n propagates failure to the parent [`fuchsia.sysmem2/Node`] and so on up\n to the root `Node`, which fails the whole buffer collection. In\n contrast, a dispensable `Node` can fail after buffers are allocated\n without causing failure of its parent in the [`fuchsia.sysmem2/Node`]\n heirarchy.\n\n The dispensable `Node` participates in constraints aggregation along\n with its parent before buffer allocation. If the dispensable `Node`\n fails before buffers are allocated, the failure propagates to the\n dispensable `Node`\'s parent.\n\n After buffers are allocated, failure of the dispensable `Node` (or any\n child of the dispensable `Node`) does not propagate to the dispensable\n `Node`\'s parent. Failure does propagate from a normal child of a\n dispensable `Node` to the dispensable `Node`. Failure of a child is\n blocked from reaching its parent if the child is attached using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], or if the child is\n dispensable and the failure occurred after allocation.\n\n A dispensable `Node` can be used in cases where a participant needs to\n provide constraints, but after buffers are allocated, the participant\n can fail without causing buffer collection failure from the parent\n `Node`\'s point of view.\n\n In contrast, `BufferCollection.AttachToken` can be used to create a\n `BufferCollectionToken` which does not participate in constraints\n aggregation with its parent `Node`, and whose failure at any time does\n not propagate to its parent `Node`, and whose potential delay providing\n constraints does not prevent the parent `Node` from completing its\n buffer allocation.\n\n An initiator (creator of the root `Node` using\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`]) may in some\n scenarios choose to initially use a dispensable `Node` for a first\n instance of a participant, and then later if the first instance of that\n participant fails, a new second instance of that participant my be given\n a `BufferCollectionToken` created with `AttachToken`.\n\n Normally a client will `SetDispensable` on a `BufferCollectionToken`\n shortly before sending the dispensable `BufferCollectionToken` to a\n delegate participant. Because `SetDispensable` prevents propagation of\n child `Node` failure to parent `Node`(s), if the client was relying on\n noticing child failure via failure of the parent `Node` retained by the\n client, the client may instead need to notice failure via other means.\n If other means aren\'t available/convenient, the client can instead\n retain the dispensable `Node` and create a child `Node` under that to\n send to the delegate participant, retaining this `Node` in order to\n notice failure of the subtree rooted at this `Node` via this `Node`\'s\n ZX_CHANNEL_PEER_CLOSED signal, and take whatever action is appropriate\n (e.g. starting a new instance of the delegate participant and handing it\n a `BufferCollectionToken` created using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], or propagate failure\n and clean up in a client-specific way).\n\n While it is possible (and potentially useful) to `SetDispensable` on a\n direct child of a `BufferCollectionTokenGroup` `Node`, it isn\'t possible\n to later replace a failed dispensable `Node` that was a direct child of\n a `BufferCollectionTokenGroup` with a new token using `AttachToken`\n (since there\'s no `AttachToken` on a group). Instead, to enable\n `AttachToken` replacement in this case, create an additional\n non-dispensable token that\'s a direct child of the group and make the\n existing dispensable token a child of the additional token. This way,\n the additional token that is a direct child of the group has\n `BufferCollection.AttachToken` which can be used to replace the failed\n dispensable token.\n\n `SetDispensable` on an already-dispensable token is idempotent.\n"]
9590 fn set_dispensable(&mut self) -> impl ::core::future::Future<Output = ()>;
9591
9592 #[doc = " Create a logical OR among a set of tokens, called a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n\n Most sysmem clients and many participants don\'t need to care about this\n message or about `BufferCollectionTokenGroup`(s). However, in some cases\n a participant wants to attempt to include one set of delegate\n participants, but if constraints don\'t combine successfully that way,\n fall back to a different (possibly overlapping) set of delegate\n participants, and/or fall back to a less demanding strategy (in terms of\n how strict the [`fuchisa.sysmem2/BufferCollectionConstraints`] are,\n across all involved delegate participants). In such cases, a\n `BufferCollectionTokenGroup` is useful.\n\n A `BufferCollectionTokenGroup` is used to create a 1 of N OR among N\n child [`fuchsia.sysmem2/BufferCollectionToken`](s). The child tokens\n which are not selected during aggregation will fail (close), which a\n potential participant should notice when their `BufferCollection`\n channel client endpoint sees PEER_CLOSED, allowing the participant to\n clean up the speculative usage that didn\'t end up happening (this is\n simimlar to a normal `BufferCollection` server end closing on failure to\n allocate a logical buffer collection or later async failure of a buffer\n collection).\n\n See comments on protocol `BufferCollectionTokenGroup`.\n\n Any `rights_attenuation_mask` or `AttachToken`/`SetDispensable` to be\n applied to the whole group can be achieved with a\n `BufferCollectionToken` for this purpose as a direct parent of the\n `BufferCollectionTokenGroup`.\n\n All table fields are currently required.\n\n + request `group_request` The server end of a\n `BufferCollectionTokenGroup` channel to be served by sysmem.\n"]
9593 fn create_buffer_collection_token_group(
9594 &mut self,
9595
9596 request: ::fidl_next::Request<
9597 buffer_collection_token::CreateBufferCollectionTokenGroup,
9598 ___T,
9599 >,
9600 ) -> impl ::core::future::Future<Output = ()>;
9601
9602 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
9603 ::core::future::ready(())
9604 }
9605}
9606
9607impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for BufferCollectionToken
9608where
9609 ___H: BufferCollectionTokenLocalServerHandler<___T> ,
9610 ___T: ::fidl_next::Transport,
9611
9612
9613
9614
9615
9616
9617 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
9618 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9619 Constraint = (),
9620 >,
9621
9622
9623
9624 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
9625 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9626 Constraint = (),
9627 >,
9628
9629
9630
9631 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
9632 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9633 Constraint = (),
9634 >,
9635
9636
9637
9638
9639
9640
9641
9642 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
9643 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9644 Constraint = (),
9645 >,
9646
9647
9648
9649
9650
9651
9652
9653 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
9654 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9655 Constraint = (),
9656 >,
9657
9658
9659
9660 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
9661 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9662 Constraint = (),
9663 >,
9664
9665
9666
9667 for<'de> crate::wire::BufferCollectionTokenDuplicateSyncRequest<'de>: ::fidl_next::Decode<
9668 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9669 Constraint = (),
9670 >,
9671
9672
9673
9674 for<'de> crate::wire::BufferCollectionTokenDuplicateRequest<'de>: ::fidl_next::Decode<
9675 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9676 Constraint = (),
9677 >,
9678
9679
9680
9681
9682
9683 for<'de> crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>: ::fidl_next::Decode<
9684 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9685 Constraint = (),
9686 >,
9687
9688
9689{
9690 async fn on_one_way(
9691 handler: &mut ___H,
9692 mut message: ::fidl_next::Message<___T>,
9693 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
9694 match *message.header().ordinal {
9695
9696
9697
9698
9699
9700
9701 7664192519607813318 => {
9702
9703 handler.release().await;
9704 Ok(())
9705
9706 }
9707
9708
9709
9710
9711 811194812442657257 => {
9712
9713 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9714 Ok(decoded) => {
9715 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
9716 Ok(())
9717 }
9718 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9719 ordinal: 811194812442657257,
9720 error,
9721 }),
9722 }
9723
9724 }
9725
9726
9727
9728
9729 6691936816931379633 => {
9730
9731 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9732 Ok(decoded) => {
9733 handler.set_debug_client_info(::fidl_next::Request::from_decoded(decoded)).await;
9734 Ok(())
9735 }
9736 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9737 ordinal: 6691936816931379633,
9738 error,
9739 }),
9740 }
9741
9742 }
9743
9744
9745
9746
9747 8172637980026734598 => {
9748
9749 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9750 Ok(decoded) => {
9751 handler.set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded)).await;
9752 Ok(())
9753 }
9754 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9755 ordinal: 8172637980026734598,
9756 error,
9757 }),
9758 }
9759
9760 }
9761
9762
9763
9764
9765 5911475287294795693 => {
9766
9767 handler.set_verbose_logging().await;
9768 Ok(())
9769
9770 }
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784 2512233045884338145 => {
9785
9786 handler.set_weak().await;
9787 Ok(())
9788
9789 }
9790
9791
9792
9793
9794 4081474869151288297 => {
9795
9796 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9797 Ok(decoded) => {
9798 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
9799 Ok(())
9800 }
9801 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9802 ordinal: 4081474869151288297,
9803 error,
9804 }),
9805 }
9806
9807 }
9808
9809
9810
9811
9812 4549465353676377516 => {
9813
9814 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9815 Ok(decoded) => {
9816 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
9817 Ok(())
9818 }
9819 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9820 ordinal: 4549465353676377516,
9821 error,
9822 }),
9823 }
9824
9825 }
9826
9827
9828
9829
9830
9831
9832
9833 8351801895211219079 => {
9834
9835 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9836 Ok(decoded) => {
9837 handler.duplicate(::fidl_next::Request::from_decoded(decoded)).await;
9838 Ok(())
9839 }
9840 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9841 ordinal: 8351801895211219079,
9842 error,
9843 }),
9844 }
9845
9846 }
9847
9848
9849
9850
9851 2489029993977667467 => {
9852
9853 handler.set_dispensable().await;
9854 Ok(())
9855
9856 }
9857
9858
9859
9860
9861 3528804016404117234 => {
9862
9863 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9864 Ok(decoded) => {
9865 handler.create_buffer_collection_token_group(::fidl_next::Request::from_decoded(decoded)).await;
9866 Ok(())
9867 }
9868 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9869 ordinal: 3528804016404117234,
9870 error,
9871 }),
9872 }
9873
9874 }
9875
9876
9877 ordinal => {
9878
9879 handler.on_unknown_interaction(ordinal).await;
9880 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
9881 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
9882 } else {
9883 Ok(())
9884 }
9885
9886 }
9887 }
9888 }
9889
9890 async fn on_two_way(
9891 handler: &mut ___H,
9892 mut message: ::fidl_next::Message<___T>,
9893 responder: ::fidl_next::protocol::Responder<___T>,
9894 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
9895 match *message.header().ordinal {
9896
9897
9898
9899 1273433845120064340 => {
9900 let responder = ::fidl_next::Responder::from_untyped(responder);
9901
9902 handler.sync(responder).await;
9903 Ok(())
9904
9905 }
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925 6574426773718429779 => {
9926 let responder = ::fidl_next::Responder::from_untyped(responder);
9927
9928 handler.get_node_ref(responder).await;
9929 Ok(())
9930
9931 }
9932
9933
9934
9935
9936 262772284282767397 => {
9937 let responder = ::fidl_next::Responder::from_untyped(responder);
9938
9939 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9940 Ok(decoded) => {
9941 handler.is_alternate_for(::fidl_next::Request::from_decoded(decoded), responder).await;
9942 Ok(())
9943 }
9944 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9945 ordinal: 262772284282767397,
9946 error,
9947 }),
9948 }
9949
9950 }
9951
9952
9953
9954
9955 8633851600235444876 => {
9956 let responder = ::fidl_next::Responder::from_untyped(responder);
9957
9958 handler.get_buffer_collection_id(responder).await;
9959 Ok(())
9960
9961 }
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975 2025205386257933404 => {
9976 let responder = ::fidl_next::Responder::from_untyped(responder);
9977
9978 match ::fidl_next::AsDecoderExt::into_decoded(message) {
9979 Ok(decoded) => {
9980 handler.duplicate_sync(::fidl_next::Request::from_decoded(decoded), responder).await;
9981 Ok(())
9982 }
9983 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9984 ordinal: 2025205386257933404,
9985 error,
9986 }),
9987 }
9988
9989 }
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001 ordinal => {
10002
10003 handler.on_unknown_interaction(ordinal).await;
10004 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
10005 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
10006 } else {
10007 responder.respond_framework_error(
10008 ordinal,
10009 ::fidl_next::FrameworkError::UnknownMethod,
10010 )
10011 .expect("encoding a framework error should never fail")
10012 .await?;
10013 Ok(())
10014 }
10015
10016 }
10017 }
10018 }
10019}
10020
10021pub trait BufferCollectionTokenClientHandler<
10025 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
10026 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
10027>
10028{
10029 fn on_unknown_interaction(
10030 &mut self,
10031 ordinal: u64,
10032 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
10033 ::core::future::ready(())
10034 }
10035}
10036
10037impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for BufferCollectionToken
10038where
10039 ___H: BufferCollectionTokenClientHandler<___T> + ::core::marker::Send,
10040 ___T: ::fidl_next::Transport,
10041{
10042 async fn on_event(
10043 handler: &mut ___H,
10044 mut message: ::fidl_next::Message<___T>,
10045 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
10046 match *message.header().ordinal {
10047 ordinal => {
10048 handler.on_unknown_interaction(ordinal).await;
10049 if ::core::matches!(
10050 message.header().flexibility(),
10051 ::fidl_next::protocol::Flexibility::Strict
10052 ) {
10053 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
10054 } else {
10055 Ok(())
10056 }
10057 }
10058 }
10059 }
10060}
10061
10062pub trait BufferCollectionTokenServerHandler<
10066 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
10067 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
10068>
10069{
10070 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
10071 fn sync(
10072 &mut self,
10073
10074 responder: ::fidl_next::Responder<buffer_collection_token::Sync, ___T>,
10075 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10076
10077 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
10078 fn release(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10079
10080 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
10081 fn set_name(
10082 &mut self,
10083
10084 request: ::fidl_next::Request<buffer_collection_token::SetName, ___T>,
10085 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10086
10087 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
10088 fn set_debug_client_info(
10089 &mut self,
10090
10091 request: ::fidl_next::Request<buffer_collection_token::SetDebugClientInfo, ___T>,
10092 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10093
10094 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
10095 fn set_debug_timeout_log_deadline(
10096 &mut self,
10097
10098 request: ::fidl_next::Request<buffer_collection_token::SetDebugTimeoutLogDeadline, ___T>,
10099 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10100
10101 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
10102 fn set_verbose_logging(
10103 &mut self,
10104 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10105
10106 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
10107 fn get_node_ref(
10108 &mut self,
10109
10110 responder: ::fidl_next::Responder<buffer_collection_token::GetNodeRef, ___T>,
10111 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10112
10113 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
10114 fn is_alternate_for(
10115 &mut self,
10116
10117 request: ::fidl_next::Request<buffer_collection_token::IsAlternateFor, ___T>,
10118
10119 responder: ::fidl_next::Responder<buffer_collection_token::IsAlternateFor, ___T>,
10120 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10121
10122 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
10123 fn get_buffer_collection_id(
10124 &mut self,
10125
10126 responder: ::fidl_next::Responder<buffer_collection_token::GetBufferCollectionId, ___T>,
10127 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10128
10129 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
10130 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10131
10132 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
10133 fn set_weak_ok(
10134 &mut self,
10135
10136 request: ::fidl_next::Request<buffer_collection_token::SetWeakOk, ___T>,
10137 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10138
10139 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
10140 fn attach_node_tracking(
10141 &mut self,
10142
10143 request: ::fidl_next::Request<buffer_collection_token::AttachNodeTracking, ___T>,
10144 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10145
10146 #[doc = " Create additional [`fuchsia.sysmem2/BufferCollectionToken`](s) from this\n one, referring to the same buffer collection.\n\n The created tokens are children of this token in the\n [`fuchsia.sysmem2/Node`] heirarchy.\n\n This method can be used to add more participants, by transferring the\n newly created tokens to additional participants.\n\n A new token will be returned for each entry in the\n `rights_attenuation_masks` array.\n\n If the called token may not actually be a valid token due to a\n potentially hostile/untrusted provider of the token, consider using\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] never responds\n due to the calling token not being a real token.\n\n In contrast to [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`], no\n separate [`fuchsia.sysmem2/Node.Sync`] is needed after calling this\n method, because the sync step is included in this call, at the cost of a\n round trip during this call.\n\n All tokens must be turned in to sysmem via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] or\n [`fuchsia.sysmem2/Node.Release`] for a `BufferCollection` to\n successfully allocate buffers (or to logically allocate buffers in the\n case of subtrees involving\n [`fuchsia.sysmem2/BufferCollectionToken.AttachToken`]).\n\n All table fields are currently required.\n\n + request `rights_attenuation_mask` In each entry of\n `rights_attenuation_masks`, rights bits that are zero will be absent\n in the buffer VMO rights obtainable via the corresponding returned\n token. This allows an initiator or intermediary participant to\n attenuate the rights available to a participant. This does not allow a\n participant to gain rights that the participant doesn\'t already have.\n The value `ZX_RIGHT_SAME_RIGHTS` can be used to specify that no\n attenuation should be applied.\n - response `tokens` The client ends of each newly created token.\n"]
10147 fn duplicate_sync(
10148 &mut self,
10149
10150 request: ::fidl_next::Request<buffer_collection_token::DuplicateSync, ___T>,
10151
10152 responder: ::fidl_next::Responder<buffer_collection_token::DuplicateSync, ___T>,
10153 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10154
10155 #[doc = " Create an additional [`fuchsia.sysmem2/BufferCollectionToken`] from this\n one, referring to the same buffer collection.\n\n The created token is a child of this token in the\n [`fuchsia.sysmem2/Node`] heirarchy.\n\n This method can be used to add a participant, by transferring the newly\n created token to another participant.\n\n This one-way message can be used instead of the two-way\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] FIDL call in\n performance sensitive cases where it would be undesireable to wait for\n sysmem to respond to\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] or when the\n client code isn\'t structured to make it easy to duplicate all the needed\n tokens at once.\n\n After sending one or more `Duplicate` messages, and before sending the\n newly created child tokens to other participants (or to other\n [`fuchsia.sysmem2/Allocator`] channels), the client must send a\n [`fuchsia.sysmem2/Node.Sync`] and wait for the `Sync` response. The\n `Sync` call can be made on the token, or on the `BufferCollection`\n obtained by passing this token to `BindSharedCollection`. Either will\n ensure that the server knows about the tokens created via `Duplicate`\n before the other participant sends the token to the server via separate\n `Allocator` channel.\n\n All tokens must be turned in via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] or\n [`fuchsia.sysmem2/Node.Release`] for a `BufferCollection` to\n successfully allocate buffers.\n\n All table fields are currently required.\n\n + request `rights_attenuation_mask` The rights bits that are zero in\n this mask will be absent in the buffer VMO rights obtainable via the\n client end of `token_request`. This allows an initiator or\n intermediary participant to attenuate the rights available to a\n delegate participant. This does not allow a participant to gain rights\n that the participant doesn\'t already have. The value\n `ZX_RIGHT_SAME_RIGHTS` can be used to specify that no attenuation\n should be applied.\n + These values for rights_attenuation_mask result in no attenuation:\n + `ZX_RIGHT_SAME_RIGHTS` (preferred)\n + 0xFFFFFFFF (this is reasonable when an attenuation mask is\n computed)\n + 0 (deprecated - do not use 0 - an ERROR will go to the log)\n + request `token_request` is the server end of a `BufferCollectionToken`\n channel. The client end of this channel acts as another participant in\n the shared buffer collection.\n"]
10156 fn duplicate(
10157 &mut self,
10158
10159 request: ::fidl_next::Request<buffer_collection_token::Duplicate, ___T>,
10160 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10161
10162 #[doc = " Set this [`fuchsia.sysmem2/BufferCollectionToken`] to dispensable.\n\n When the `BufferCollectionToken` is converted to a\n [`fuchsia.sysmem2/BufferCollection`], the dispensable status applies to\n the `BufferCollection` also.\n\n Normally, if a client closes a [`fuchsia.sysmem2/BufferCollection`]\n client end without having sent\n [`fuchsia.sysmem2/BufferCollection.Release`] first, the\n `BufferCollection` [`fuchisa.sysmem2/Node`] will fail, which also\n propagates failure to the parent [`fuchsia.sysmem2/Node`] and so on up\n to the root `Node`, which fails the whole buffer collection. In\n contrast, a dispensable `Node` can fail after buffers are allocated\n without causing failure of its parent in the [`fuchsia.sysmem2/Node`]\n heirarchy.\n\n The dispensable `Node` participates in constraints aggregation along\n with its parent before buffer allocation. If the dispensable `Node`\n fails before buffers are allocated, the failure propagates to the\n dispensable `Node`\'s parent.\n\n After buffers are allocated, failure of the dispensable `Node` (or any\n child of the dispensable `Node`) does not propagate to the dispensable\n `Node`\'s parent. Failure does propagate from a normal child of a\n dispensable `Node` to the dispensable `Node`. Failure of a child is\n blocked from reaching its parent if the child is attached using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], or if the child is\n dispensable and the failure occurred after allocation.\n\n A dispensable `Node` can be used in cases where a participant needs to\n provide constraints, but after buffers are allocated, the participant\n can fail without causing buffer collection failure from the parent\n `Node`\'s point of view.\n\n In contrast, `BufferCollection.AttachToken` can be used to create a\n `BufferCollectionToken` which does not participate in constraints\n aggregation with its parent `Node`, and whose failure at any time does\n not propagate to its parent `Node`, and whose potential delay providing\n constraints does not prevent the parent `Node` from completing its\n buffer allocation.\n\n An initiator (creator of the root `Node` using\n [`fuchsia.sysmem2/Allocator.AllocateSharedCollection`]) may in some\n scenarios choose to initially use a dispensable `Node` for a first\n instance of a participant, and then later if the first instance of that\n participant fails, a new second instance of that participant my be given\n a `BufferCollectionToken` created with `AttachToken`.\n\n Normally a client will `SetDispensable` on a `BufferCollectionToken`\n shortly before sending the dispensable `BufferCollectionToken` to a\n delegate participant. Because `SetDispensable` prevents propagation of\n child `Node` failure to parent `Node`(s), if the client was relying on\n noticing child failure via failure of the parent `Node` retained by the\n client, the client may instead need to notice failure via other means.\n If other means aren\'t available/convenient, the client can instead\n retain the dispensable `Node` and create a child `Node` under that to\n send to the delegate participant, retaining this `Node` in order to\n notice failure of the subtree rooted at this `Node` via this `Node`\'s\n ZX_CHANNEL_PEER_CLOSED signal, and take whatever action is appropriate\n (e.g. starting a new instance of the delegate participant and handing it\n a `BufferCollectionToken` created using\n [`fuchsia.sysmem2/BufferCollection.AttachToken`], or propagate failure\n and clean up in a client-specific way).\n\n While it is possible (and potentially useful) to `SetDispensable` on a\n direct child of a `BufferCollectionTokenGroup` `Node`, it isn\'t possible\n to later replace a failed dispensable `Node` that was a direct child of\n a `BufferCollectionTokenGroup` with a new token using `AttachToken`\n (since there\'s no `AttachToken` on a group). Instead, to enable\n `AttachToken` replacement in this case, create an additional\n non-dispensable token that\'s a direct child of the group and make the\n existing dispensable token a child of the additional token. This way,\n the additional token that is a direct child of the group has\n `BufferCollection.AttachToken` which can be used to replace the failed\n dispensable token.\n\n `SetDispensable` on an already-dispensable token is idempotent.\n"]
10163 fn set_dispensable(
10164 &mut self,
10165 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10166
10167 #[doc = " Create a logical OR among a set of tokens, called a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n\n Most sysmem clients and many participants don\'t need to care about this\n message or about `BufferCollectionTokenGroup`(s). However, in some cases\n a participant wants to attempt to include one set of delegate\n participants, but if constraints don\'t combine successfully that way,\n fall back to a different (possibly overlapping) set of delegate\n participants, and/or fall back to a less demanding strategy (in terms of\n how strict the [`fuchisa.sysmem2/BufferCollectionConstraints`] are,\n across all involved delegate participants). In such cases, a\n `BufferCollectionTokenGroup` is useful.\n\n A `BufferCollectionTokenGroup` is used to create a 1 of N OR among N\n child [`fuchsia.sysmem2/BufferCollectionToken`](s). The child tokens\n which are not selected during aggregation will fail (close), which a\n potential participant should notice when their `BufferCollection`\n channel client endpoint sees PEER_CLOSED, allowing the participant to\n clean up the speculative usage that didn\'t end up happening (this is\n simimlar to a normal `BufferCollection` server end closing on failure to\n allocate a logical buffer collection or later async failure of a buffer\n collection).\n\n See comments on protocol `BufferCollectionTokenGroup`.\n\n Any `rights_attenuation_mask` or `AttachToken`/`SetDispensable` to be\n applied to the whole group can be achieved with a\n `BufferCollectionToken` for this purpose as a direct parent of the\n `BufferCollectionTokenGroup`.\n\n All table fields are currently required.\n\n + request `group_request` The server end of a\n `BufferCollectionTokenGroup` channel to be served by sysmem.\n"]
10168 fn create_buffer_collection_token_group(
10169 &mut self,
10170
10171 request: ::fidl_next::Request<
10172 buffer_collection_token::CreateBufferCollectionTokenGroup,
10173 ___T,
10174 >,
10175 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
10176
10177 fn on_unknown_interaction(
10178 &mut self,
10179 ordinal: u64,
10180 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
10181 ::core::future::ready(())
10182 }
10183}
10184
10185impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for BufferCollectionToken
10186where
10187 ___H: BufferCollectionTokenServerHandler<___T> + ::core::marker::Send,
10188 ___T: ::fidl_next::Transport,
10189
10190
10191
10192
10193
10194
10195 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
10196 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10197 Constraint = (),
10198 >,
10199
10200
10201
10202 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
10203 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10204 Constraint = (),
10205 >,
10206
10207
10208
10209 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
10210 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10211 Constraint = (),
10212 >,
10213
10214
10215
10216
10217
10218
10219
10220 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
10221 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10222 Constraint = (),
10223 >,
10224
10225
10226
10227
10228
10229
10230
10231 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
10232 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10233 Constraint = (),
10234 >,
10235
10236
10237
10238 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
10239 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10240 Constraint = (),
10241 >,
10242
10243
10244
10245 for<'de> crate::wire::BufferCollectionTokenDuplicateSyncRequest<'de>: ::fidl_next::Decode<
10246 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10247 Constraint = (),
10248 >,
10249
10250
10251
10252 for<'de> crate::wire::BufferCollectionTokenDuplicateRequest<'de>: ::fidl_next::Decode<
10253 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10254 Constraint = (),
10255 >,
10256
10257
10258
10259
10260
10261 for<'de> crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>: ::fidl_next::Decode<
10262 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10263 Constraint = (),
10264 >,
10265
10266
10267{
10268 async fn on_one_way(
10269 handler: &mut ___H,
10270 mut message: ::fidl_next::Message<___T>,
10271 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
10272 match *message.header().ordinal {
10273
10274
10275
10276
10277
10278
10279 7664192519607813318 => {
10280
10281 handler.release().await;
10282 Ok(())
10283
10284 }
10285
10286
10287
10288
10289 811194812442657257 => {
10290
10291 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10292 Ok(decoded) => {
10293 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
10294 Ok(())
10295 }
10296 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10297 ordinal: 811194812442657257,
10298 error,
10299 }),
10300 }
10301
10302 }
10303
10304
10305
10306
10307 6691936816931379633 => {
10308
10309 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10310 Ok(decoded) => {
10311 handler.set_debug_client_info(::fidl_next::Request::from_decoded(decoded)).await;
10312 Ok(())
10313 }
10314 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10315 ordinal: 6691936816931379633,
10316 error,
10317 }),
10318 }
10319
10320 }
10321
10322
10323
10324
10325 8172637980026734598 => {
10326
10327 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10328 Ok(decoded) => {
10329 handler.set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded)).await;
10330 Ok(())
10331 }
10332 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10333 ordinal: 8172637980026734598,
10334 error,
10335 }),
10336 }
10337
10338 }
10339
10340
10341
10342
10343 5911475287294795693 => {
10344
10345 handler.set_verbose_logging().await;
10346 Ok(())
10347
10348 }
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362 2512233045884338145 => {
10363
10364 handler.set_weak().await;
10365 Ok(())
10366
10367 }
10368
10369
10370
10371
10372 4081474869151288297 => {
10373
10374 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10375 Ok(decoded) => {
10376 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
10377 Ok(())
10378 }
10379 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10380 ordinal: 4081474869151288297,
10381 error,
10382 }),
10383 }
10384
10385 }
10386
10387
10388
10389
10390 4549465353676377516 => {
10391
10392 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10393 Ok(decoded) => {
10394 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
10395 Ok(())
10396 }
10397 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10398 ordinal: 4549465353676377516,
10399 error,
10400 }),
10401 }
10402
10403 }
10404
10405
10406
10407
10408
10409
10410
10411 8351801895211219079 => {
10412
10413 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10414 Ok(decoded) => {
10415 handler.duplicate(::fidl_next::Request::from_decoded(decoded)).await;
10416 Ok(())
10417 }
10418 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10419 ordinal: 8351801895211219079,
10420 error,
10421 }),
10422 }
10423
10424 }
10425
10426
10427
10428
10429 2489029993977667467 => {
10430
10431 handler.set_dispensable().await;
10432 Ok(())
10433
10434 }
10435
10436
10437
10438
10439 3528804016404117234 => {
10440
10441 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10442 Ok(decoded) => {
10443 handler.create_buffer_collection_token_group(::fidl_next::Request::from_decoded(decoded)).await;
10444 Ok(())
10445 }
10446 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10447 ordinal: 3528804016404117234,
10448 error,
10449 }),
10450 }
10451
10452 }
10453
10454
10455 ordinal => {
10456
10457 handler.on_unknown_interaction(ordinal).await;
10458 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
10459 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
10460 } else {
10461 Ok(())
10462 }
10463
10464 }
10465 }
10466 }
10467
10468 async fn on_two_way(
10469 handler: &mut ___H,
10470 mut message: ::fidl_next::Message<___T>,
10471 responder: ::fidl_next::protocol::Responder<___T>,
10472 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
10473 match *message.header().ordinal {
10474
10475
10476
10477 1273433845120064340 => {
10478 let responder = ::fidl_next::Responder::from_untyped(responder);
10479
10480 handler.sync(responder).await;
10481 Ok(())
10482
10483 }
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503 6574426773718429779 => {
10504 let responder = ::fidl_next::Responder::from_untyped(responder);
10505
10506 handler.get_node_ref(responder).await;
10507 Ok(())
10508
10509 }
10510
10511
10512
10513
10514 262772284282767397 => {
10515 let responder = ::fidl_next::Responder::from_untyped(responder);
10516
10517 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10518 Ok(decoded) => {
10519 handler.is_alternate_for(::fidl_next::Request::from_decoded(decoded), responder).await;
10520 Ok(())
10521 }
10522 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10523 ordinal: 262772284282767397,
10524 error,
10525 }),
10526 }
10527
10528 }
10529
10530
10531
10532
10533 8633851600235444876 => {
10534 let responder = ::fidl_next::Responder::from_untyped(responder);
10535
10536 handler.get_buffer_collection_id(responder).await;
10537 Ok(())
10538
10539 }
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553 2025205386257933404 => {
10554 let responder = ::fidl_next::Responder::from_untyped(responder);
10555
10556 match ::fidl_next::AsDecoderExt::into_decoded(message) {
10557 Ok(decoded) => {
10558 handler.duplicate_sync(::fidl_next::Request::from_decoded(decoded), responder).await;
10559 Ok(())
10560 }
10561 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10562 ordinal: 2025205386257933404,
10563 error,
10564 }),
10565 }
10566
10567 }
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579 ordinal => {
10580
10581 handler.on_unknown_interaction(ordinal).await;
10582 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
10583 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
10584 } else {
10585 responder.respond_framework_error(
10586 ordinal,
10587 ::fidl_next::FrameworkError::UnknownMethod,
10588 )
10589 .expect("encoding a framework error should never fail")
10590 .await?;
10591 Ok(())
10592 }
10593
10594 }
10595 }
10596 }
10597}
10598
10599impl<___T> BufferCollectionTokenClientHandler<___T> for ::fidl_next::IgnoreEvents
10600where
10601 ___T: ::fidl_next::Transport,
10602{
10603 async fn on_unknown_interaction(&mut self, _: u64) {}
10604}
10605
10606impl<___H, ___T> BufferCollectionTokenLocalClientHandler<___T> for ::fidl_next::Local<___H>
10607where
10608 ___H: BufferCollectionTokenClientHandler<___T>,
10609 ___T: ::fidl_next::Transport,
10610{
10611 async fn on_unknown_interaction(&mut self, ordinal: u64) {
10612 ___H::on_unknown_interaction(&mut self.0, ordinal).await
10613 }
10614}
10615
10616impl<___H, ___T> BufferCollectionTokenLocalServerHandler<___T> for ::fidl_next::Local<___H>
10617where
10618 ___H: BufferCollectionTokenServerHandler<___T>,
10619 ___T: ::fidl_next::Transport,
10620{
10621 async fn sync(
10622 &mut self,
10623
10624 responder: ::fidl_next::Responder<buffer_collection_token::Sync, ___T>,
10625 ) {
10626 ___H::sync(&mut self.0, responder).await
10627 }
10628
10629 async fn release(&mut self) {
10630 ___H::release(&mut self.0).await
10631 }
10632
10633 async fn set_name(
10634 &mut self,
10635
10636 request: ::fidl_next::Request<buffer_collection_token::SetName, ___T>,
10637 ) {
10638 ___H::set_name(&mut self.0, request).await
10639 }
10640
10641 async fn set_debug_client_info(
10642 &mut self,
10643
10644 request: ::fidl_next::Request<buffer_collection_token::SetDebugClientInfo, ___T>,
10645 ) {
10646 ___H::set_debug_client_info(&mut self.0, request).await
10647 }
10648
10649 async fn set_debug_timeout_log_deadline(
10650 &mut self,
10651
10652 request: ::fidl_next::Request<buffer_collection_token::SetDebugTimeoutLogDeadline, ___T>,
10653 ) {
10654 ___H::set_debug_timeout_log_deadline(&mut self.0, request).await
10655 }
10656
10657 async fn set_verbose_logging(&mut self) {
10658 ___H::set_verbose_logging(&mut self.0).await
10659 }
10660
10661 async fn get_node_ref(
10662 &mut self,
10663
10664 responder: ::fidl_next::Responder<buffer_collection_token::GetNodeRef, ___T>,
10665 ) {
10666 ___H::get_node_ref(&mut self.0, responder).await
10667 }
10668
10669 async fn is_alternate_for(
10670 &mut self,
10671
10672 request: ::fidl_next::Request<buffer_collection_token::IsAlternateFor, ___T>,
10673
10674 responder: ::fidl_next::Responder<buffer_collection_token::IsAlternateFor, ___T>,
10675 ) {
10676 ___H::is_alternate_for(&mut self.0, request, responder).await
10677 }
10678
10679 async fn get_buffer_collection_id(
10680 &mut self,
10681
10682 responder: ::fidl_next::Responder<buffer_collection_token::GetBufferCollectionId, ___T>,
10683 ) {
10684 ___H::get_buffer_collection_id(&mut self.0, responder).await
10685 }
10686
10687 async fn set_weak(&mut self) {
10688 ___H::set_weak(&mut self.0).await
10689 }
10690
10691 async fn set_weak_ok(
10692 &mut self,
10693
10694 request: ::fidl_next::Request<buffer_collection_token::SetWeakOk, ___T>,
10695 ) {
10696 ___H::set_weak_ok(&mut self.0, request).await
10697 }
10698
10699 async fn attach_node_tracking(
10700 &mut self,
10701
10702 request: ::fidl_next::Request<buffer_collection_token::AttachNodeTracking, ___T>,
10703 ) {
10704 ___H::attach_node_tracking(&mut self.0, request).await
10705 }
10706
10707 async fn duplicate_sync(
10708 &mut self,
10709
10710 request: ::fidl_next::Request<buffer_collection_token::DuplicateSync, ___T>,
10711
10712 responder: ::fidl_next::Responder<buffer_collection_token::DuplicateSync, ___T>,
10713 ) {
10714 ___H::duplicate_sync(&mut self.0, request, responder).await
10715 }
10716
10717 async fn duplicate(
10718 &mut self,
10719
10720 request: ::fidl_next::Request<buffer_collection_token::Duplicate, ___T>,
10721 ) {
10722 ___H::duplicate(&mut self.0, request).await
10723 }
10724
10725 async fn set_dispensable(&mut self) {
10726 ___H::set_dispensable(&mut self.0).await
10727 }
10728
10729 async fn create_buffer_collection_token_group(
10730 &mut self,
10731
10732 request: ::fidl_next::Request<
10733 buffer_collection_token::CreateBufferCollectionTokenGroup,
10734 ___T,
10735 >,
10736 ) {
10737 ___H::create_buffer_collection_token_group(&mut self.0, request).await
10738 }
10739
10740 async fn on_unknown_interaction(&mut self, ordinal: u64) {
10741 ___H::on_unknown_interaction(&mut self.0, ordinal).await
10742 }
10743}
10744
10745#[doc = " The sysmem implementation is consistent with a logical / conceptual model of\n allocation / logical allocation as follows:\n\n As usual, a logical allocation considers either the root and all nodes with\n connectivity to the root that don\'t transit a [`fuchsia.sysmem2/Node`]\n created with [`fuchsia.sysmem2/BufferCollection.AttachToken`], or a subtree\n rooted at an `AttachToken` `Node` and all `Node`(s) with connectivity to\n that subtree that don\'t transit another `AttachToken`. This is called the\n logical allocation pruned subtree, or pruned subtree for short.\n\n During constraints aggregation, each\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] will select a single child\n `Node` among its direct children. The rest of the children will appear to\n fail the logical allocation, while the selected child may succeed.\n\n When more than one `BufferCollectionTokenGroup` exists in the overall\n logical allocation pruned subtree, the relative priority between two groups\n is equivalent to their ordering in a DFS pre-order iteration of the tree,\n with parents higher priority than children, and left children higher\n priority than right children.\n\n When a particular child of a group is selected (whether provisionally during\n a constraints aggregation attempt, or as a final selection), the\n non-selection of other children of the group will \"hide\" any other groups\n under those non-selected children.\n\n Within a logical allocation, aggregation is attempted first by provisionally\n selecting child 0 of the highest-priority group, and child 0 of the next\n highest-priority group that isn\'t hidden by the provisional selections so\n far, etc.\n\n If that aggregation attempt fails, aggregation will be attempted with the\n ordinal 0 child of all the same groups except the lowest priority non-hidden\n group which will provisionally select its ordinal 1 child (and then child 2\n and so on). If a new lowest-priority group is un-hidden as provisional\n selections are updated, that newly un-hidden lowest-priority group has all\n its children considered in order, before changing the provisional selection\n in the former lowest-priority group. In terms of result, this is equivalent\n to systematic enumeration of all possible combinations of choices in a\n counting-like order updating the lowest-priority group the most often and\n the highest-priority group the least often. Rather than actually attempting\n aggregation with all the combinations, we can skip over combinations which\n are redundant/equivalent due to hiding without any change to the result.\n\n Attempted constraint aggregations of enumerated non-equivalent combinations\n of choices continue in this manner until either (a) all aggregation attempts\n fail in which case the overall logical allocation fails, or (b) until an\n attempted aggregation succeeds, in which case buffer allocation (if needed;\n if this is the pruned subtree rooted at the overall root `Node`) is\n attempted once. If buffer allocation based on the first successful\n constraints aggregation fails, the overall logical allocation fails (there\n is no buffer allocation retry / re-attempt). If buffer allocation succeeds\n (or is not needed due to being a pruned subtree that doesn\'t include the\n root), the logical allocation succeeds.\n\n If this prioritization scheme cannot reasonably work for your usage of\n sysmem, please don\'t hesitate to contact sysmem folks to discuss potentially\n adding a way to achieve what you need.\n\n Please avoid creating a large number of `BufferCollectionTokenGroup`(s) per\n logical allocation, especially with large number of children overall, and\n especially in cases where aggregation may reasonably be expected to often\n fail using ordinal 0 children and possibly with later children as well.\n Sysmem mitigates potentially high time complexity of evaluating too many\n child combinations/selections across too many groups by simply failing\n logical allocation beyond a certain (fairly high, but not huge) max number\n of considered group child combinations/selections. More advanced (and more\n complicated) mitigation is not anticipated to be practically necessary or\n worth the added complexity. Please contact sysmem folks if the max limit is\n getting hit or if you anticipate it getting hit, to discuss potential\n options.\n\n Prefer to use multiple [`fuchsia.sysmem2/ImageFormatConstraints`] in a\n single [`fuchsia.sysmem2/BufferCollectionConstraints`] when feasible (when a\n participant just needs to express the ability to work with more than a\n single [`fuchsia.images2/PixelFormat`], with sysmem choosing which\n `PixelFormat` to use among those supported by all participants).\n\n Similar to [`fuchsia.sysmem2/BufferCollectionToken`] and\n [`fuchsia.sysmem2/BufferCollection`], closure of the\n `BufferCollectionTokenGroup` channel without sending\n [`fuchsia.sysmem2/Node.Release`] first will cause buffer collection failure\n (or subtree failure if using\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`] and the\n `BufferCollectionTokenGroup` is part of a subtree under such a node that\n doesn\'t propagate failure to its parent).\n\n Epitaphs are not used in this protocol.\n"]
10747#[derive(PartialEq, Debug)]
10748pub struct BufferCollectionTokenGroup;
10749
10750#[cfg(target_os = "fuchsia")]
10751impl ::fidl_next::HasTransport for BufferCollectionTokenGroup {
10752 type Transport = ::fidl_next::fuchsia::zx::Channel;
10753}
10754
10755pub mod buffer_collection_token_group {
10756 pub mod prelude {
10757 pub use crate::{
10758 BufferCollectionTokenGroup, BufferCollectionTokenGroupClientHandler,
10759 BufferCollectionTokenGroupLocalClientHandler,
10760 BufferCollectionTokenGroupLocalServerHandler, BufferCollectionTokenGroupServerHandler,
10761 buffer_collection_token_group,
10762 };
10763
10764 pub use crate::natural::BufferCollectionTokenGroupCreateChildRequest;
10765
10766 pub use crate::natural::BufferCollectionTokenGroupCreateChildrenSyncRequest;
10767
10768 pub use crate::natural::BufferCollectionTokenGroupCreateChildrenSyncResponse;
10769
10770 pub use crate::natural::Error;
10771
10772 pub use crate::natural::NodeAttachNodeTrackingRequest;
10773
10774 pub use crate::natural::NodeIsAlternateForRequest;
10775
10776 pub use crate::natural::NodeSetDebugClientInfoRequest;
10777
10778 pub use crate::natural::NodeSetDebugTimeoutLogDeadlineRequest;
10779
10780 pub use crate::natural::NodeSetNameRequest;
10781
10782 pub use crate::natural::NodeSetWeakOkRequest;
10783
10784 pub use crate::natural::NodeGetBufferCollectionIdResponse;
10785
10786 pub use crate::natural::NodeGetNodeRefResponse;
10787
10788 pub use crate::natural::NodeIsAlternateForResponse;
10789
10790 pub use crate::natural::NodeSyncResponse;
10791 }
10792
10793 pub struct Sync;
10794
10795 impl ::fidl_next::Method for Sync {
10796 const ORDINAL: u64 = 1273433845120064340;
10797 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10798 ::fidl_next::protocol::Flexibility::Flexible;
10799
10800 type Protocol = crate::BufferCollectionTokenGroup;
10801
10802 type Request = ::fidl_next::wire::EmptyMessageBody;
10803 }
10804
10805 impl ::fidl_next::TwoWayMethod for Sync {
10806 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::NodeSyncResponse>;
10807 }
10808
10809 impl<___R> ::fidl_next::Respond<___R> for Sync {
10810 type Output = ::fidl_next::Flexible<___R>;
10811
10812 fn respond(response: ___R) -> Self::Output {
10813 ::fidl_next::Flexible(response)
10814 }
10815 }
10816
10817 pub struct Release;
10818
10819 impl ::fidl_next::Method for Release {
10820 const ORDINAL: u64 = 7664192519607813318;
10821 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10822 ::fidl_next::protocol::Flexibility::Flexible;
10823
10824 type Protocol = crate::BufferCollectionTokenGroup;
10825
10826 type Request = ::fidl_next::wire::EmptyMessageBody;
10827 }
10828
10829 pub struct SetName;
10830
10831 impl ::fidl_next::Method for SetName {
10832 const ORDINAL: u64 = 811194812442657257;
10833 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10834 ::fidl_next::protocol::Flexibility::Flexible;
10835
10836 type Protocol = crate::BufferCollectionTokenGroup;
10837
10838 type Request = crate::wire::NodeSetNameRequest<'static>;
10839 }
10840
10841 pub struct SetDebugClientInfo;
10842
10843 impl ::fidl_next::Method for SetDebugClientInfo {
10844 const ORDINAL: u64 = 6691936816931379633;
10845 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10846 ::fidl_next::protocol::Flexibility::Flexible;
10847
10848 type Protocol = crate::BufferCollectionTokenGroup;
10849
10850 type Request = crate::wire::NodeSetDebugClientInfoRequest<'static>;
10851 }
10852
10853 pub struct SetDebugTimeoutLogDeadline;
10854
10855 impl ::fidl_next::Method for SetDebugTimeoutLogDeadline {
10856 const ORDINAL: u64 = 8172637980026734598;
10857 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10858 ::fidl_next::protocol::Flexibility::Flexible;
10859
10860 type Protocol = crate::BufferCollectionTokenGroup;
10861
10862 type Request = crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>;
10863 }
10864
10865 pub struct SetVerboseLogging;
10866
10867 impl ::fidl_next::Method for SetVerboseLogging {
10868 const ORDINAL: u64 = 5911475287294795693;
10869 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10870 ::fidl_next::protocol::Flexibility::Flexible;
10871
10872 type Protocol = crate::BufferCollectionTokenGroup;
10873
10874 type Request = ::fidl_next::wire::EmptyMessageBody;
10875 }
10876
10877 pub struct GetNodeRef;
10878
10879 impl ::fidl_next::Method for GetNodeRef {
10880 const ORDINAL: u64 = 6574426773718429779;
10881 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10882 ::fidl_next::protocol::Flexibility::Flexible;
10883
10884 type Protocol = crate::BufferCollectionTokenGroup;
10885
10886 type Request = ::fidl_next::wire::EmptyMessageBody;
10887 }
10888
10889 impl ::fidl_next::TwoWayMethod for GetNodeRef {
10890 type Response =
10891 ::fidl_next::wire::Flexible<'static, crate::wire::NodeGetNodeRefResponse<'static>>;
10892 }
10893
10894 impl<___R> ::fidl_next::Respond<___R> for GetNodeRef {
10895 type Output = ::fidl_next::Flexible<___R>;
10896
10897 fn respond(response: ___R) -> Self::Output {
10898 ::fidl_next::Flexible(response)
10899 }
10900 }
10901
10902 pub struct IsAlternateFor;
10903
10904 impl ::fidl_next::Method for IsAlternateFor {
10905 const ORDINAL: u64 = 262772284282767397;
10906 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10907 ::fidl_next::protocol::Flexibility::Flexible;
10908
10909 type Protocol = crate::BufferCollectionTokenGroup;
10910
10911 type Request = crate::wire::NodeIsAlternateForRequest<'static>;
10912 }
10913
10914 impl ::fidl_next::TwoWayMethod for IsAlternateFor {
10915 type Response = ::fidl_next::wire::Result<
10916 'static,
10917 crate::wire::NodeIsAlternateForResponse<'static>,
10918 crate::wire::Error,
10919 >;
10920 }
10921
10922 impl<___R> ::fidl_next::Respond<___R> for IsAlternateFor {
10923 type Output = ::core::result::Result<___R, ::fidl_next::never::Never>;
10924
10925 fn respond(response: ___R) -> Self::Output {
10926 ::core::result::Result::Ok(response)
10927 }
10928 }
10929
10930 impl<___R> ::fidl_next::RespondErr<___R> for IsAlternateFor {
10931 type Output = ::core::result::Result<::fidl_next::never::Never, ___R>;
10932
10933 fn respond_err(response: ___R) -> Self::Output {
10934 ::core::result::Result::Err(response)
10935 }
10936 }
10937
10938 pub struct GetBufferCollectionId;
10939
10940 impl ::fidl_next::Method for GetBufferCollectionId {
10941 const ORDINAL: u64 = 8633851600235444876;
10942 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10943 ::fidl_next::protocol::Flexibility::Flexible;
10944
10945 type Protocol = crate::BufferCollectionTokenGroup;
10946
10947 type Request = ::fidl_next::wire::EmptyMessageBody;
10948 }
10949
10950 impl ::fidl_next::TwoWayMethod for GetBufferCollectionId {
10951 type Response = ::fidl_next::wire::Flexible<
10952 'static,
10953 crate::wire::NodeGetBufferCollectionIdResponse<'static>,
10954 >;
10955 }
10956
10957 impl<___R> ::fidl_next::Respond<___R> for GetBufferCollectionId {
10958 type Output = ::fidl_next::Flexible<___R>;
10959
10960 fn respond(response: ___R) -> Self::Output {
10961 ::fidl_next::Flexible(response)
10962 }
10963 }
10964
10965 pub struct SetWeak;
10966
10967 impl ::fidl_next::Method for SetWeak {
10968 const ORDINAL: u64 = 2512233045884338145;
10969 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10970 ::fidl_next::protocol::Flexibility::Flexible;
10971
10972 type Protocol = crate::BufferCollectionTokenGroup;
10973
10974 type Request = ::fidl_next::wire::EmptyMessageBody;
10975 }
10976
10977 pub struct SetWeakOk;
10978
10979 impl ::fidl_next::Method for SetWeakOk {
10980 const ORDINAL: u64 = 4081474869151288297;
10981 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10982 ::fidl_next::protocol::Flexibility::Flexible;
10983
10984 type Protocol = crate::BufferCollectionTokenGroup;
10985
10986 type Request = crate::wire::NodeSetWeakOkRequest<'static>;
10987 }
10988
10989 pub struct AttachNodeTracking;
10990
10991 impl ::fidl_next::Method for AttachNodeTracking {
10992 const ORDINAL: u64 = 4549465353676377516;
10993 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10994 ::fidl_next::protocol::Flexibility::Flexible;
10995
10996 type Protocol = crate::BufferCollectionTokenGroup;
10997
10998 type Request = crate::wire::NodeAttachNodeTrackingRequest<'static>;
10999 }
11000
11001 pub struct CreateChild;
11002
11003 impl ::fidl_next::Method for CreateChild {
11004 const ORDINAL: u64 = 4728787705853325509;
11005 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
11006 ::fidl_next::protocol::Flexibility::Flexible;
11007
11008 type Protocol = crate::BufferCollectionTokenGroup;
11009
11010 type Request = crate::wire::BufferCollectionTokenGroupCreateChildRequest<'static>;
11011 }
11012
11013 pub struct CreateChildrenSync;
11014
11015 impl ::fidl_next::Method for CreateChildrenSync {
11016 const ORDINAL: u64 = 1575877552079505162;
11017 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
11018 ::fidl_next::protocol::Flexibility::Flexible;
11019
11020 type Protocol = crate::BufferCollectionTokenGroup;
11021
11022 type Request = crate::wire::BufferCollectionTokenGroupCreateChildrenSyncRequest<'static>;
11023 }
11024
11025 impl ::fidl_next::TwoWayMethod for CreateChildrenSync {
11026 type Response = ::fidl_next::wire::Flexible<
11027 'static,
11028 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'static>,
11029 >;
11030 }
11031
11032 impl<___R> ::fidl_next::Respond<___R> for CreateChildrenSync {
11033 type Output = ::fidl_next::Flexible<___R>;
11034
11035 fn respond(response: ___R) -> Self::Output {
11036 ::fidl_next::Flexible(response)
11037 }
11038 }
11039
11040 pub struct AllChildrenPresent;
11041
11042 impl ::fidl_next::Method for AllChildrenPresent {
11043 const ORDINAL: u64 = 6643511257208525586;
11044 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
11045 ::fidl_next::protocol::Flexibility::Flexible;
11046
11047 type Protocol = crate::BufferCollectionTokenGroup;
11048
11049 type Request = ::fidl_next::wire::EmptyMessageBody;
11050 }
11051
11052 mod ___detail {
11053 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::BufferCollectionTokenGroup
11054 where
11055 ___T: ::fidl_next::Transport,
11056 {
11057 type Client = BufferCollectionTokenGroupClient<___T>;
11058 type Server = BufferCollectionTokenGroupServer<___T>;
11059 }
11060
11061 #[repr(transparent)]
11063 pub struct BufferCollectionTokenGroupClient<___T: ::fidl_next::Transport> {
11064 #[allow(dead_code)]
11065 client: ::fidl_next::protocol::Client<___T>,
11066 }
11067
11068 impl<___T> BufferCollectionTokenGroupClient<___T>
11069 where
11070 ___T: ::fidl_next::Transport,
11071 {
11072 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
11073 pub fn sync(&self) -> ::fidl_next::TwoWayFuture<'_, super::Sync, ___T> {
11074 ::fidl_next::TwoWayFuture::from_untyped(
11075 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
11076 1273433845120064340,
11077 <super::Sync as ::fidl_next::Method>::FLEXIBILITY,
11078 (),
11079 ),
11080 )
11081 }
11082
11083 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
11084 pub fn release(&self) -> ::fidl_next::SendFuture<'_, ___T> {
11085 ::fidl_next::SendFuture::from_untyped(
11086 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
11087 7664192519607813318,
11088 <super::Release as ::fidl_next::Method>::FLEXIBILITY,
11089 (),
11090 ),
11091 )
11092 }
11093
11094 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
11095 pub fn set_name_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
11096 where
11097 ___R: ::fidl_next::Encode<
11098 crate::wire::NodeSetNameRequest<'static>,
11099 <___T as ::fidl_next::Transport>::SendBuffer,
11100 >,
11101 {
11102 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
11103 811194812442657257,
11104 <super::SetName as ::fidl_next::Method>::FLEXIBILITY,
11105 request,
11106 ))
11107 }
11108
11109 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
11110 pub fn set_debug_client_info_with<___R>(
11111 &self,
11112 request: ___R,
11113 ) -> ::fidl_next::SendFuture<'_, ___T>
11114 where
11115 ___R: ::fidl_next::Encode<
11116 crate::wire::NodeSetDebugClientInfoRequest<'static>,
11117 <___T as ::fidl_next::Transport>::SendBuffer,
11118 >,
11119 {
11120 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
11121 6691936816931379633,
11122 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
11123 request,
11124 ))
11125 }
11126
11127 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
11128 pub fn set_debug_timeout_log_deadline_with<___R>(
11129 &self,
11130 request: ___R,
11131 ) -> ::fidl_next::SendFuture<'_, ___T>
11132 where
11133 ___R: ::fidl_next::Encode<
11134 crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>,
11135 <___T as ::fidl_next::Transport>::SendBuffer,
11136 >,
11137 {
11138 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
11139 8172637980026734598,
11140 <super::SetDebugTimeoutLogDeadline as ::fidl_next::Method>::FLEXIBILITY,
11141 request,
11142 ))
11143 }
11144
11145 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
11146 pub fn set_verbose_logging(&self) -> ::fidl_next::SendFuture<'_, ___T> {
11147 ::fidl_next::SendFuture::from_untyped(
11148 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
11149 5911475287294795693,
11150 <super::SetVerboseLogging as ::fidl_next::Method>::FLEXIBILITY,
11151 (),
11152 ),
11153 )
11154 }
11155
11156 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
11157 pub fn get_node_ref(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetNodeRef, ___T> {
11158 ::fidl_next::TwoWayFuture::from_untyped(
11159 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
11160 6574426773718429779,
11161 <super::GetNodeRef as ::fidl_next::Method>::FLEXIBILITY,
11162 (),
11163 ),
11164 )
11165 }
11166
11167 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
11168 pub fn is_alternate_for_with<___R>(
11169 &self,
11170 request: ___R,
11171 ) -> ::fidl_next::TwoWayFuture<'_, super::IsAlternateFor, ___T>
11172 where
11173 ___R: ::fidl_next::Encode<
11174 crate::wire::NodeIsAlternateForRequest<'static>,
11175 <___T as ::fidl_next::Transport>::SendBuffer,
11176 >,
11177 {
11178 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
11179 262772284282767397,
11180 <super::IsAlternateFor as ::fidl_next::Method>::FLEXIBILITY,
11181 request,
11182 ))
11183 }
11184
11185 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
11186 pub fn get_buffer_collection_id(
11187 &self,
11188 ) -> ::fidl_next::TwoWayFuture<'_, super::GetBufferCollectionId, ___T> {
11189 ::fidl_next::TwoWayFuture::from_untyped(
11190 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
11191 8633851600235444876,
11192 <super::GetBufferCollectionId as ::fidl_next::Method>::FLEXIBILITY,
11193 (),
11194 ),
11195 )
11196 }
11197
11198 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
11199 pub fn set_weak(&self) -> ::fidl_next::SendFuture<'_, ___T> {
11200 ::fidl_next::SendFuture::from_untyped(
11201 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
11202 2512233045884338145,
11203 <super::SetWeak as ::fidl_next::Method>::FLEXIBILITY,
11204 (),
11205 ),
11206 )
11207 }
11208
11209 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
11210 pub fn set_weak_ok_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
11211 where
11212 ___R: ::fidl_next::Encode<
11213 crate::wire::NodeSetWeakOkRequest<'static>,
11214 <___T as ::fidl_next::Transport>::SendBuffer,
11215 >,
11216 {
11217 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
11218 4081474869151288297,
11219 <super::SetWeakOk as ::fidl_next::Method>::FLEXIBILITY,
11220 request,
11221 ))
11222 }
11223
11224 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
11225 pub fn attach_node_tracking_with<___R>(
11226 &self,
11227 request: ___R,
11228 ) -> ::fidl_next::SendFuture<'_, ___T>
11229 where
11230 ___R: ::fidl_next::Encode<
11231 crate::wire::NodeAttachNodeTrackingRequest<'static>,
11232 <___T as ::fidl_next::Transport>::SendBuffer,
11233 >,
11234 {
11235 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
11236 4549465353676377516,
11237 <super::AttachNodeTracking as ::fidl_next::Method>::FLEXIBILITY,
11238 request,
11239 ))
11240 }
11241
11242 #[doc = " Create a child [`fuchsia.sysmem2/BufferCollectionToken`]. Only one child\n (including its children) will be selected during allocation (or logical\n allocation).\n\n Before passing the client end of this token to\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], completion of\n [`fuchsia.sysmem2/Node.Sync`] after\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`] is required.\n Or the client can use\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChildrenSync`] which\n essentially includes the `Sync`.\n\n Sending CreateChild after AllChildrenPresent is not permitted; this will\n fail the group\'s subtree and close the connection.\n\n After all children have been created, send AllChildrenPresent.\n\n + request `token_request` The server end of the new token channel.\n + request `rights_attenuation_mask` If ZX_RIGHT_SAME_RIGHTS, the created\n token allows the holder to get the same rights to buffers as the\n parent token (of the group) had. When the value isn\'t\n ZX_RIGHT_SAME_RIGHTS, the value is interpretted as a bitmask with 0\n bits ensuring those rights are attentuated, so 0xFFFFFFFF is a synonym\n for ZX_RIGHT_SAME_RIGHTS. The value 0 is not allowed and intentionally\n causes subtree failure.\n"]
11243 pub fn create_child_with<___R>(
11244 &self,
11245 request: ___R,
11246 ) -> ::fidl_next::SendFuture<'_, ___T>
11247 where
11248 ___R: ::fidl_next::Encode<
11249 crate::wire::BufferCollectionTokenGroupCreateChildRequest<'static>,
11250 <___T as ::fidl_next::Transport>::SendBuffer,
11251 >,
11252 {
11253 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
11254 4728787705853325509,
11255 <super::CreateChild as ::fidl_next::Method>::FLEXIBILITY,
11256 request,
11257 ))
11258 }
11259
11260 #[doc = " Create 1 or more child tokens at once, synchronously. In contrast to\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`], no\n [`fuchsia.sysmem2/Node.Sync`] is required before passing the client end\n of a returned token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`].\n\n The lower-index child tokens are higher priority (attempted sooner) than\n higher-index child tokens.\n\n As per all child tokens, successful aggregation will choose exactly one\n child among all created children (across all children created across\n potentially multiple calls to\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`] and\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChildrenSync`]).\n\n The maximum permissible total number of children per group, and total\n number of nodes in an overall tree (from the root) are capped to limits\n which are not configurable via these protocols.\n\n Sending CreateChildrenSync after AllChildrenPresent is not permitted;\n this will fail the group\'s subtree and close the connection.\n\n After all children have been created, send AllChildrenPresent.\n\n + request `rights_attentuation_masks` The size of the\n `rights_attentuation_masks` determines the number of created child\n tokens. The value ZX_RIGHT_SAME_RIGHTS doesn\'t attenuate any rights.\n The value 0xFFFFFFFF is a synonym for ZX_RIGHT_SAME_RIGHTS. For any\n other value, each 0 bit in the mask attenuates that right.\n - response `tokens` The created child tokens.\n"]
11261 pub fn create_children_sync_with<___R>(
11262 &self,
11263 request: ___R,
11264 ) -> ::fidl_next::TwoWayFuture<'_, super::CreateChildrenSync, ___T>
11265 where
11266 ___R: ::fidl_next::Encode<
11267 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncRequest<'static>,
11268 <___T as ::fidl_next::Transport>::SendBuffer,
11269 >,
11270 {
11271 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
11272 1575877552079505162,
11273 <super::CreateChildrenSync as ::fidl_next::Method>::FLEXIBILITY,
11274 request,
11275 ))
11276 }
11277
11278 #[doc = " Indicate that no more children will be created.\n\n After creating all children, the client should send\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent`] to\n inform sysmem that no more children will be created, so that sysmem can\n know when it\'s ok to start aggregating constraints.\n\n Sending CreateChild after AllChildrenPresent is not permitted; this will\n fail the group\'s subtree and close the connection.\n\n If [`fuchsia.sysmem2/Node.Release`] is to be sent, it should be sent\n after `AllChildrenPresent`, else failure of the group\'s subtree will be\n triggered. This is intentionally not analogous to how `Release` without\n prior [`fuchsia.sysmem2/BufferCollection.SetConstraints`] doesn\'t cause\n subtree failure.\n"]
11279 pub fn all_children_present(&self) -> ::fidl_next::SendFuture<'_, ___T> {
11280 ::fidl_next::SendFuture::from_untyped(
11281 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
11282 6643511257208525586,
11283 <super::AllChildrenPresent as ::fidl_next::Method>::FLEXIBILITY,
11284 (),
11285 ),
11286 )
11287 }
11288 }
11289
11290 #[repr(transparent)]
11292 pub struct BufferCollectionTokenGroupServer<___T: ::fidl_next::Transport> {
11293 server: ::fidl_next::protocol::Server<___T>,
11294 }
11295
11296 impl<___T> BufferCollectionTokenGroupServer<___T> where ___T: ::fidl_next::Transport {}
11297 }
11298}
11299
11300#[diagnostic::on_unimplemented(
11301 note = "If {Self} implements the non-local BufferCollectionTokenGroupClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
11302)]
11303
11304pub trait BufferCollectionTokenGroupLocalClientHandler<
11308 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
11309 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
11310>
11311{
11312 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
11313 ::core::future::ready(())
11314 }
11315}
11316
11317impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for BufferCollectionTokenGroup
11318where
11319 ___H: BufferCollectionTokenGroupLocalClientHandler<___T>,
11320 ___T: ::fidl_next::Transport,
11321{
11322 async fn on_event(
11323 handler: &mut ___H,
11324 mut message: ::fidl_next::Message<___T>,
11325 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
11326 match *message.header().ordinal {
11327 ordinal => {
11328 handler.on_unknown_interaction(ordinal).await;
11329 if ::core::matches!(
11330 message.header().flexibility(),
11331 ::fidl_next::protocol::Flexibility::Strict
11332 ) {
11333 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
11334 } else {
11335 Ok(())
11336 }
11337 }
11338 }
11339 }
11340}
11341
11342#[diagnostic::on_unimplemented(
11343 note = "If {Self} implements the non-local BufferCollectionTokenGroupServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
11344)]
11345
11346pub trait BufferCollectionTokenGroupLocalServerHandler<
11350 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
11351 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
11352>
11353{
11354 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
11355 fn sync(
11356 &mut self,
11357
11358 responder: ::fidl_next::Responder<buffer_collection_token_group::Sync, ___T>,
11359 ) -> impl ::core::future::Future<Output = ()>;
11360
11361 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
11362 fn release(&mut self) -> impl ::core::future::Future<Output = ()>;
11363
11364 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
11365 fn set_name(
11366 &mut self,
11367
11368 request: ::fidl_next::Request<buffer_collection_token_group::SetName, ___T>,
11369 ) -> impl ::core::future::Future<Output = ()>;
11370
11371 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
11372 fn set_debug_client_info(
11373 &mut self,
11374
11375 request: ::fidl_next::Request<buffer_collection_token_group::SetDebugClientInfo, ___T>,
11376 ) -> impl ::core::future::Future<Output = ()>;
11377
11378 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
11379 fn set_debug_timeout_log_deadline(
11380 &mut self,
11381
11382 request: ::fidl_next::Request<
11383 buffer_collection_token_group::SetDebugTimeoutLogDeadline,
11384 ___T,
11385 >,
11386 ) -> impl ::core::future::Future<Output = ()>;
11387
11388 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
11389 fn set_verbose_logging(&mut self) -> impl ::core::future::Future<Output = ()>;
11390
11391 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
11392 fn get_node_ref(
11393 &mut self,
11394
11395 responder: ::fidl_next::Responder<buffer_collection_token_group::GetNodeRef, ___T>,
11396 ) -> impl ::core::future::Future<Output = ()>;
11397
11398 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
11399 fn is_alternate_for(
11400 &mut self,
11401
11402 request: ::fidl_next::Request<buffer_collection_token_group::IsAlternateFor, ___T>,
11403
11404 responder: ::fidl_next::Responder<buffer_collection_token_group::IsAlternateFor, ___T>,
11405 ) -> impl ::core::future::Future<Output = ()>;
11406
11407 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
11408 fn get_buffer_collection_id(
11409 &mut self,
11410
11411 responder: ::fidl_next::Responder<
11412 buffer_collection_token_group::GetBufferCollectionId,
11413 ___T,
11414 >,
11415 ) -> impl ::core::future::Future<Output = ()>;
11416
11417 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
11418 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()>;
11419
11420 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
11421 fn set_weak_ok(
11422 &mut self,
11423
11424 request: ::fidl_next::Request<buffer_collection_token_group::SetWeakOk, ___T>,
11425 ) -> impl ::core::future::Future<Output = ()>;
11426
11427 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
11428 fn attach_node_tracking(
11429 &mut self,
11430
11431 request: ::fidl_next::Request<buffer_collection_token_group::AttachNodeTracking, ___T>,
11432 ) -> impl ::core::future::Future<Output = ()>;
11433
11434 #[doc = " Create a child [`fuchsia.sysmem2/BufferCollectionToken`]. Only one child\n (including its children) will be selected during allocation (or logical\n allocation).\n\n Before passing the client end of this token to\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], completion of\n [`fuchsia.sysmem2/Node.Sync`] after\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`] is required.\n Or the client can use\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChildrenSync`] which\n essentially includes the `Sync`.\n\n Sending CreateChild after AllChildrenPresent is not permitted; this will\n fail the group\'s subtree and close the connection.\n\n After all children have been created, send AllChildrenPresent.\n\n + request `token_request` The server end of the new token channel.\n + request `rights_attenuation_mask` If ZX_RIGHT_SAME_RIGHTS, the created\n token allows the holder to get the same rights to buffers as the\n parent token (of the group) had. When the value isn\'t\n ZX_RIGHT_SAME_RIGHTS, the value is interpretted as a bitmask with 0\n bits ensuring those rights are attentuated, so 0xFFFFFFFF is a synonym\n for ZX_RIGHT_SAME_RIGHTS. The value 0 is not allowed and intentionally\n causes subtree failure.\n"]
11435 fn create_child(
11436 &mut self,
11437
11438 request: ::fidl_next::Request<buffer_collection_token_group::CreateChild, ___T>,
11439 ) -> impl ::core::future::Future<Output = ()>;
11440
11441 #[doc = " Create 1 or more child tokens at once, synchronously. In contrast to\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`], no\n [`fuchsia.sysmem2/Node.Sync`] is required before passing the client end\n of a returned token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`].\n\n The lower-index child tokens are higher priority (attempted sooner) than\n higher-index child tokens.\n\n As per all child tokens, successful aggregation will choose exactly one\n child among all created children (across all children created across\n potentially multiple calls to\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`] and\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChildrenSync`]).\n\n The maximum permissible total number of children per group, and total\n number of nodes in an overall tree (from the root) are capped to limits\n which are not configurable via these protocols.\n\n Sending CreateChildrenSync after AllChildrenPresent is not permitted;\n this will fail the group\'s subtree and close the connection.\n\n After all children have been created, send AllChildrenPresent.\n\n + request `rights_attentuation_masks` The size of the\n `rights_attentuation_masks` determines the number of created child\n tokens. The value ZX_RIGHT_SAME_RIGHTS doesn\'t attenuate any rights.\n The value 0xFFFFFFFF is a synonym for ZX_RIGHT_SAME_RIGHTS. For any\n other value, each 0 bit in the mask attenuates that right.\n - response `tokens` The created child tokens.\n"]
11442 fn create_children_sync(
11443 &mut self,
11444
11445 request: ::fidl_next::Request<buffer_collection_token_group::CreateChildrenSync, ___T>,
11446
11447 responder: ::fidl_next::Responder<buffer_collection_token_group::CreateChildrenSync, ___T>,
11448 ) -> impl ::core::future::Future<Output = ()>;
11449
11450 #[doc = " Indicate that no more children will be created.\n\n After creating all children, the client should send\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent`] to\n inform sysmem that no more children will be created, so that sysmem can\n know when it\'s ok to start aggregating constraints.\n\n Sending CreateChild after AllChildrenPresent is not permitted; this will\n fail the group\'s subtree and close the connection.\n\n If [`fuchsia.sysmem2/Node.Release`] is to be sent, it should be sent\n after `AllChildrenPresent`, else failure of the group\'s subtree will be\n triggered. This is intentionally not analogous to how `Release` without\n prior [`fuchsia.sysmem2/BufferCollection.SetConstraints`] doesn\'t cause\n subtree failure.\n"]
11451 fn all_children_present(&mut self) -> impl ::core::future::Future<Output = ()>;
11452
11453 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
11454 ::core::future::ready(())
11455 }
11456}
11457
11458impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for BufferCollectionTokenGroup
11459where
11460 ___H: BufferCollectionTokenGroupLocalServerHandler<___T> ,
11461 ___T: ::fidl_next::Transport,
11462
11463
11464
11465
11466
11467
11468 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
11469 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11470 Constraint = (),
11471 >,
11472
11473
11474
11475 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
11476 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11477 Constraint = (),
11478 >,
11479
11480
11481
11482 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
11483 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11484 Constraint = (),
11485 >,
11486
11487
11488
11489
11490
11491
11492
11493 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
11494 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11495 Constraint = (),
11496 >,
11497
11498
11499
11500
11501
11502
11503
11504 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
11505 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11506 Constraint = (),
11507 >,
11508
11509
11510
11511 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
11512 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11513 Constraint = (),
11514 >,
11515
11516
11517
11518 for<'de> crate::wire::BufferCollectionTokenGroupCreateChildRequest<'de>: ::fidl_next::Decode<
11519 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11520 Constraint = (),
11521 >,
11522
11523
11524
11525 for<'de> crate::wire::BufferCollectionTokenGroupCreateChildrenSyncRequest<'de>: ::fidl_next::Decode<
11526 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11527 Constraint = (),
11528 >,
11529
11530
11531
11532
11533{
11534 async fn on_one_way(
11535 handler: &mut ___H,
11536 mut message: ::fidl_next::Message<___T>,
11537 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
11538 match *message.header().ordinal {
11539
11540
11541
11542
11543
11544
11545 7664192519607813318 => {
11546
11547 handler.release().await;
11548 Ok(())
11549
11550 }
11551
11552
11553
11554
11555 811194812442657257 => {
11556
11557 match ::fidl_next::AsDecoderExt::into_decoded(message) {
11558 Ok(decoded) => {
11559 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
11560 Ok(())
11561 }
11562 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11563 ordinal: 811194812442657257,
11564 error,
11565 }),
11566 }
11567
11568 }
11569
11570
11571
11572
11573 6691936816931379633 => {
11574
11575 match ::fidl_next::AsDecoderExt::into_decoded(message) {
11576 Ok(decoded) => {
11577 handler.set_debug_client_info(::fidl_next::Request::from_decoded(decoded)).await;
11578 Ok(())
11579 }
11580 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11581 ordinal: 6691936816931379633,
11582 error,
11583 }),
11584 }
11585
11586 }
11587
11588
11589
11590
11591 8172637980026734598 => {
11592
11593 match ::fidl_next::AsDecoderExt::into_decoded(message) {
11594 Ok(decoded) => {
11595 handler.set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded)).await;
11596 Ok(())
11597 }
11598 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11599 ordinal: 8172637980026734598,
11600 error,
11601 }),
11602 }
11603
11604 }
11605
11606
11607
11608
11609 5911475287294795693 => {
11610
11611 handler.set_verbose_logging().await;
11612 Ok(())
11613
11614 }
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628 2512233045884338145 => {
11629
11630 handler.set_weak().await;
11631 Ok(())
11632
11633 }
11634
11635
11636
11637
11638 4081474869151288297 => {
11639
11640 match ::fidl_next::AsDecoderExt::into_decoded(message) {
11641 Ok(decoded) => {
11642 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
11643 Ok(())
11644 }
11645 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11646 ordinal: 4081474869151288297,
11647 error,
11648 }),
11649 }
11650
11651 }
11652
11653
11654
11655
11656 4549465353676377516 => {
11657
11658 match ::fidl_next::AsDecoderExt::into_decoded(message) {
11659 Ok(decoded) => {
11660 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
11661 Ok(())
11662 }
11663 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11664 ordinal: 4549465353676377516,
11665 error,
11666 }),
11667 }
11668
11669 }
11670
11671
11672
11673
11674 4728787705853325509 => {
11675
11676 match ::fidl_next::AsDecoderExt::into_decoded(message) {
11677 Ok(decoded) => {
11678 handler.create_child(::fidl_next::Request::from_decoded(decoded)).await;
11679 Ok(())
11680 }
11681 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11682 ordinal: 4728787705853325509,
11683 error,
11684 }),
11685 }
11686
11687 }
11688
11689
11690
11691
11692
11693
11694
11695 6643511257208525586 => {
11696
11697 handler.all_children_present().await;
11698 Ok(())
11699
11700 }
11701
11702
11703 ordinal => {
11704
11705 handler.on_unknown_interaction(ordinal).await;
11706 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
11707 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
11708 } else {
11709 Ok(())
11710 }
11711
11712 }
11713 }
11714 }
11715
11716 async fn on_two_way(
11717 handler: &mut ___H,
11718 mut message: ::fidl_next::Message<___T>,
11719 responder: ::fidl_next::protocol::Responder<___T>,
11720 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
11721 match *message.header().ordinal {
11722
11723
11724
11725 1273433845120064340 => {
11726 let responder = ::fidl_next::Responder::from_untyped(responder);
11727
11728 handler.sync(responder).await;
11729 Ok(())
11730
11731 }
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751 6574426773718429779 => {
11752 let responder = ::fidl_next::Responder::from_untyped(responder);
11753
11754 handler.get_node_ref(responder).await;
11755 Ok(())
11756
11757 }
11758
11759
11760
11761
11762 262772284282767397 => {
11763 let responder = ::fidl_next::Responder::from_untyped(responder);
11764
11765 match ::fidl_next::AsDecoderExt::into_decoded(message) {
11766 Ok(decoded) => {
11767 handler.is_alternate_for(::fidl_next::Request::from_decoded(decoded), responder).await;
11768 Ok(())
11769 }
11770 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11771 ordinal: 262772284282767397,
11772 error,
11773 }),
11774 }
11775
11776 }
11777
11778
11779
11780
11781 8633851600235444876 => {
11782 let responder = ::fidl_next::Responder::from_untyped(responder);
11783
11784 handler.get_buffer_collection_id(responder).await;
11785 Ok(())
11786
11787 }
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804 1575877552079505162 => {
11805 let responder = ::fidl_next::Responder::from_untyped(responder);
11806
11807 match ::fidl_next::AsDecoderExt::into_decoded(message) {
11808 Ok(decoded) => {
11809 handler.create_children_sync(::fidl_next::Request::from_decoded(decoded), responder).await;
11810 Ok(())
11811 }
11812 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11813 ordinal: 1575877552079505162,
11814 error,
11815 }),
11816 }
11817
11818 }
11819
11820
11821
11822
11823
11824 ordinal => {
11825
11826 handler.on_unknown_interaction(ordinal).await;
11827 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
11828 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
11829 } else {
11830 responder.respond_framework_error(
11831 ordinal,
11832 ::fidl_next::FrameworkError::UnknownMethod,
11833 )
11834 .expect("encoding a framework error should never fail")
11835 .await?;
11836 Ok(())
11837 }
11838
11839 }
11840 }
11841 }
11842}
11843
11844pub trait BufferCollectionTokenGroupClientHandler<
11848 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
11849 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
11850>
11851{
11852 fn on_unknown_interaction(
11853 &mut self,
11854 ordinal: u64,
11855 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
11856 ::core::future::ready(())
11857 }
11858}
11859
11860impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for BufferCollectionTokenGroup
11861where
11862 ___H: BufferCollectionTokenGroupClientHandler<___T> + ::core::marker::Send,
11863 ___T: ::fidl_next::Transport,
11864{
11865 async fn on_event(
11866 handler: &mut ___H,
11867 mut message: ::fidl_next::Message<___T>,
11868 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
11869 match *message.header().ordinal {
11870 ordinal => {
11871 handler.on_unknown_interaction(ordinal).await;
11872 if ::core::matches!(
11873 message.header().flexibility(),
11874 ::fidl_next::protocol::Flexibility::Strict
11875 ) {
11876 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
11877 } else {
11878 Ok(())
11879 }
11880 }
11881 }
11882 }
11883}
11884
11885pub trait BufferCollectionTokenGroupServerHandler<
11889 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
11890 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
11891>
11892{
11893 #[doc = " Ensure that previous messages have been received server side. This is\n particularly useful after previous messages that created new tokens,\n because a token must be known to the sysmem server before sending the\n token to another participant.\n\n Calling [`fuchsia.sysmem2/BufferCollectionToken.Sync`] on a token that\n isn\'t/wasn\'t a valid token risks the `Sync` stalling forever. See\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] for one way\n to mitigate the possibility of a hostile/fake\n [`fuchsia.sysmem2/BufferCollectionToken`] at the cost of one round trip.\n Another way is to pass the token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`], which also validates\n the token as part of exchanging it for a\n [`fuchsia.sysmem2/BufferCollection`] channel, and\n [`fuchsia.sysmem2/BufferCollection.Sync`] can then be used without risk\n of stalling.\n\n After creating one or more [`fuchsia.sysmem2/BufferCollectionToken`](s)\n and then starting and completing a `Sync`, it\'s then safe to send the\n `BufferCollectionToken` client ends to other participants knowing the\n server will recognize the tokens when they\'re sent by the other\n participants to sysmem in a\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] message. This is an\n efficient way to create tokens while avoiding unnecessary round trips.\n\n Other options include waiting for each\n [`fuchsia.sysmem2/BufferCollectionToken.Duplicate`] to complete\n individually (using separate call to `Sync` after each), or calling\n [`fuchsia.sysmem2/BufferCollection.Sync`] after a token has been\n converted to a `BufferCollection` via\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], or using\n [`fuchsia.sysmem2/BufferCollectionToken.DuplicateSync`] which includes\n the sync step and can create multiple tokens at once.\n"]
11894 fn sync(
11895 &mut self,
11896
11897 responder: ::fidl_next::Responder<buffer_collection_token_group::Sync, ___T>,
11898 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11899
11900 #[doc = " ###### On a [`fuchsia.sysmem2/BufferCollectionToken`] channel:\n\n Normally a participant will convert a `BufferCollectionToken` into a\n [`fuchsia.sysmem2/BufferCollection`], but a participant can instead send\n `Release` via the token (and then close the channel immediately or\n shortly later in response to server closing the server end), which\n avoids causing buffer collection failure. Without a prior `Release`,\n closing the `BufferCollectionToken` client end will cause buffer\n collection failure.\n\n ###### On a [`fuchsia.sysmem2/BufferCollection`] channel:\n\n By default the server handles unexpected closure of a\n [`fuchsia.sysmem2/BufferCollection`] client end (without `Release`\n first) by failing the buffer collection. Partly this is to expedite\n closing VMO handles to reclaim memory when any participant fails. If a\n participant would like to cleanly close a `BufferCollection` without\n causing buffer collection failure, the participant can send `Release`\n before closing the `BufferCollection` client end. The `Release` can\n occur before or after `SetConstraints`. If before `SetConstraints`, the\n buffer collection won\'t require constraints from this node in order to\n allocate. If after `SetConstraints`, the constraints are retained and\n aggregated, despite the lack of `BufferCollection` connection at the\n time of constraints aggregation.\n\n ###### On a [`fuchsia.sysmem2/BufferCollectionTokenGroup`] channel:\n\n By default, unexpected closure of a `BufferCollectionTokenGroup` client\n end (without `Release` first) will trigger failure of the buffer\n collection. To close a `BufferCollectionTokenGroup` channel without\n failing the buffer collection, ensure that AllChildrenPresent() has been\n sent, and send `Release` before closing the `BufferCollectionTokenGroup`\n client end.\n\n If `Release` occurs before\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent], the\n buffer collection will fail (triggered by reception of `Release` without\n prior `AllChildrenPresent`). This is intentionally not analogous to how\n [`fuchsia.sysmem2/BufferCollection.Release`] without\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] first doesn\'t cause\n buffer collection failure. For a `BufferCollectionTokenGroup`, clean\n close requires `AllChildrenPresent` (if not already sent), then\n `Release`, then close client end.\n\n If `Release` occurs after `AllChildrenPresent`, the children and all\n their constraints remain intact (just as they would if the\n `BufferCollectionTokenGroup` channel had remained open), and the client\n end close doesn\'t trigger buffer collection failure.\n\n ###### On all [`fuchsia.sysmem2/Node`] channels (any of the above):\n\n For brevity, the per-channel-protocol paragraphs above ignore the\n separate failure domain created by\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`] or\n [`fuchsia.sysmem2/BufferCollection.AttachToken`]. When a client end\n unexpectedly closes (without `Release` first) and that client end is\n under a failure domain, instead of failing the whole buffer collection,\n the failure domain is failed, but the buffer collection itself is\n isolated from failure of the failure domain. Such failure domains can be\n nested, in which case only the inner-most failure domain in which the\n `Node` resides fails.\n"]
11901 fn release(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11902
11903 #[doc = " Set a name for VMOs in this buffer collection.\n\n If the name doesn\'t fit in ZX_MAX_NAME_LEN, the name of the vmo itself\n will be truncated to fit. The name of the vmo will be suffixed with the\n buffer index within the collection (if the suffix fits within\n ZX_MAX_NAME_LEN). The name specified here (without truncation) will be\n listed in the inspect data.\n\n The name only affects VMOs allocated after the name is set; this call\n does not rename existing VMOs. If multiple clients set different names\n then the larger priority value will win. Setting a new name with the\n same priority as a prior name doesn\'t change the name.\n\n All table fields are currently required.\n\n + request `priority` The name is only set if this is the first `SetName`\n or if `priority` is greater than any previous `priority` value in\n prior `SetName` calls across all `Node`(s) of this buffer collection.\n + request `name` The name for VMOs created under this buffer collection.\n"]
11904 fn set_name(
11905 &mut self,
11906
11907 request: ::fidl_next::Request<buffer_collection_token_group::SetName, ___T>,
11908 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11909
11910 #[doc = " Set information about the current client that can be used by sysmem to\n help diagnose leaking memory and allocation stalls waiting for a\n participant to send [`fuchsia.sysmem2/BufferCollection.SetConstraints`].\n\n This sets the debug client info on this [`fuchsia.sysmem2/Node`] and all\n `Node`(s) derived from this `Node`, unless overriden by\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] or a later\n [`fuchsia.sysmem2/Node.SetDebugClientInfo`].\n\n Sending [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] once per\n `Allocator` is the most efficient way to ensure that all\n [`fuchsia.sysmem2/Node`](s) will have at least some debug client info\n set, and is also more efficient than separately sending the same debug\n client info via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] for each\n created [`fuchsia.sysmem2/Node`].\n\n Also used when verbose logging is enabled (see `SetVerboseLogging`) to\n indicate which client is closing their channel first, leading to subtree\n failure (which can be normal if the purpose of the subtree is over, but\n if happening earlier than expected, the client-channel-specific name can\n help diagnose where the failure is first coming from, from sysmem\'s\n point of view).\n\n All table fields are currently required.\n\n + request `name` This can be an arbitrary string, but the current\n process name (see `fsl::GetCurrentProcessName`) is a good default.\n + request `id` This can be an arbitrary id, but the current process ID\n (see `fsl::GetCurrentProcessKoid`) is a good default.\n"]
11911 fn set_debug_client_info(
11912 &mut self,
11913
11914 request: ::fidl_next::Request<buffer_collection_token_group::SetDebugClientInfo, ___T>,
11915 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11916
11917 #[doc = " Sysmem logs a warning if sysmem hasn\'t seen\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from all clients\n within 5 seconds after creation of a new collection.\n\n Clients can call this method to change when the log is printed. If\n multiple client set the deadline, it\'s unspecified which deadline will\n take effect.\n\n In most cases the default works well.\n\n All table fields are currently required.\n\n + request `deadline` The time at which sysmem will start trying to log\n the warning, unless all constraints are with sysmem by then.\n"]
11918 fn set_debug_timeout_log_deadline(
11919 &mut self,
11920
11921 request: ::fidl_next::Request<
11922 buffer_collection_token_group::SetDebugTimeoutLogDeadline,
11923 ___T,
11924 >,
11925 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11926
11927 #[doc = " This enables verbose logging for the buffer collection.\n\n Verbose logging includes constraints set via\n [`fuchsia.sysmem2/BufferCollection.SetConstraints`] from each client\n along with info set via [`fuchsia.sysmem2/Node.SetDebugClientInfo`] (or\n [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`]) and the structure of\n the tree of `Node`(s).\n\n Normally sysmem prints only a single line complaint when aggregation\n fails, with just the specific detailed reason that aggregation failed,\n with little surrounding context. While this is often enough to diagnose\n a problem if only a small change was made and everything was working\n before the small change, it\'s often not particularly helpful for getting\n a new buffer collection to work for the first time. Especially with\n more complex trees of nodes, involving things like\n [`fuchsia.sysmem2/BufferCollection.AttachToken`],\n [`fuchsia.sysmem2/BufferCollectionToken.SetDispensable`],\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`] nodes, and associated\n subtrees of nodes, verbose logging may help in diagnosing what the tree\n looks like and why it\'s failing a logical allocation, or why a tree or\n subtree is failing sooner than expected.\n\n The intent of the extra logging is to be acceptable from a performance\n point of view, under the assumption that verbose logging is only enabled\n on a low number of buffer collections. If we\'re not tracking down a bug,\n we shouldn\'t send this message.\n"]
11928 fn set_verbose_logging(
11929 &mut self,
11930 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11931
11932 #[doc = " This gets a handle that can be used as a parameter to\n [`fuchsia.sysmem2/Node.IsAlternateFor`] called on any\n [`fuchsia.sysmem2/Node`]. This handle is only for use as proof that the\n client obtained this handle from this `Node`.\n\n Because this is a get not a set, no [`fuchsia.sysmem2/Node.Sync`] is\n needed between the `GetNodeRef` and the call to `IsAlternateFor`,\n despite the two calls typically being on different channels.\n\n See also [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n All table fields are currently required.\n\n - response `node_ref` This handle can be sent via `IsAlternateFor` on a\n different `Node` channel, to prove that the client obtained the handle\n from this `Node`.\n"]
11933 fn get_node_ref(
11934 &mut self,
11935
11936 responder: ::fidl_next::Responder<buffer_collection_token_group::GetNodeRef, ___T>,
11937 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11938
11939 #[doc = " Check whether the calling [`fuchsia.sysmem2/Node`] is in a subtree\n rooted at a different child token of a common parent\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`], in relation to the\n passed-in `node_ref`.\n\n This call is for assisting with admission control de-duplication, and\n with debugging.\n\n The `node_ref` must be obtained using\n [`fuchsia.sysmem2/Node.GetNodeRef`].\n\n The `node_ref` can be a duplicated handle; it\'s not necessary to call\n `GetNodeRef` for every call to [`fuchsia.sysmem2/Node.IsAlternateFor`].\n\n If a calling token may not actually be a valid token at all due to a\n potentially hostile/untrusted provider of the token, call\n [`fuchsia.sysmem2/Allocator.ValidateBufferCollectionToken`] first\n instead of potentially getting stuck indefinitely if `IsAlternateFor`\n never responds due to a calling token not being a real token (not really\n talking to sysmem). Another option is to call\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] with this token first\n which also validates the token along with converting it to a\n [`fuchsia.sysmem2/BufferCollection`], then call `IsAlternateFor`.\n\n All table fields are currently required.\n\n - response `is_alternate`\n - true: The first parent node in common between the calling node and\n the `node_ref` `Node` is a `BufferCollectionTokenGroup`. This means\n that the calling `Node` and the `node_ref` `Node` will not have both\n their constraints apply - rather sysmem will choose one or the other\n of the constraints - never both. This is because only one child of\n a `BufferCollectionTokenGroup` is selected during logical\n allocation, with only that one child\'s subtree contributing to\n constraints aggregation.\n - false: The first parent node in common between the calling `Node`\n and the `node_ref` `Node` is not a `BufferCollectionTokenGroup`.\n Currently, this means the first parent node in common is a\n `BufferCollectionToken` or `BufferCollection` (regardless of not\n `Release`ed). This means that the calling `Node` and the `node_ref`\n `Node` may have both their constraints apply during constraints\n aggregation of the logical allocation, if both `Node`(s) are\n selected by any parent `BufferCollectionTokenGroup`(s) involved. In\n this case, there is no `BufferCollectionTokenGroup` that will\n directly prevent the two `Node`(s) from both being selected and\n their constraints both aggregated, but even when false, one or both\n `Node`(s) may still be eliminated from consideration if one or both\n `Node`(s) has a direct or indirect parent\n `BufferCollectionTokenGroup` which selects a child subtree other\n than the subtree containing the calling `Node` or `node_ref` `Node`.\n * error `[fuchsia.sysmem2/Error.NOT_FOUND]` The node_ref wasn\'t\n associated with the same buffer collection as the calling `Node`.\n Another reason for this error is if the `node_ref` is an\n [`zx.Handle.EVENT`] handle with sufficient rights, but isn\'t actually\n a real `node_ref` obtained from `GetNodeRef`.\n * error `[fuchsia.sysmem2/Error.PROTOCOL_DEVIATION]` The caller passed a\n `node_ref` that isn\'t a [`zx.Handle:EVENT`] handle , or doesn\'t have\n the needed rights expected on a real `node_ref`.\n * No other failing status codes are returned by this call. However,\n sysmem may add additional codes in future, so the client should have\n sensible default handling for any failing status code.\n"]
11940 fn is_alternate_for(
11941 &mut self,
11942
11943 request: ::fidl_next::Request<buffer_collection_token_group::IsAlternateFor, ___T>,
11944
11945 responder: ::fidl_next::Responder<buffer_collection_token_group::IsAlternateFor, ___T>,
11946 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11947
11948 #[doc = " Get the buffer collection ID. This ID is also available from\n [`fuchsia.sysmem2/Allocator.GetVmoInfo`] (along with the `buffer_index`\n within the collection).\n\n This call is mainly useful in situations where we can\'t convey a\n [`fuchsia.sysmem2/BufferCollectionToken`] or\n [`fuchsia.sysmem2/BufferCollection`] directly, but can only convey a VMO\n handle, which can be joined back up with a `BufferCollection` client end\n that was created via a different path. Prefer to convey a\n `BufferCollectionToken` or `BufferCollection` directly when feasible.\n\n Trusting a `buffer_collection_id` value from a source other than sysmem\n is analogous to trusting a koid value from a source other than zircon.\n Both should be avoided unless really necessary, and both require\n caution. In some situations it may be reasonable to refer to a\n pre-established `BufferCollection` by `buffer_collection_id` via a\n protocol for efficiency reasons, but an incoming value purporting to be\n a `buffer_collection_id` is not sufficient alone to justify granting the\n sender of the `buffer_collection_id` any capability. The sender must\n first prove to a receiver that the sender has/had a VMO or has/had a\n `BufferCollectionToken` to the same collection by sending a handle that\n sysmem confirms is a valid sysmem handle and which sysmem maps to the\n `buffer_collection_id` value. The receiver should take care to avoid\n assuming that a sender had a `BufferCollectionToken` in cases where the\n sender has only proven that the sender had a VMO.\n\n - response `buffer_collection_id` This ID is unique per buffer\n collection per boot. Each buffer is uniquely identified by the\n `buffer_collection_id` and `buffer_index` together.\n"]
11949 fn get_buffer_collection_id(
11950 &mut self,
11951
11952 responder: ::fidl_next::Responder<
11953 buffer_collection_token_group::GetBufferCollectionId,
11954 ___T,
11955 >,
11956 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11957
11958 #[doc = " Sets the current [`fuchsia.sysmem2/Node`] and all child `Node`(s)\n created after this message to weak, which means that a client\'s `Node`\n client end (or a child created after this message) is not alone\n sufficient to keep allocated VMOs alive.\n\n All VMOs obtained from weak `Node`(s) are weak sysmem VMOs. See also\n `close_weak_asap`.\n\n This message is only permitted before the `Node` becomes ready for\n allocation (else the server closes the channel with `ZX_ERR_BAD_STATE`):\n * `BufferCollectionToken`: any time\n * `BufferCollection`: before `SetConstraints`\n * `BufferCollectionTokenGroup`: before `AllChildrenPresent`\n\n Currently, no conversion from strong `Node` to weak `Node` after ready\n for allocation is provided, but a client can simulate that by creating\n an additional `Node` before allocation and setting that additional\n `Node` to weak, and then potentially at some point later sending\n `Release` and closing the client end of the client\'s strong `Node`, but\n keeping the client\'s weak `Node`.\n\n Zero strong `Node`(s) and zero strong VMO handles will result in buffer\n collection failure (all `Node` client end(s) will see\n `ZX_CHANNEL_PEER_CLOSED` and all `close_weak_asap` `client_end`(s) will\n see `ZX_EVENTPAIR_PEER_CLOSED`), but sysmem (intentionally) won\'t notice\n this situation until all `Node`(s) are ready for allocation. For initial\n allocation to succeed, at least one strong `Node` is required to exist\n at allocation time, but after that client receives VMO handles, that\n client can `BufferCollection.Release` and close the client end without\n causing this type of failure.\n\n This implies [`fuchsia.sysmem2/Node.SetWeakOk`] as well, but does not\n imply `SetWeakOk` with `for_children_also` true, which can be sent\n separately as appropriate.\n"]
11959 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11960
11961 #[doc = " This indicates to sysmem that the client is prepared to pay attention to\n `close_weak_asap`.\n\n If sent, this message must be before\n [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].\n\n All participants using a weak [`fuchsia.sysmem2/BufferCollection`] must\n send this message before `WaitForAllBuffersAllocated`, or a parent\n `Node` must have sent [`fuchsia.sysmem2/Node.SetWeakOk`] with\n `for_child_nodes_also` true, else the `WaitForAllBuffersAllocated` will\n trigger buffer collection failure.\n\n This message is necessary because weak sysmem VMOs have not always been\n a thing, so older clients are not aware of the need to pay attention to\n `close_weak_asap` `ZX_EVENTPAIR_PEER_CLOSED` and close all remaining\n sysmem weak VMO handles asap. By having this message and requiring\n participants to indicate their acceptance of this aspect of the overall\n protocol, we avoid situations where an older client is delivered a weak\n VMO without any way for sysmem to get that VMO to close quickly later\n (and on a per-buffer basis).\n\n A participant that doesn\'t handle `close_weak_asap` and also doesn\'t\n retrieve any VMO handles via `WaitForAllBuffersAllocated` doesn\'t need\n to send `SetWeakOk` (and doesn\'t need to have a parent `Node` send\n `SetWeakOk` with `for_child_nodes_also` true either). However, if that\n same participant has a child/delegate which does retrieve VMOs, that\n child/delegate will need to send `SetWeakOk` before\n `WaitForAllBuffersAllocated`.\n\n + request `for_child_nodes_also` If present and true, this means direct\n child nodes of this node created after this message plus all\n descendants of those nodes will behave as if `SetWeakOk` was sent on\n those nodes. Any child node of this node that was created before this\n message is not included. This setting is \"sticky\" in the sense that a\n subsequent `SetWeakOk` without this bool set to true does not reset\n the server-side bool. If this creates a problem for a participant, a\n workaround is to `SetWeakOk` with `for_child_nodes_also` true on child\n tokens instead, as appropriate. A participant should only set\n `for_child_nodes_also` true if the participant can really promise to\n obey `close_weak_asap` both for its own weak VMO handles, and for all\n weak VMO handles held by participants holding the corresponding child\n `Node`(s). When `for_child_nodes_also` is set, descendent `Node`(s)\n which are using sysmem(1) can be weak, despite the clients of those\n sysmem1 `Node`(s) not having any direct way to `SetWeakOk` or any\n direct way to find out about `close_weak_asap`. This only applies to\n descendents of this `Node` which are using sysmem(1), not to this\n `Node` when converted directly from a sysmem2 token to a sysmem(1)\n token, which will fail allocation unless an ancestor of this `Node`\n specified `for_child_nodes_also` true.\n"]
11962 fn set_weak_ok(
11963 &mut self,
11964
11965 request: ::fidl_next::Request<buffer_collection_token_group::SetWeakOk, ___T>,
11966 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11967
11968 #[doc = " The server_end will be closed after this `Node` and any child nodes have\n have released their buffer counts, making those counts available for\n reservation by a different `Node` via\n [`fuchsia.sysmem2/BufferCollection.AttachToken`].\n\n The `Node` buffer counts may not be released until the entire tree of\n `Node`(s) is closed or failed, because\n [`fuchsia.sysmem2/BufferCollection.Release`] followed by channel close\n does not immediately un-reserve the `Node` buffer counts. Instead, the\n `Node` buffer counts remain reserved until the orphaned node is later\n cleaned up.\n\n If the `Node` exceeds a fairly large number of attached eventpair server\n ends, a log message will indicate this and the `Node` (and the\n appropriate) sub-tree will fail.\n\n The `server_end` will remain open when\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`] converts a\n [`fuchsia.sysmem2/BufferCollectionToken`] into a\n [`fuchsia.sysmem2/BufferCollection`].\n\n This message can also be used with a\n [`fuchsia.sysmem2/BufferCollectionTokenGroup`].\n"]
11969 fn attach_node_tracking(
11970 &mut self,
11971
11972 request: ::fidl_next::Request<buffer_collection_token_group::AttachNodeTracking, ___T>,
11973 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11974
11975 #[doc = " Create a child [`fuchsia.sysmem2/BufferCollectionToken`]. Only one child\n (including its children) will be selected during allocation (or logical\n allocation).\n\n Before passing the client end of this token to\n [`fuchsia.sysmem2/Allocator.BindSharedCollection`], completion of\n [`fuchsia.sysmem2/Node.Sync`] after\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`] is required.\n Or the client can use\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChildrenSync`] which\n essentially includes the `Sync`.\n\n Sending CreateChild after AllChildrenPresent is not permitted; this will\n fail the group\'s subtree and close the connection.\n\n After all children have been created, send AllChildrenPresent.\n\n + request `token_request` The server end of the new token channel.\n + request `rights_attenuation_mask` If ZX_RIGHT_SAME_RIGHTS, the created\n token allows the holder to get the same rights to buffers as the\n parent token (of the group) had. When the value isn\'t\n ZX_RIGHT_SAME_RIGHTS, the value is interpretted as a bitmask with 0\n bits ensuring those rights are attentuated, so 0xFFFFFFFF is a synonym\n for ZX_RIGHT_SAME_RIGHTS. The value 0 is not allowed and intentionally\n causes subtree failure.\n"]
11976 fn create_child(
11977 &mut self,
11978
11979 request: ::fidl_next::Request<buffer_collection_token_group::CreateChild, ___T>,
11980 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11981
11982 #[doc = " Create 1 or more child tokens at once, synchronously. In contrast to\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`], no\n [`fuchsia.sysmem2/Node.Sync`] is required before passing the client end\n of a returned token to\n [`fuchsia.sysmem2/Allocator/BindSharedCollection`].\n\n The lower-index child tokens are higher priority (attempted sooner) than\n higher-index child tokens.\n\n As per all child tokens, successful aggregation will choose exactly one\n child among all created children (across all children created across\n potentially multiple calls to\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChild`] and\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChildrenSync`]).\n\n The maximum permissible total number of children per group, and total\n number of nodes in an overall tree (from the root) are capped to limits\n which are not configurable via these protocols.\n\n Sending CreateChildrenSync after AllChildrenPresent is not permitted;\n this will fail the group\'s subtree and close the connection.\n\n After all children have been created, send AllChildrenPresent.\n\n + request `rights_attentuation_masks` The size of the\n `rights_attentuation_masks` determines the number of created child\n tokens. The value ZX_RIGHT_SAME_RIGHTS doesn\'t attenuate any rights.\n The value 0xFFFFFFFF is a synonym for ZX_RIGHT_SAME_RIGHTS. For any\n other value, each 0 bit in the mask attenuates that right.\n - response `tokens` The created child tokens.\n"]
11983 fn create_children_sync(
11984 &mut self,
11985
11986 request: ::fidl_next::Request<buffer_collection_token_group::CreateChildrenSync, ___T>,
11987
11988 responder: ::fidl_next::Responder<buffer_collection_token_group::CreateChildrenSync, ___T>,
11989 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11990
11991 #[doc = " Indicate that no more children will be created.\n\n After creating all children, the client should send\n [`fuchsia.sysmem2/BufferCollectionTokenGroup.AllChildrenPresent`] to\n inform sysmem that no more children will be created, so that sysmem can\n know when it\'s ok to start aggregating constraints.\n\n Sending CreateChild after AllChildrenPresent is not permitted; this will\n fail the group\'s subtree and close the connection.\n\n If [`fuchsia.sysmem2/Node.Release`] is to be sent, it should be sent\n after `AllChildrenPresent`, else failure of the group\'s subtree will be\n triggered. This is intentionally not analogous to how `Release` without\n prior [`fuchsia.sysmem2/BufferCollection.SetConstraints`] doesn\'t cause\n subtree failure.\n"]
11992 fn all_children_present(
11993 &mut self,
11994 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11995
11996 fn on_unknown_interaction(
11997 &mut self,
11998 ordinal: u64,
11999 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
12000 ::core::future::ready(())
12001 }
12002}
12003
12004impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for BufferCollectionTokenGroup
12005where
12006 ___H: BufferCollectionTokenGroupServerHandler<___T> + ::core::marker::Send,
12007 ___T: ::fidl_next::Transport,
12008
12009
12010
12011
12012
12013
12014 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
12015 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
12016 Constraint = (),
12017 >,
12018
12019
12020
12021 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
12022 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
12023 Constraint = (),
12024 >,
12025
12026
12027
12028 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
12029 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
12030 Constraint = (),
12031 >,
12032
12033
12034
12035
12036
12037
12038
12039 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
12040 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
12041 Constraint = (),
12042 >,
12043
12044
12045
12046
12047
12048
12049
12050 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
12051 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
12052 Constraint = (),
12053 >,
12054
12055
12056
12057 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
12058 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
12059 Constraint = (),
12060 >,
12061
12062
12063
12064 for<'de> crate::wire::BufferCollectionTokenGroupCreateChildRequest<'de>: ::fidl_next::Decode<
12065 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
12066 Constraint = (),
12067 >,
12068
12069
12070
12071 for<'de> crate::wire::BufferCollectionTokenGroupCreateChildrenSyncRequest<'de>: ::fidl_next::Decode<
12072 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
12073 Constraint = (),
12074 >,
12075
12076
12077
12078
12079{
12080 async fn on_one_way(
12081 handler: &mut ___H,
12082 mut message: ::fidl_next::Message<___T>,
12083 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
12084 match *message.header().ordinal {
12085
12086
12087
12088
12089
12090
12091 7664192519607813318 => {
12092
12093 handler.release().await;
12094 Ok(())
12095
12096 }
12097
12098
12099
12100
12101 811194812442657257 => {
12102
12103 match ::fidl_next::AsDecoderExt::into_decoded(message) {
12104 Ok(decoded) => {
12105 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
12106 Ok(())
12107 }
12108 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
12109 ordinal: 811194812442657257,
12110 error,
12111 }),
12112 }
12113
12114 }
12115
12116
12117
12118
12119 6691936816931379633 => {
12120
12121 match ::fidl_next::AsDecoderExt::into_decoded(message) {
12122 Ok(decoded) => {
12123 handler.set_debug_client_info(::fidl_next::Request::from_decoded(decoded)).await;
12124 Ok(())
12125 }
12126 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
12127 ordinal: 6691936816931379633,
12128 error,
12129 }),
12130 }
12131
12132 }
12133
12134
12135
12136
12137 8172637980026734598 => {
12138
12139 match ::fidl_next::AsDecoderExt::into_decoded(message) {
12140 Ok(decoded) => {
12141 handler.set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded)).await;
12142 Ok(())
12143 }
12144 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
12145 ordinal: 8172637980026734598,
12146 error,
12147 }),
12148 }
12149
12150 }
12151
12152
12153
12154
12155 5911475287294795693 => {
12156
12157 handler.set_verbose_logging().await;
12158 Ok(())
12159
12160 }
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174 2512233045884338145 => {
12175
12176 handler.set_weak().await;
12177 Ok(())
12178
12179 }
12180
12181
12182
12183
12184 4081474869151288297 => {
12185
12186 match ::fidl_next::AsDecoderExt::into_decoded(message) {
12187 Ok(decoded) => {
12188 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
12189 Ok(())
12190 }
12191 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
12192 ordinal: 4081474869151288297,
12193 error,
12194 }),
12195 }
12196
12197 }
12198
12199
12200
12201
12202 4549465353676377516 => {
12203
12204 match ::fidl_next::AsDecoderExt::into_decoded(message) {
12205 Ok(decoded) => {
12206 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
12207 Ok(())
12208 }
12209 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
12210 ordinal: 4549465353676377516,
12211 error,
12212 }),
12213 }
12214
12215 }
12216
12217
12218
12219
12220 4728787705853325509 => {
12221
12222 match ::fidl_next::AsDecoderExt::into_decoded(message) {
12223 Ok(decoded) => {
12224 handler.create_child(::fidl_next::Request::from_decoded(decoded)).await;
12225 Ok(())
12226 }
12227 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
12228 ordinal: 4728787705853325509,
12229 error,
12230 }),
12231 }
12232
12233 }
12234
12235
12236
12237
12238
12239
12240
12241 6643511257208525586 => {
12242
12243 handler.all_children_present().await;
12244 Ok(())
12245
12246 }
12247
12248
12249 ordinal => {
12250
12251 handler.on_unknown_interaction(ordinal).await;
12252 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
12253 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
12254 } else {
12255 Ok(())
12256 }
12257
12258 }
12259 }
12260 }
12261
12262 async fn on_two_way(
12263 handler: &mut ___H,
12264 mut message: ::fidl_next::Message<___T>,
12265 responder: ::fidl_next::protocol::Responder<___T>,
12266 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
12267 match *message.header().ordinal {
12268
12269
12270
12271 1273433845120064340 => {
12272 let responder = ::fidl_next::Responder::from_untyped(responder);
12273
12274 handler.sync(responder).await;
12275 Ok(())
12276
12277 }
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297 6574426773718429779 => {
12298 let responder = ::fidl_next::Responder::from_untyped(responder);
12299
12300 handler.get_node_ref(responder).await;
12301 Ok(())
12302
12303 }
12304
12305
12306
12307
12308 262772284282767397 => {
12309 let responder = ::fidl_next::Responder::from_untyped(responder);
12310
12311 match ::fidl_next::AsDecoderExt::into_decoded(message) {
12312 Ok(decoded) => {
12313 handler.is_alternate_for(::fidl_next::Request::from_decoded(decoded), responder).await;
12314 Ok(())
12315 }
12316 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
12317 ordinal: 262772284282767397,
12318 error,
12319 }),
12320 }
12321
12322 }
12323
12324
12325
12326
12327 8633851600235444876 => {
12328 let responder = ::fidl_next::Responder::from_untyped(responder);
12329
12330 handler.get_buffer_collection_id(responder).await;
12331 Ok(())
12332
12333 }
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350 1575877552079505162 => {
12351 let responder = ::fidl_next::Responder::from_untyped(responder);
12352
12353 match ::fidl_next::AsDecoderExt::into_decoded(message) {
12354 Ok(decoded) => {
12355 handler.create_children_sync(::fidl_next::Request::from_decoded(decoded), responder).await;
12356 Ok(())
12357 }
12358 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
12359 ordinal: 1575877552079505162,
12360 error,
12361 }),
12362 }
12363
12364 }
12365
12366
12367
12368
12369
12370 ordinal => {
12371
12372 handler.on_unknown_interaction(ordinal).await;
12373 if ::core::matches!(message.header().flexibility(), ::fidl_next::protocol::Flexibility::Strict) {
12374 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
12375 } else {
12376 responder.respond_framework_error(
12377 ordinal,
12378 ::fidl_next::FrameworkError::UnknownMethod,
12379 )
12380 .expect("encoding a framework error should never fail")
12381 .await?;
12382 Ok(())
12383 }
12384
12385 }
12386 }
12387 }
12388}
12389
12390impl<___T> BufferCollectionTokenGroupClientHandler<___T> for ::fidl_next::IgnoreEvents
12391where
12392 ___T: ::fidl_next::Transport,
12393{
12394 async fn on_unknown_interaction(&mut self, _: u64) {}
12395}
12396
12397impl<___H, ___T> BufferCollectionTokenGroupLocalClientHandler<___T> for ::fidl_next::Local<___H>
12398where
12399 ___H: BufferCollectionTokenGroupClientHandler<___T>,
12400 ___T: ::fidl_next::Transport,
12401{
12402 async fn on_unknown_interaction(&mut self, ordinal: u64) {
12403 ___H::on_unknown_interaction(&mut self.0, ordinal).await
12404 }
12405}
12406
12407impl<___H, ___T> BufferCollectionTokenGroupLocalServerHandler<___T> for ::fidl_next::Local<___H>
12408where
12409 ___H: BufferCollectionTokenGroupServerHandler<___T>,
12410 ___T: ::fidl_next::Transport,
12411{
12412 async fn sync(
12413 &mut self,
12414
12415 responder: ::fidl_next::Responder<buffer_collection_token_group::Sync, ___T>,
12416 ) {
12417 ___H::sync(&mut self.0, responder).await
12418 }
12419
12420 async fn release(&mut self) {
12421 ___H::release(&mut self.0).await
12422 }
12423
12424 async fn set_name(
12425 &mut self,
12426
12427 request: ::fidl_next::Request<buffer_collection_token_group::SetName, ___T>,
12428 ) {
12429 ___H::set_name(&mut self.0, request).await
12430 }
12431
12432 async fn set_debug_client_info(
12433 &mut self,
12434
12435 request: ::fidl_next::Request<buffer_collection_token_group::SetDebugClientInfo, ___T>,
12436 ) {
12437 ___H::set_debug_client_info(&mut self.0, request).await
12438 }
12439
12440 async fn set_debug_timeout_log_deadline(
12441 &mut self,
12442
12443 request: ::fidl_next::Request<
12444 buffer_collection_token_group::SetDebugTimeoutLogDeadline,
12445 ___T,
12446 >,
12447 ) {
12448 ___H::set_debug_timeout_log_deadline(&mut self.0, request).await
12449 }
12450
12451 async fn set_verbose_logging(&mut self) {
12452 ___H::set_verbose_logging(&mut self.0).await
12453 }
12454
12455 async fn get_node_ref(
12456 &mut self,
12457
12458 responder: ::fidl_next::Responder<buffer_collection_token_group::GetNodeRef, ___T>,
12459 ) {
12460 ___H::get_node_ref(&mut self.0, responder).await
12461 }
12462
12463 async fn is_alternate_for(
12464 &mut self,
12465
12466 request: ::fidl_next::Request<buffer_collection_token_group::IsAlternateFor, ___T>,
12467
12468 responder: ::fidl_next::Responder<buffer_collection_token_group::IsAlternateFor, ___T>,
12469 ) {
12470 ___H::is_alternate_for(&mut self.0, request, responder).await
12471 }
12472
12473 async fn get_buffer_collection_id(
12474 &mut self,
12475
12476 responder: ::fidl_next::Responder<
12477 buffer_collection_token_group::GetBufferCollectionId,
12478 ___T,
12479 >,
12480 ) {
12481 ___H::get_buffer_collection_id(&mut self.0, responder).await
12482 }
12483
12484 async fn set_weak(&mut self) {
12485 ___H::set_weak(&mut self.0).await
12486 }
12487
12488 async fn set_weak_ok(
12489 &mut self,
12490
12491 request: ::fidl_next::Request<buffer_collection_token_group::SetWeakOk, ___T>,
12492 ) {
12493 ___H::set_weak_ok(&mut self.0, request).await
12494 }
12495
12496 async fn attach_node_tracking(
12497 &mut self,
12498
12499 request: ::fidl_next::Request<buffer_collection_token_group::AttachNodeTracking, ___T>,
12500 ) {
12501 ___H::attach_node_tracking(&mut self.0, request).await
12502 }
12503
12504 async fn create_child(
12505 &mut self,
12506
12507 request: ::fidl_next::Request<buffer_collection_token_group::CreateChild, ___T>,
12508 ) {
12509 ___H::create_child(&mut self.0, request).await
12510 }
12511
12512 async fn create_children_sync(
12513 &mut self,
12514
12515 request: ::fidl_next::Request<buffer_collection_token_group::CreateChildrenSync, ___T>,
12516
12517 responder: ::fidl_next::Responder<buffer_collection_token_group::CreateChildrenSync, ___T>,
12518 ) {
12519 ___H::create_children_sync(&mut self.0, request, responder).await
12520 }
12521
12522 async fn all_children_present(&mut self) {
12523 ___H::all_children_present(&mut self.0).await
12524 }
12525
12526 async fn on_unknown_interaction(&mut self, ordinal: u64) {
12527 ___H::on_unknown_interaction(&mut self.0, ordinal).await
12528 }
12529}
12530
12531pub use fidl_next_common_fuchsia_sysmem2::*;