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 AllocatorGetVmoInfoRequest {
11 pub vmo: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
12 }
13
14 impl AllocatorGetVmoInfoRequest {
15 fn __max_ordinal(&self) -> usize {
16 if self.vmo.is_some() {
17 return 1;
18 }
19
20 0
21 }
22 }
23
24 unsafe impl<___E> ::fidl_next::Encode<crate::wire::AllocatorGetVmoInfoRequest<'static>, ___E>
25 for AllocatorGetVmoInfoRequest
26 where
27 ___E: ::fidl_next::Encoder + ?Sized,
28 ___E: ::fidl_next::fuchsia::HandleEncoder,
29 {
30 #[inline]
31 fn encode(
32 mut self,
33 encoder: &mut ___E,
34 out: &mut ::core::mem::MaybeUninit<crate::wire::AllocatorGetVmoInfoRequest<'static>>,
35 _: (),
36 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
37 ::fidl_next::munge!(let crate::wire::AllocatorGetVmoInfoRequest { table } = out);
38
39 let max_ord = self.__max_ordinal();
40
41 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
42 ::fidl_next::Wire::zero_padding(&mut out);
43
44 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
45 ::fidl_next::wire::Envelope,
46 >(encoder, max_ord);
47
48 for i in 1..=max_ord {
49 match i {
50 1 => {
51 if let Some(value) = self.vmo.take() {
52 ::fidl_next::wire::Envelope::encode_value::<
53 ::fidl_next::wire::fuchsia::Vmo,
54 ___E,
55 >(
56 value, preallocated.encoder, &mut out, ()
57 )?;
58 } else {
59 ::fidl_next::wire::Envelope::encode_zero(&mut out)
60 }
61 }
62
63 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
64 }
65 unsafe {
66 preallocated.write_next(out.assume_init_ref());
67 }
68 }
69
70 ::fidl_next::wire::Table::encode_len(table, max_ord);
71
72 Ok(())
73 }
74 }
75
76 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorGetVmoInfoRequest<'de>>
77 for AllocatorGetVmoInfoRequest
78 {
79 #[inline]
80 fn from_wire(wire_: crate::wire::AllocatorGetVmoInfoRequest<'de>) -> Self {
81 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
82
83 let vmo = wire_.table.get(1);
84
85 Self {
86 vmo: vmo.map(|envelope| {
87 ::fidl_next::FromWire::from_wire(unsafe {
88 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
89 })
90 }),
91 }
92 }
93 }
94
95 #[derive(Debug, Default, PartialEq)]
96 pub struct AllocatorGetVmoInfoResponse {
97 pub buffer_collection_id: ::core::option::Option<u64>,
98
99 pub buffer_index: ::core::option::Option<u64>,
100
101 pub close_weak_asap: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
102 }
103
104 impl AllocatorGetVmoInfoResponse {
105 fn __max_ordinal(&self) -> usize {
106 if self.close_weak_asap.is_some() {
107 return 3;
108 }
109
110 if self.buffer_index.is_some() {
111 return 2;
112 }
113
114 if self.buffer_collection_id.is_some() {
115 return 1;
116 }
117
118 0
119 }
120 }
121
122 unsafe impl<___E> ::fidl_next::Encode<crate::wire::AllocatorGetVmoInfoResponse<'static>, ___E>
123 for AllocatorGetVmoInfoResponse
124 where
125 ___E: ::fidl_next::Encoder + ?Sized,
126 ___E: ::fidl_next::fuchsia::HandleEncoder,
127 {
128 #[inline]
129 fn encode(
130 mut self,
131 encoder: &mut ___E,
132 out: &mut ::core::mem::MaybeUninit<crate::wire::AllocatorGetVmoInfoResponse<'static>>,
133 _: (),
134 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
135 ::fidl_next::munge!(let crate::wire::AllocatorGetVmoInfoResponse { table } = out);
136
137 let max_ord = self.__max_ordinal();
138
139 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
140 ::fidl_next::Wire::zero_padding(&mut out);
141
142 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
143 ::fidl_next::wire::Envelope,
144 >(encoder, max_ord);
145
146 for i in 1..=max_ord {
147 match i {
148 3 => {
149 if let Some(value) = self.close_weak_asap.take() {
150 ::fidl_next::wire::Envelope::encode_value::<
151 ::fidl_next::wire::fuchsia::EventPair,
152 ___E,
153 >(
154 value, preallocated.encoder, &mut out, ()
155 )?;
156 } else {
157 ::fidl_next::wire::Envelope::encode_zero(&mut out)
158 }
159 }
160
161 2 => {
162 if let Some(value) = self.buffer_index.take() {
163 ::fidl_next::wire::Envelope::encode_value::<
164 ::fidl_next::wire::Uint64,
165 ___E,
166 >(
167 value, preallocated.encoder, &mut out, ()
168 )?;
169 } else {
170 ::fidl_next::wire::Envelope::encode_zero(&mut out)
171 }
172 }
173
174 1 => {
175 if let Some(value) = self.buffer_collection_id.take() {
176 ::fidl_next::wire::Envelope::encode_value::<
177 ::fidl_next::wire::Uint64,
178 ___E,
179 >(
180 value, preallocated.encoder, &mut out, ()
181 )?;
182 } else {
183 ::fidl_next::wire::Envelope::encode_zero(&mut out)
184 }
185 }
186
187 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
188 }
189 unsafe {
190 preallocated.write_next(out.assume_init_ref());
191 }
192 }
193
194 ::fidl_next::wire::Table::encode_len(table, max_ord);
195
196 Ok(())
197 }
198 }
199
200 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorGetVmoInfoResponse<'de>>
201 for AllocatorGetVmoInfoResponse
202 {
203 #[inline]
204 fn from_wire(wire_: crate::wire::AllocatorGetVmoInfoResponse<'de>) -> Self {
205 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
206
207 let buffer_collection_id = wire_.table.get(1);
208
209 let buffer_index = wire_.table.get(2);
210
211 let close_weak_asap = wire_.table.get(3);
212
213 Self {
214 buffer_collection_id: buffer_collection_id.map(|envelope| {
215 ::fidl_next::FromWire::from_wire(unsafe {
216 envelope.read_unchecked::<::fidl_next::wire::Uint64>()
217 })
218 }),
219
220 buffer_index: buffer_index.map(|envelope| {
221 ::fidl_next::FromWire::from_wire(unsafe {
222 envelope.read_unchecked::<::fidl_next::wire::Uint64>()
223 })
224 }),
225
226 close_weak_asap: close_weak_asap.map(|envelope| {
227 ::fidl_next::FromWire::from_wire(unsafe {
228 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
229 })
230 }),
231 }
232 }
233 }
234
235 #[derive(Debug, Default, PartialEq)]
236 pub struct AllocatorAllocateSharedCollectionRequest {
237 pub token_request: ::core::option::Option<
238 ::fidl_next::ServerEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
239 >,
240 }
241
242 impl AllocatorAllocateSharedCollectionRequest {
243 fn __max_ordinal(&self) -> usize {
244 if self.token_request.is_some() {
245 return 1;
246 }
247
248 0
249 }
250 }
251
252 unsafe impl<___E>
253 ::fidl_next::Encode<crate::wire::AllocatorAllocateSharedCollectionRequest<'static>, ___E>
254 for AllocatorAllocateSharedCollectionRequest
255 where
256 ___E: ::fidl_next::Encoder + ?Sized,
257 ___E: ::fidl_next::fuchsia::HandleEncoder,
258 {
259 #[inline]
260 fn encode(
261 mut self,
262 encoder: &mut ___E,
263 out: &mut ::core::mem::MaybeUninit<
264 crate::wire::AllocatorAllocateSharedCollectionRequest<'static>,
265 >,
266 _: (),
267 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
268 ::fidl_next::munge!(let crate::wire::AllocatorAllocateSharedCollectionRequest { table } = out);
269
270 let max_ord = self.__max_ordinal();
271
272 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
273 ::fidl_next::Wire::zero_padding(&mut out);
274
275 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
276 ::fidl_next::wire::Envelope,
277 >(encoder, max_ord);
278
279 for i in 1..=max_ord {
280 match i {
281 1 => {
282 if let Some(value) = self.token_request.take() {
283 ::fidl_next::wire::Envelope::encode_value::<
284 ::fidl_next::ServerEnd<
285 crate::BufferCollectionToken,
286 ::fidl_next::wire::fuchsia::Channel,
287 >,
288 ___E,
289 >(
290 value, preallocated.encoder, &mut out, ()
291 )?;
292 } else {
293 ::fidl_next::wire::Envelope::encode_zero(&mut out)
294 }
295 }
296
297 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
298 }
299 unsafe {
300 preallocated.write_next(out.assume_init_ref());
301 }
302 }
303
304 ::fidl_next::wire::Table::encode_len(table, max_ord);
305
306 Ok(())
307 }
308 }
309
310 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorAllocateSharedCollectionRequest<'de>>
311 for AllocatorAllocateSharedCollectionRequest
312 {
313 #[inline]
314 fn from_wire(wire_: crate::wire::AllocatorAllocateSharedCollectionRequest<'de>) -> Self {
315 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
316
317 let token_request = wire_.table.get(1);
318
319 Self {
320 token_request: token_request.map(|envelope| {
321 ::fidl_next::FromWire::from_wire(unsafe {
322 envelope.read_unchecked::<::fidl_next::ServerEnd<
323 crate::BufferCollectionToken,
324 ::fidl_next::wire::fuchsia::Channel,
325 >>()
326 })
327 }),
328 }
329 }
330 }
331
332 #[derive(Debug, Default, PartialEq)]
333 pub struct AllocatorAllocateNonSharedCollectionRequest {
334 pub collection_request: ::core::option::Option<
335 ::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::fuchsia::zx::Channel>,
336 >,
337 }
338
339 impl AllocatorAllocateNonSharedCollectionRequest {
340 fn __max_ordinal(&self) -> usize {
341 if self.collection_request.is_some() {
342 return 1;
343 }
344
345 0
346 }
347 }
348
349 unsafe impl<___E>
350 ::fidl_next::Encode<crate::wire::AllocatorAllocateNonSharedCollectionRequest<'static>, ___E>
351 for AllocatorAllocateNonSharedCollectionRequest
352 where
353 ___E: ::fidl_next::Encoder + ?Sized,
354 ___E: ::fidl_next::fuchsia::HandleEncoder,
355 {
356 #[inline]
357 fn encode(
358 mut self,
359 encoder: &mut ___E,
360 out: &mut ::core::mem::MaybeUninit<
361 crate::wire::AllocatorAllocateNonSharedCollectionRequest<'static>,
362 >,
363 _: (),
364 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
365 ::fidl_next::munge!(let crate::wire::AllocatorAllocateNonSharedCollectionRequest { table } = out);
366
367 let max_ord = self.__max_ordinal();
368
369 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
370 ::fidl_next::Wire::zero_padding(&mut out);
371
372 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
373 ::fidl_next::wire::Envelope,
374 >(encoder, max_ord);
375
376 for i in 1..=max_ord {
377 match i {
378 1 => {
379 if let Some(value) = self.collection_request.take() {
380 ::fidl_next::wire::Envelope::encode_value::<
381 ::fidl_next::ServerEnd<
382 crate::BufferCollection,
383 ::fidl_next::wire::fuchsia::Channel,
384 >,
385 ___E,
386 >(
387 value, preallocated.encoder, &mut out, ()
388 )?;
389 } else {
390 ::fidl_next::wire::Envelope::encode_zero(&mut out)
391 }
392 }
393
394 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
395 }
396 unsafe {
397 preallocated.write_next(out.assume_init_ref());
398 }
399 }
400
401 ::fidl_next::wire::Table::encode_len(table, max_ord);
402
403 Ok(())
404 }
405 }
406
407 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorAllocateNonSharedCollectionRequest<'de>>
408 for AllocatorAllocateNonSharedCollectionRequest
409 {
410 #[inline]
411 fn from_wire(wire_: crate::wire::AllocatorAllocateNonSharedCollectionRequest<'de>) -> Self {
412 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
413
414 let collection_request = wire_.table.get(1);
415
416 Self {
417 collection_request: collection_request.map(|envelope| {
418 ::fidl_next::FromWire::from_wire(unsafe {
419 envelope.read_unchecked::<::fidl_next::ServerEnd<
420 crate::BufferCollection,
421 ::fidl_next::wire::fuchsia::Channel,
422 >>()
423 })
424 }),
425 }
426 }
427 }
428
429 #[derive(Debug, Default, PartialEq)]
430 pub struct AllocatorBindSharedCollectionRequest {
431 pub token: ::core::option::Option<
432 ::fidl_next::ClientEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
433 >,
434
435 pub buffer_collection_request: ::core::option::Option<
436 ::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::fuchsia::zx::Channel>,
437 >,
438 }
439
440 impl AllocatorBindSharedCollectionRequest {
441 fn __max_ordinal(&self) -> usize {
442 if self.buffer_collection_request.is_some() {
443 return 2;
444 }
445
446 if self.token.is_some() {
447 return 1;
448 }
449
450 0
451 }
452 }
453
454 unsafe impl<___E>
455 ::fidl_next::Encode<crate::wire::AllocatorBindSharedCollectionRequest<'static>, ___E>
456 for AllocatorBindSharedCollectionRequest
457 where
458 ___E: ::fidl_next::Encoder + ?Sized,
459 ___E: ::fidl_next::fuchsia::HandleEncoder,
460 {
461 #[inline]
462 fn encode(
463 mut self,
464 encoder: &mut ___E,
465 out: &mut ::core::mem::MaybeUninit<
466 crate::wire::AllocatorBindSharedCollectionRequest<'static>,
467 >,
468 _: (),
469 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
470 ::fidl_next::munge!(let crate::wire::AllocatorBindSharedCollectionRequest { table } = out);
471
472 let max_ord = self.__max_ordinal();
473
474 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
475 ::fidl_next::Wire::zero_padding(&mut out);
476
477 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
478 ::fidl_next::wire::Envelope,
479 >(encoder, max_ord);
480
481 for i in 1..=max_ord {
482 match i {
483 2 => {
484 if let Some(value) = self.buffer_collection_request.take() {
485 ::fidl_next::wire::Envelope::encode_value::<
486 ::fidl_next::ServerEnd<
487 crate::BufferCollection,
488 ::fidl_next::wire::fuchsia::Channel,
489 >,
490 ___E,
491 >(
492 value, preallocated.encoder, &mut out, ()
493 )?;
494 } else {
495 ::fidl_next::wire::Envelope::encode_zero(&mut out)
496 }
497 }
498
499 1 => {
500 if let Some(value) = self.token.take() {
501 ::fidl_next::wire::Envelope::encode_value::<
502 ::fidl_next::ClientEnd<
503 crate::BufferCollectionToken,
504 ::fidl_next::wire::fuchsia::Channel,
505 >,
506 ___E,
507 >(
508 value, preallocated.encoder, &mut out, ()
509 )?;
510 } else {
511 ::fidl_next::wire::Envelope::encode_zero(&mut out)
512 }
513 }
514
515 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
516 }
517 unsafe {
518 preallocated.write_next(out.assume_init_ref());
519 }
520 }
521
522 ::fidl_next::wire::Table::encode_len(table, max_ord);
523
524 Ok(())
525 }
526 }
527
528 impl<'de> ::fidl_next::FromWire<crate::wire::AllocatorBindSharedCollectionRequest<'de>>
529 for AllocatorBindSharedCollectionRequest
530 {
531 #[inline]
532 fn from_wire(wire_: crate::wire::AllocatorBindSharedCollectionRequest<'de>) -> Self {
533 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
534
535 let token = wire_.table.get(1);
536
537 let buffer_collection_request = wire_.table.get(2);
538
539 Self {
540 token: token.map(|envelope| {
541 ::fidl_next::FromWire::from_wire(unsafe {
542 envelope.read_unchecked::<::fidl_next::ClientEnd<
543 crate::BufferCollectionToken,
544 ::fidl_next::wire::fuchsia::Channel,
545 >>()
546 })
547 }),
548
549 buffer_collection_request: buffer_collection_request.map(|envelope| {
550 ::fidl_next::FromWire::from_wire(unsafe {
551 envelope.read_unchecked::<::fidl_next::ServerEnd<
552 crate::BufferCollection,
553 ::fidl_next::wire::fuchsia::Channel,
554 >>()
555 })
556 }),
557 }
558 }
559 }
560
561 #[derive(Debug, Default, PartialEq)]
562 pub struct NodeGetNodeRefResponse {
563 pub node_ref: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
564 }
565
566 impl NodeGetNodeRefResponse {
567 fn __max_ordinal(&self) -> usize {
568 if self.node_ref.is_some() {
569 return 1;
570 }
571
572 0
573 }
574 }
575
576 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeGetNodeRefResponse<'static>, ___E>
577 for NodeGetNodeRefResponse
578 where
579 ___E: ::fidl_next::Encoder + ?Sized,
580 ___E: ::fidl_next::fuchsia::HandleEncoder,
581 {
582 #[inline]
583 fn encode(
584 mut self,
585 encoder: &mut ___E,
586 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeGetNodeRefResponse<'static>>,
587 _: (),
588 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
589 ::fidl_next::munge!(let crate::wire::NodeGetNodeRefResponse { table } = out);
590
591 let max_ord = self.__max_ordinal();
592
593 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
594 ::fidl_next::Wire::zero_padding(&mut out);
595
596 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
597 ::fidl_next::wire::Envelope,
598 >(encoder, max_ord);
599
600 for i in 1..=max_ord {
601 match i {
602 1 => {
603 if let Some(value) = self.node_ref.take() {
604 ::fidl_next::wire::Envelope::encode_value::<
605 ::fidl_next::wire::fuchsia::Event,
606 ___E,
607 >(
608 value, preallocated.encoder, &mut out, ()
609 )?;
610 } else {
611 ::fidl_next::wire::Envelope::encode_zero(&mut out)
612 }
613 }
614
615 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
616 }
617 unsafe {
618 preallocated.write_next(out.assume_init_ref());
619 }
620 }
621
622 ::fidl_next::wire::Table::encode_len(table, max_ord);
623
624 Ok(())
625 }
626 }
627
628 impl<'de> ::fidl_next::FromWire<crate::wire::NodeGetNodeRefResponse<'de>>
629 for NodeGetNodeRefResponse
630 {
631 #[inline]
632 fn from_wire(wire_: crate::wire::NodeGetNodeRefResponse<'de>) -> Self {
633 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
634
635 let node_ref = wire_.table.get(1);
636
637 Self {
638 node_ref: node_ref.map(|envelope| {
639 ::fidl_next::FromWire::from_wire(unsafe {
640 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
641 })
642 }),
643 }
644 }
645 }
646
647 #[derive(Debug, Default, PartialEq)]
648 pub struct NodeIsAlternateForRequest {
649 pub node_ref: ::core::option::Option<::fidl_next::fuchsia::zx::Event>,
650 }
651
652 impl NodeIsAlternateForRequest {
653 fn __max_ordinal(&self) -> usize {
654 if self.node_ref.is_some() {
655 return 1;
656 }
657
658 0
659 }
660 }
661
662 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeIsAlternateForRequest<'static>, ___E>
663 for NodeIsAlternateForRequest
664 where
665 ___E: ::fidl_next::Encoder + ?Sized,
666 ___E: ::fidl_next::fuchsia::HandleEncoder,
667 {
668 #[inline]
669 fn encode(
670 mut self,
671 encoder: &mut ___E,
672 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeIsAlternateForRequest<'static>>,
673 _: (),
674 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
675 ::fidl_next::munge!(let crate::wire::NodeIsAlternateForRequest { table } = out);
676
677 let max_ord = self.__max_ordinal();
678
679 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
680 ::fidl_next::Wire::zero_padding(&mut out);
681
682 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
683 ::fidl_next::wire::Envelope,
684 >(encoder, max_ord);
685
686 for i in 1..=max_ord {
687 match i {
688 1 => {
689 if let Some(value) = self.node_ref.take() {
690 ::fidl_next::wire::Envelope::encode_value::<
691 ::fidl_next::wire::fuchsia::Event,
692 ___E,
693 >(
694 value, preallocated.encoder, &mut out, ()
695 )?;
696 } else {
697 ::fidl_next::wire::Envelope::encode_zero(&mut out)
698 }
699 }
700
701 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
702 }
703 unsafe {
704 preallocated.write_next(out.assume_init_ref());
705 }
706 }
707
708 ::fidl_next::wire::Table::encode_len(table, max_ord);
709
710 Ok(())
711 }
712 }
713
714 impl<'de> ::fidl_next::FromWire<crate::wire::NodeIsAlternateForRequest<'de>>
715 for NodeIsAlternateForRequest
716 {
717 #[inline]
718 fn from_wire(wire_: crate::wire::NodeIsAlternateForRequest<'de>) -> Self {
719 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
720
721 let node_ref = wire_.table.get(1);
722
723 Self {
724 node_ref: node_ref.map(|envelope| {
725 ::fidl_next::FromWire::from_wire(unsafe {
726 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
727 })
728 }),
729 }
730 }
731 }
732
733 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
734 pub struct NodeSetWeakOkRequest {
735 pub for_child_nodes_also: ::core::option::Option<bool>,
736 }
737
738 impl NodeSetWeakOkRequest {
739 fn __max_ordinal(&self) -> usize {
740 if self.for_child_nodes_also.is_some() {
741 return 1;
742 }
743
744 0
745 }
746 }
747
748 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeSetWeakOkRequest<'static>, ___E>
749 for NodeSetWeakOkRequest
750 where
751 ___E: ::fidl_next::Encoder + ?Sized,
752 ___E: ::fidl_next::fuchsia::HandleEncoder,
753 {
754 #[inline]
755 fn encode(
756 mut self,
757 encoder: &mut ___E,
758 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeSetWeakOkRequest<'static>>,
759 _: (),
760 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
761 ::fidl_next::munge!(let crate::wire::NodeSetWeakOkRequest { table } = out);
762
763 let max_ord = self.__max_ordinal();
764
765 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
766 ::fidl_next::Wire::zero_padding(&mut out);
767
768 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
769 ::fidl_next::wire::Envelope,
770 >(encoder, max_ord);
771
772 for i in 1..=max_ord {
773 match i {
774 1 => {
775 if let Some(value) = self.for_child_nodes_also.take() {
776 ::fidl_next::wire::Envelope::encode_value::<bool, ___E>(
777 value,
778 preallocated.encoder,
779 &mut out,
780 (),
781 )?;
782 } else {
783 ::fidl_next::wire::Envelope::encode_zero(&mut out)
784 }
785 }
786
787 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
788 }
789 unsafe {
790 preallocated.write_next(out.assume_init_ref());
791 }
792 }
793
794 ::fidl_next::wire::Table::encode_len(table, max_ord);
795
796 Ok(())
797 }
798 }
799
800 impl<'de> ::fidl_next::FromWire<crate::wire::NodeSetWeakOkRequest<'de>> for NodeSetWeakOkRequest {
801 #[inline]
802 fn from_wire(wire_: crate::wire::NodeSetWeakOkRequest<'de>) -> Self {
803 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
804
805 let for_child_nodes_also = wire_.table.get(1);
806
807 Self {
808 for_child_nodes_also: for_child_nodes_also.map(|envelope| {
809 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<bool>() })
810 }),
811 }
812 }
813 }
814
815 #[derive(Debug, Default, PartialEq)]
816 pub struct VmoBuffer {
817 pub vmo: ::core::option::Option<::fidl_next::fuchsia::zx::Vmo>,
818
819 pub vmo_usable_start: ::core::option::Option<u64>,
820
821 pub close_weak_asap: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
822 }
823
824 impl VmoBuffer {
825 fn __max_ordinal(&self) -> usize {
826 if self.close_weak_asap.is_some() {
827 return 3;
828 }
829
830 if self.vmo_usable_start.is_some() {
831 return 2;
832 }
833
834 if self.vmo.is_some() {
835 return 1;
836 }
837
838 0
839 }
840 }
841
842 unsafe impl<___E> ::fidl_next::Encode<crate::wire::VmoBuffer<'static>, ___E> for VmoBuffer
843 where
844 ___E: ::fidl_next::Encoder + ?Sized,
845 ___E: ::fidl_next::fuchsia::HandleEncoder,
846 {
847 #[inline]
848 fn encode(
849 mut self,
850 encoder: &mut ___E,
851 out: &mut ::core::mem::MaybeUninit<crate::wire::VmoBuffer<'static>>,
852 _: (),
853 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
854 ::fidl_next::munge!(let crate::wire::VmoBuffer { table } = out);
855
856 let max_ord = self.__max_ordinal();
857
858 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
859 ::fidl_next::Wire::zero_padding(&mut out);
860
861 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
862 ::fidl_next::wire::Envelope,
863 >(encoder, max_ord);
864
865 for i in 1..=max_ord {
866 match i {
867 3 => {
868 if let Some(value) = self.close_weak_asap.take() {
869 ::fidl_next::wire::Envelope::encode_value::<
870 ::fidl_next::wire::fuchsia::EventPair,
871 ___E,
872 >(
873 value, preallocated.encoder, &mut out, ()
874 )?;
875 } else {
876 ::fidl_next::wire::Envelope::encode_zero(&mut out)
877 }
878 }
879
880 2 => {
881 if let Some(value) = self.vmo_usable_start.take() {
882 ::fidl_next::wire::Envelope::encode_value::<
883 ::fidl_next::wire::Uint64,
884 ___E,
885 >(
886 value, preallocated.encoder, &mut out, ()
887 )?;
888 } else {
889 ::fidl_next::wire::Envelope::encode_zero(&mut out)
890 }
891 }
892
893 1 => {
894 if let Some(value) = self.vmo.take() {
895 ::fidl_next::wire::Envelope::encode_value::<
896 ::fidl_next::wire::fuchsia::Vmo,
897 ___E,
898 >(
899 value, preallocated.encoder, &mut out, ()
900 )?;
901 } else {
902 ::fidl_next::wire::Envelope::encode_zero(&mut out)
903 }
904 }
905
906 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
907 }
908 unsafe {
909 preallocated.write_next(out.assume_init_ref());
910 }
911 }
912
913 ::fidl_next::wire::Table::encode_len(table, max_ord);
914
915 Ok(())
916 }
917 }
918
919 impl<'de> ::fidl_next::FromWire<crate::wire::VmoBuffer<'de>> for VmoBuffer {
920 #[inline]
921 fn from_wire(wire_: crate::wire::VmoBuffer<'de>) -> Self {
922 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
923
924 let vmo = wire_.table.get(1);
925
926 let vmo_usable_start = wire_.table.get(2);
927
928 let close_weak_asap = wire_.table.get(3);
929
930 Self {
931 vmo: vmo.map(|envelope| {
932 ::fidl_next::FromWire::from_wire(unsafe {
933 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
934 })
935 }),
936
937 vmo_usable_start: vmo_usable_start.map(|envelope| {
938 ::fidl_next::FromWire::from_wire(unsafe {
939 envelope.read_unchecked::<::fidl_next::wire::Uint64>()
940 })
941 }),
942
943 close_weak_asap: close_weak_asap.map(|envelope| {
944 ::fidl_next::FromWire::from_wire(unsafe {
945 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
946 })
947 }),
948 }
949 }
950 }
951
952 #[derive(Debug, Default, PartialEq)]
953 pub struct BufferCollectionAttachLifetimeTrackingRequest {
954 pub server_end: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
955
956 pub buffers_remaining: ::core::option::Option<u32>,
957 }
958
959 impl BufferCollectionAttachLifetimeTrackingRequest {
960 fn __max_ordinal(&self) -> usize {
961 if self.buffers_remaining.is_some() {
962 return 2;
963 }
964
965 if self.server_end.is_some() {
966 return 1;
967 }
968
969 0
970 }
971 }
972
973 unsafe impl<___E>
974 ::fidl_next::Encode<
975 crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'static>,
976 ___E,
977 > for BufferCollectionAttachLifetimeTrackingRequest
978 where
979 ___E: ::fidl_next::Encoder + ?Sized,
980 ___E: ::fidl_next::fuchsia::HandleEncoder,
981 {
982 #[inline]
983 fn encode(
984 mut self,
985 encoder: &mut ___E,
986 out: &mut ::core::mem::MaybeUninit<
987 crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'static>,
988 >,
989 _: (),
990 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
991 ::fidl_next::munge!(let crate::wire::BufferCollectionAttachLifetimeTrackingRequest { table } = out);
992
993 let max_ord = self.__max_ordinal();
994
995 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
996 ::fidl_next::Wire::zero_padding(&mut out);
997
998 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
999 ::fidl_next::wire::Envelope,
1000 >(encoder, max_ord);
1001
1002 for i in 1..=max_ord {
1003 match i {
1004 2 => {
1005 if let Some(value) = self.buffers_remaining.take() {
1006 ::fidl_next::wire::Envelope::encode_value::<
1007 ::fidl_next::wire::Uint32,
1008 ___E,
1009 >(
1010 value, preallocated.encoder, &mut out, ()
1011 )?;
1012 } else {
1013 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1014 }
1015 }
1016
1017 1 => {
1018 if let Some(value) = self.server_end.take() {
1019 ::fidl_next::wire::Envelope::encode_value::<
1020 ::fidl_next::wire::fuchsia::EventPair,
1021 ___E,
1022 >(
1023 value, preallocated.encoder, &mut out, ()
1024 )?;
1025 } else {
1026 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1027 }
1028 }
1029
1030 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1031 }
1032 unsafe {
1033 preallocated.write_next(out.assume_init_ref());
1034 }
1035 }
1036
1037 ::fidl_next::wire::Table::encode_len(table, max_ord);
1038
1039 Ok(())
1040 }
1041 }
1042
1043 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'de>>
1044 for BufferCollectionAttachLifetimeTrackingRequest
1045 {
1046 #[inline]
1047 fn from_wire(
1048 wire_: crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'de>,
1049 ) -> Self {
1050 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1051
1052 let server_end = wire_.table.get(1);
1053
1054 let buffers_remaining = wire_.table.get(2);
1055
1056 Self {
1057 server_end: server_end.map(|envelope| {
1058 ::fidl_next::FromWire::from_wire(unsafe {
1059 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
1060 })
1061 }),
1062
1063 buffers_remaining: buffers_remaining.map(|envelope| {
1064 ::fidl_next::FromWire::from_wire(unsafe {
1065 envelope.read_unchecked::<::fidl_next::wire::Uint32>()
1066 })
1067 }),
1068 }
1069 }
1070 }
1071
1072 #[derive(Debug, Default, PartialEq)]
1073 pub struct NodeAttachNodeTrackingRequest {
1074 pub server_end: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
1075 }
1076
1077 impl NodeAttachNodeTrackingRequest {
1078 fn __max_ordinal(&self) -> usize {
1079 if self.server_end.is_some() {
1080 return 1;
1081 }
1082
1083 0
1084 }
1085 }
1086
1087 unsafe impl<___E> ::fidl_next::Encode<crate::wire::NodeAttachNodeTrackingRequest<'static>, ___E>
1088 for NodeAttachNodeTrackingRequest
1089 where
1090 ___E: ::fidl_next::Encoder + ?Sized,
1091 ___E: ::fidl_next::fuchsia::HandleEncoder,
1092 {
1093 #[inline]
1094 fn encode(
1095 mut self,
1096 encoder: &mut ___E,
1097 out: &mut ::core::mem::MaybeUninit<crate::wire::NodeAttachNodeTrackingRequest<'static>>,
1098 _: (),
1099 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1100 ::fidl_next::munge!(let crate::wire::NodeAttachNodeTrackingRequest { table } = out);
1101
1102 let max_ord = self.__max_ordinal();
1103
1104 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1105 ::fidl_next::Wire::zero_padding(&mut out);
1106
1107 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1108 ::fidl_next::wire::Envelope,
1109 >(encoder, max_ord);
1110
1111 for i in 1..=max_ord {
1112 match i {
1113 1 => {
1114 if let Some(value) = self.server_end.take() {
1115 ::fidl_next::wire::Envelope::encode_value::<
1116 ::fidl_next::wire::fuchsia::EventPair,
1117 ___E,
1118 >(
1119 value, preallocated.encoder, &mut out, ()
1120 )?;
1121 } else {
1122 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1123 }
1124 }
1125
1126 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1127 }
1128 unsafe {
1129 preallocated.write_next(out.assume_init_ref());
1130 }
1131 }
1132
1133 ::fidl_next::wire::Table::encode_len(table, max_ord);
1134
1135 Ok(())
1136 }
1137 }
1138
1139 impl<'de> ::fidl_next::FromWire<crate::wire::NodeAttachNodeTrackingRequest<'de>>
1140 for NodeAttachNodeTrackingRequest
1141 {
1142 #[inline]
1143 fn from_wire(wire_: crate::wire::NodeAttachNodeTrackingRequest<'de>) -> Self {
1144 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1145
1146 let server_end = wire_.table.get(1);
1147
1148 Self {
1149 server_end: server_end.map(|envelope| {
1150 ::fidl_next::FromWire::from_wire(unsafe {
1151 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
1152 })
1153 }),
1154 }
1155 }
1156 }
1157
1158 #[derive(Debug, Default, PartialEq)]
1159 pub struct BufferCollectionAttachTokenRequest {
1160 pub rights_attenuation_mask: ::core::option::Option<::fidl_next::fuchsia::zx::Rights>,
1161
1162 pub token_request: ::core::option::Option<
1163 ::fidl_next::ServerEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
1164 >,
1165 }
1166
1167 impl BufferCollectionAttachTokenRequest {
1168 fn __max_ordinal(&self) -> usize {
1169 if self.token_request.is_some() {
1170 return 2;
1171 }
1172
1173 if self.rights_attenuation_mask.is_some() {
1174 return 1;
1175 }
1176
1177 0
1178 }
1179 }
1180
1181 unsafe impl<___E>
1182 ::fidl_next::Encode<crate::wire::BufferCollectionAttachTokenRequest<'static>, ___E>
1183 for BufferCollectionAttachTokenRequest
1184 where
1185 ___E: ::fidl_next::Encoder + ?Sized,
1186 ___E: ::fidl_next::fuchsia::HandleEncoder,
1187 {
1188 #[inline]
1189 fn encode(
1190 mut self,
1191 encoder: &mut ___E,
1192 out: &mut ::core::mem::MaybeUninit<
1193 crate::wire::BufferCollectionAttachTokenRequest<'static>,
1194 >,
1195 _: (),
1196 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1197 ::fidl_next::munge!(let crate::wire::BufferCollectionAttachTokenRequest { table } = out);
1198
1199 let max_ord = self.__max_ordinal();
1200
1201 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1202 ::fidl_next::Wire::zero_padding(&mut out);
1203
1204 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1205 ::fidl_next::wire::Envelope,
1206 >(encoder, max_ord);
1207
1208 for i in 1..=max_ord {
1209 match i {
1210 2 => {
1211 if let Some(value) = self.token_request.take() {
1212 ::fidl_next::wire::Envelope::encode_value::<
1213 ::fidl_next::ServerEnd<
1214 crate::BufferCollectionToken,
1215 ::fidl_next::wire::fuchsia::Channel,
1216 >,
1217 ___E,
1218 >(
1219 value, preallocated.encoder, &mut out, ()
1220 )?;
1221 } else {
1222 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1223 }
1224 }
1225
1226 1 => {
1227 if let Some(value) = self.rights_attenuation_mask.take() {
1228 ::fidl_next::wire::Envelope::encode_value::<
1229 ::fidl_next::wire::fuchsia::Rights,
1230 ___E,
1231 >(
1232 value, preallocated.encoder, &mut out, ()
1233 )?;
1234 } else {
1235 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1236 }
1237 }
1238
1239 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1240 }
1241 unsafe {
1242 preallocated.write_next(out.assume_init_ref());
1243 }
1244 }
1245
1246 ::fidl_next::wire::Table::encode_len(table, max_ord);
1247
1248 Ok(())
1249 }
1250 }
1251
1252 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionAttachTokenRequest<'de>>
1253 for BufferCollectionAttachTokenRequest
1254 {
1255 #[inline]
1256 fn from_wire(wire_: crate::wire::BufferCollectionAttachTokenRequest<'de>) -> Self {
1257 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1258
1259 let rights_attenuation_mask = wire_.table.get(1);
1260
1261 let token_request = wire_.table.get(2);
1262
1263 Self {
1264 rights_attenuation_mask: rights_attenuation_mask.map(|envelope| {
1265 ::fidl_next::FromWire::from_wire(unsafe {
1266 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
1267 })
1268 }),
1269
1270 token_request: token_request.map(|envelope| {
1271 ::fidl_next::FromWire::from_wire(unsafe {
1272 envelope.read_unchecked::<::fidl_next::ServerEnd<
1273 crate::BufferCollectionToken,
1274 ::fidl_next::wire::fuchsia::Channel,
1275 >>()
1276 })
1277 }),
1278 }
1279 }
1280 }
1281
1282 #[derive(Debug, Default, Clone, PartialEq)]
1283 pub struct BufferCollectionSetConstraintsRequest {
1284 pub constraints: ::core::option::Option<crate::natural::BufferCollectionConstraints>,
1285 }
1286
1287 impl BufferCollectionSetConstraintsRequest {
1288 fn __max_ordinal(&self) -> usize {
1289 if self.constraints.is_some() {
1290 return 1;
1291 }
1292
1293 0
1294 }
1295 }
1296
1297 unsafe impl<___E>
1298 ::fidl_next::Encode<crate::wire::BufferCollectionSetConstraintsRequest<'static>, ___E>
1299 for BufferCollectionSetConstraintsRequest
1300 where
1301 ___E: ::fidl_next::Encoder + ?Sized,
1302 ___E: ::fidl_next::fuchsia::HandleEncoder,
1303 {
1304 #[inline]
1305 fn encode(
1306 mut self,
1307 encoder: &mut ___E,
1308 out: &mut ::core::mem::MaybeUninit<
1309 crate::wire::BufferCollectionSetConstraintsRequest<'static>,
1310 >,
1311 _: (),
1312 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1313 ::fidl_next::munge!(let crate::wire::BufferCollectionSetConstraintsRequest { table } = out);
1314
1315 let max_ord = self.__max_ordinal();
1316
1317 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1318 ::fidl_next::Wire::zero_padding(&mut out);
1319
1320 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1321 ::fidl_next::wire::Envelope,
1322 >(encoder, max_ord);
1323
1324 for i in 1..=max_ord {
1325 match i {
1326 1 => {
1327 if let Some(value) = self.constraints.take() {
1328 ::fidl_next::wire::Envelope::encode_value::<
1329 crate::wire::BufferCollectionConstraints<'static>,
1330 ___E,
1331 >(
1332 value, preallocated.encoder, &mut out, ()
1333 )?;
1334 } else {
1335 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1336 }
1337 }
1338
1339 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1340 }
1341 unsafe {
1342 preallocated.write_next(out.assume_init_ref());
1343 }
1344 }
1345
1346 ::fidl_next::wire::Table::encode_len(table, max_ord);
1347
1348 Ok(())
1349 }
1350 }
1351
1352 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionSetConstraintsRequest<'de>>
1353 for BufferCollectionSetConstraintsRequest
1354 {
1355 #[inline]
1356 fn from_wire(wire_: crate::wire::BufferCollectionSetConstraintsRequest<'de>) -> Self {
1357 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1358
1359 let constraints = wire_.table.get(1);
1360
1361 Self {
1362 constraints: constraints.map(|envelope| {
1363 ::fidl_next::FromWire::from_wire(unsafe {
1364 envelope.read_unchecked::<crate::wire::BufferCollectionConstraints<'de>>()
1365 })
1366 }),
1367 }
1368 }
1369 }
1370
1371 #[doc = " Information about a buffer collection and its buffers.\n"]
1372 #[derive(Debug, Default, PartialEq)]
1373 pub struct BufferCollectionInfo {
1374 pub settings: ::core::option::Option<crate::natural::SingleBufferSettings>,
1375
1376 pub buffers: ::core::option::Option<::std::vec::Vec<crate::natural::VmoBuffer>>,
1377
1378 pub buffer_collection_id: ::core::option::Option<u64>,
1379 }
1380
1381 impl BufferCollectionInfo {
1382 fn __max_ordinal(&self) -> usize {
1383 if self.buffer_collection_id.is_some() {
1384 return 3;
1385 }
1386
1387 if self.buffers.is_some() {
1388 return 2;
1389 }
1390
1391 if self.settings.is_some() {
1392 return 1;
1393 }
1394
1395 0
1396 }
1397 }
1398
1399 unsafe impl<___E> ::fidl_next::Encode<crate::wire::BufferCollectionInfo<'static>, ___E>
1400 for BufferCollectionInfo
1401 where
1402 ___E: ::fidl_next::Encoder + ?Sized,
1403 ___E: ::fidl_next::fuchsia::HandleEncoder,
1404 {
1405 #[inline]
1406 fn encode(
1407 mut self,
1408 encoder: &mut ___E,
1409 out: &mut ::core::mem::MaybeUninit<crate::wire::BufferCollectionInfo<'static>>,
1410 _: (),
1411 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1412 ::fidl_next::munge!(let crate::wire::BufferCollectionInfo { table } = out);
1413
1414 let max_ord = self.__max_ordinal();
1415
1416 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1417 ::fidl_next::Wire::zero_padding(&mut out);
1418
1419 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1420 ::fidl_next::wire::Envelope,
1421 >(encoder, max_ord);
1422
1423 for i in 1..=max_ord {
1424 match i {
1425 3 => {
1426 if let Some(value) = self.buffer_collection_id.take() {
1427 ::fidl_next::wire::Envelope::encode_value::<
1428 ::fidl_next::wire::Uint64,
1429 ___E,
1430 >(
1431 value, preallocated.encoder, &mut out, ()
1432 )?;
1433 } else {
1434 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1435 }
1436 }
1437
1438 2 => {
1439 if let Some(value) = self.buffers.take() {
1440 ::fidl_next::wire::Envelope::encode_value::<
1441 ::fidl_next::wire::Vector<'static, crate::wire::VmoBuffer<'static>>,
1442 ___E,
1443 >(
1444 value, preallocated.encoder, &mut out, (128, ())
1445 )?;
1446 } else {
1447 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1448 }
1449 }
1450
1451 1 => {
1452 if let Some(value) = self.settings.take() {
1453 ::fidl_next::wire::Envelope::encode_value::<
1454 crate::wire::SingleBufferSettings<'static>,
1455 ___E,
1456 >(
1457 value, preallocated.encoder, &mut out, ()
1458 )?;
1459 } else {
1460 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1461 }
1462 }
1463
1464 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1465 }
1466 unsafe {
1467 preallocated.write_next(out.assume_init_ref());
1468 }
1469 }
1470
1471 ::fidl_next::wire::Table::encode_len(table, max_ord);
1472
1473 Ok(())
1474 }
1475 }
1476
1477 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionInfo<'de>> for BufferCollectionInfo {
1478 #[inline]
1479 fn from_wire(wire_: crate::wire::BufferCollectionInfo<'de>) -> Self {
1480 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1481
1482 let settings = wire_.table.get(1);
1483
1484 let buffers = wire_.table.get(2);
1485
1486 let buffer_collection_id = wire_.table.get(3);
1487
1488 Self {
1489
1490
1491 settings: settings.map(|envelope| ::fidl_next::FromWire::from_wire(
1492 unsafe { envelope.read_unchecked::<crate::wire::SingleBufferSettings<'de>>() }
1493 )),
1494
1495
1496 buffers: buffers.map(|envelope| ::fidl_next::FromWire::from_wire(
1497 unsafe { envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>>() }
1498 )),
1499
1500
1501 buffer_collection_id: buffer_collection_id.map(|envelope| ::fidl_next::FromWire::from_wire(
1502 unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() }
1503 )),
1504
1505 }
1506 }
1507 }
1508
1509 #[derive(Debug, Default, PartialEq)]
1510 pub struct BufferCollectionWaitForAllBuffersAllocatedResponse {
1511 pub buffer_collection_info: ::core::option::Option<crate::natural::BufferCollectionInfo>,
1512 }
1513
1514 impl BufferCollectionWaitForAllBuffersAllocatedResponse {
1515 fn __max_ordinal(&self) -> usize {
1516 if self.buffer_collection_info.is_some() {
1517 return 1;
1518 }
1519
1520 0
1521 }
1522 }
1523
1524 unsafe impl<___E>
1525 ::fidl_next::Encode<
1526 crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'static>,
1527 ___E,
1528 > for BufferCollectionWaitForAllBuffersAllocatedResponse
1529 where
1530 ___E: ::fidl_next::Encoder + ?Sized,
1531 ___E: ::fidl_next::fuchsia::HandleEncoder,
1532 {
1533 #[inline]
1534 fn encode(
1535 mut self,
1536 encoder: &mut ___E,
1537 out: &mut ::core::mem::MaybeUninit<
1538 crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'static>,
1539 >,
1540 _: (),
1541 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1542 ::fidl_next::munge!(let crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse { table } = out);
1543
1544 let max_ord = self.__max_ordinal();
1545
1546 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1547 ::fidl_next::Wire::zero_padding(&mut out);
1548
1549 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1550 ::fidl_next::wire::Envelope,
1551 >(encoder, max_ord);
1552
1553 for i in 1..=max_ord {
1554 match i {
1555 1 => {
1556 if let Some(value) = self.buffer_collection_info.take() {
1557 ::fidl_next::wire::Envelope::encode_value::<
1558 crate::wire::BufferCollectionInfo<'static>,
1559 ___E,
1560 >(
1561 value, preallocated.encoder, &mut out, ()
1562 )?;
1563 } else {
1564 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1565 }
1566 }
1567
1568 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1569 }
1570 unsafe {
1571 preallocated.write_next(out.assume_init_ref());
1572 }
1573 }
1574
1575 ::fidl_next::wire::Table::encode_len(table, max_ord);
1576
1577 Ok(())
1578 }
1579 }
1580
1581 impl<'de>
1582 ::fidl_next::FromWire<crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'de>>
1583 for BufferCollectionWaitForAllBuffersAllocatedResponse
1584 {
1585 #[inline]
1586 fn from_wire(
1587 wire_: crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'de>,
1588 ) -> Self {
1589 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1590
1591 let buffer_collection_info = wire_.table.get(1);
1592
1593 Self {
1594 buffer_collection_info: buffer_collection_info.map(|envelope| {
1595 ::fidl_next::FromWire::from_wire(unsafe {
1596 envelope.read_unchecked::<crate::wire::BufferCollectionInfo<'de>>()
1597 })
1598 }),
1599 }
1600 }
1601 }
1602
1603 #[derive(Debug, Default, PartialEq)]
1604 pub struct BufferCollectionTokenDuplicateSyncResponse {
1605 pub tokens: ::core::option::Option<
1606 ::std::vec::Vec<
1607 ::fidl_next::ClientEnd<
1608 crate::BufferCollectionToken,
1609 ::fidl_next::fuchsia::zx::Channel,
1610 >,
1611 >,
1612 >,
1613 }
1614
1615 impl BufferCollectionTokenDuplicateSyncResponse {
1616 fn __max_ordinal(&self) -> usize {
1617 if self.tokens.is_some() {
1618 return 1;
1619 }
1620
1621 0
1622 }
1623 }
1624
1625 unsafe impl<___E>
1626 ::fidl_next::Encode<crate::wire::BufferCollectionTokenDuplicateSyncResponse<'static>, ___E>
1627 for BufferCollectionTokenDuplicateSyncResponse
1628 where
1629 ___E: ::fidl_next::Encoder + ?Sized,
1630 ___E: ::fidl_next::fuchsia::HandleEncoder,
1631 {
1632 #[inline]
1633 fn encode(
1634 mut self,
1635 encoder: &mut ___E,
1636 out: &mut ::core::mem::MaybeUninit<
1637 crate::wire::BufferCollectionTokenDuplicateSyncResponse<'static>,
1638 >,
1639 _: (),
1640 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1641 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenDuplicateSyncResponse { table } = out);
1642
1643 let max_ord = self.__max_ordinal();
1644
1645 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1646 ::fidl_next::Wire::zero_padding(&mut out);
1647
1648 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1649 ::fidl_next::wire::Envelope,
1650 >(encoder, max_ord);
1651
1652 for i in 1..=max_ord {
1653 match i {
1654 1 => {
1655 if let Some(value) = self.tokens.take() {
1656 ::fidl_next::wire::Envelope::encode_value::<
1657 ::fidl_next::wire::Vector<
1658 'static,
1659 ::fidl_next::ClientEnd<
1660 crate::BufferCollectionToken,
1661 ::fidl_next::wire::fuchsia::Channel,
1662 >,
1663 >,
1664 ___E,
1665 >(
1666 value, preallocated.encoder, &mut out, (64, ())
1667 )?;
1668 } else {
1669 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1670 }
1671 }
1672
1673 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1674 }
1675 unsafe {
1676 preallocated.write_next(out.assume_init_ref());
1677 }
1678 }
1679
1680 ::fidl_next::wire::Table::encode_len(table, max_ord);
1681
1682 Ok(())
1683 }
1684 }
1685
1686 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionTokenDuplicateSyncResponse<'de>>
1687 for BufferCollectionTokenDuplicateSyncResponse
1688 {
1689 #[inline]
1690 fn from_wire(wire_: crate::wire::BufferCollectionTokenDuplicateSyncResponse<'de>) -> Self {
1691 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1692
1693 let tokens = wire_.table.get(1);
1694
1695 Self {
1696 tokens: tokens.map(|envelope| {
1697 ::fidl_next::FromWire::from_wire(unsafe {
1698 envelope.read_unchecked::<::fidl_next::wire::Vector<
1699 'de,
1700 ::fidl_next::ClientEnd<
1701 crate::BufferCollectionToken,
1702 ::fidl_next::wire::fuchsia::Channel,
1703 >,
1704 >>()
1705 })
1706 }),
1707 }
1708 }
1709 }
1710
1711 #[derive(Debug, Default, PartialEq)]
1712 pub struct BufferCollectionTokenDuplicateRequest {
1713 pub rights_attenuation_mask: ::core::option::Option<::fidl_next::fuchsia::zx::Rights>,
1714
1715 pub token_request: ::core::option::Option<
1716 ::fidl_next::ServerEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
1717 >,
1718 }
1719
1720 impl BufferCollectionTokenDuplicateRequest {
1721 fn __max_ordinal(&self) -> usize {
1722 if self.token_request.is_some() {
1723 return 2;
1724 }
1725
1726 if self.rights_attenuation_mask.is_some() {
1727 return 1;
1728 }
1729
1730 0
1731 }
1732 }
1733
1734 unsafe impl<___E>
1735 ::fidl_next::Encode<crate::wire::BufferCollectionTokenDuplicateRequest<'static>, ___E>
1736 for BufferCollectionTokenDuplicateRequest
1737 where
1738 ___E: ::fidl_next::Encoder + ?Sized,
1739 ___E: ::fidl_next::fuchsia::HandleEncoder,
1740 {
1741 #[inline]
1742 fn encode(
1743 mut self,
1744 encoder: &mut ___E,
1745 out: &mut ::core::mem::MaybeUninit<
1746 crate::wire::BufferCollectionTokenDuplicateRequest<'static>,
1747 >,
1748 _: (),
1749 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1750 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenDuplicateRequest { table } = out);
1751
1752 let max_ord = self.__max_ordinal();
1753
1754 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1755 ::fidl_next::Wire::zero_padding(&mut out);
1756
1757 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1758 ::fidl_next::wire::Envelope,
1759 >(encoder, max_ord);
1760
1761 for i in 1..=max_ord {
1762 match i {
1763 2 => {
1764 if let Some(value) = self.token_request.take() {
1765 ::fidl_next::wire::Envelope::encode_value::<
1766 ::fidl_next::ServerEnd<
1767 crate::BufferCollectionToken,
1768 ::fidl_next::wire::fuchsia::Channel,
1769 >,
1770 ___E,
1771 >(
1772 value, preallocated.encoder, &mut out, ()
1773 )?;
1774 } else {
1775 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1776 }
1777 }
1778
1779 1 => {
1780 if let Some(value) = self.rights_attenuation_mask.take() {
1781 ::fidl_next::wire::Envelope::encode_value::<
1782 ::fidl_next::wire::fuchsia::Rights,
1783 ___E,
1784 >(
1785 value, preallocated.encoder, &mut out, ()
1786 )?;
1787 } else {
1788 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1789 }
1790 }
1791
1792 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1793 }
1794 unsafe {
1795 preallocated.write_next(out.assume_init_ref());
1796 }
1797 }
1798
1799 ::fidl_next::wire::Table::encode_len(table, max_ord);
1800
1801 Ok(())
1802 }
1803 }
1804
1805 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionTokenDuplicateRequest<'de>>
1806 for BufferCollectionTokenDuplicateRequest
1807 {
1808 #[inline]
1809 fn from_wire(wire_: crate::wire::BufferCollectionTokenDuplicateRequest<'de>) -> Self {
1810 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1811
1812 let rights_attenuation_mask = wire_.table.get(1);
1813
1814 let token_request = wire_.table.get(2);
1815
1816 Self {
1817 rights_attenuation_mask: rights_attenuation_mask.map(|envelope| {
1818 ::fidl_next::FromWire::from_wire(unsafe {
1819 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
1820 })
1821 }),
1822
1823 token_request: token_request.map(|envelope| {
1824 ::fidl_next::FromWire::from_wire(unsafe {
1825 envelope.read_unchecked::<::fidl_next::ServerEnd<
1826 crate::BufferCollectionToken,
1827 ::fidl_next::wire::fuchsia::Channel,
1828 >>()
1829 })
1830 }),
1831 }
1832 }
1833 }
1834
1835 #[derive(Debug, Default, PartialEq)]
1836 pub struct BufferCollectionTokenCreateBufferCollectionTokenGroupRequest {
1837 pub group_request: ::core::option::Option<
1838 ::fidl_next::ServerEnd<
1839 crate::BufferCollectionTokenGroup,
1840 ::fidl_next::fuchsia::zx::Channel,
1841 >,
1842 >,
1843 }
1844
1845 impl BufferCollectionTokenCreateBufferCollectionTokenGroupRequest {
1846 fn __max_ordinal(&self) -> usize {
1847 if self.group_request.is_some() {
1848 return 1;
1849 }
1850
1851 0
1852 }
1853 }
1854
1855 unsafe impl<___E>
1856 ::fidl_next::Encode<
1857 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'static>,
1858 ___E,
1859 > for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest
1860 where
1861 ___E: ::fidl_next::Encoder + ?Sized,
1862 ___E: ::fidl_next::fuchsia::HandleEncoder,
1863 {
1864 #[inline]
1865 fn encode(
1866 mut self,
1867 encoder: &mut ___E,
1868 out: &mut ::core::mem::MaybeUninit<
1869 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'static>,
1870 >,
1871 _: (),
1872 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1873 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest { table } = out);
1874
1875 let max_ord = self.__max_ordinal();
1876
1877 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1878 ::fidl_next::Wire::zero_padding(&mut out);
1879
1880 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1881 ::fidl_next::wire::Envelope,
1882 >(encoder, max_ord);
1883
1884 for i in 1..=max_ord {
1885 match i {
1886 1 => {
1887 if let Some(value) = self.group_request.take() {
1888 ::fidl_next::wire::Envelope::encode_value::<
1889 ::fidl_next::ServerEnd<
1890 crate::BufferCollectionTokenGroup,
1891 ::fidl_next::wire::fuchsia::Channel,
1892 >,
1893 ___E,
1894 >(
1895 value, preallocated.encoder, &mut out, ()
1896 )?;
1897 } else {
1898 ::fidl_next::wire::Envelope::encode_zero(&mut out)
1899 }
1900 }
1901
1902 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
1903 }
1904 unsafe {
1905 preallocated.write_next(out.assume_init_ref());
1906 }
1907 }
1908
1909 ::fidl_next::wire::Table::encode_len(table, max_ord);
1910
1911 Ok(())
1912 }
1913 }
1914
1915 impl<'de>
1916 ::fidl_next::FromWire<
1917 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>,
1918 > for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest
1919 {
1920 #[inline]
1921 fn from_wire(
1922 wire_: crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>,
1923 ) -> Self {
1924 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
1925
1926 let group_request = wire_.table.get(1);
1927
1928 Self {
1929 group_request: group_request.map(|envelope| {
1930 ::fidl_next::FromWire::from_wire(unsafe {
1931 envelope.read_unchecked::<::fidl_next::ServerEnd<
1932 crate::BufferCollectionTokenGroup,
1933 ::fidl_next::wire::fuchsia::Channel,
1934 >>()
1935 })
1936 }),
1937 }
1938 }
1939 }
1940
1941 #[derive(Debug, Default, PartialEq)]
1942 pub struct BufferCollectionTokenGroupCreateChildRequest {
1943 pub token_request: ::core::option::Option<
1944 ::fidl_next::ServerEnd<crate::BufferCollectionToken, ::fidl_next::fuchsia::zx::Channel>,
1945 >,
1946
1947 pub rights_attenuation_mask: ::core::option::Option<::fidl_next::fuchsia::zx::Rights>,
1948 }
1949
1950 impl BufferCollectionTokenGroupCreateChildRequest {
1951 fn __max_ordinal(&self) -> usize {
1952 if self.rights_attenuation_mask.is_some() {
1953 return 2;
1954 }
1955
1956 if self.token_request.is_some() {
1957 return 1;
1958 }
1959
1960 0
1961 }
1962 }
1963
1964 unsafe impl<___E>
1965 ::fidl_next::Encode<
1966 crate::wire::BufferCollectionTokenGroupCreateChildRequest<'static>,
1967 ___E,
1968 > for BufferCollectionTokenGroupCreateChildRequest
1969 where
1970 ___E: ::fidl_next::Encoder + ?Sized,
1971 ___E: ::fidl_next::fuchsia::HandleEncoder,
1972 {
1973 #[inline]
1974 fn encode(
1975 mut self,
1976 encoder: &mut ___E,
1977 out: &mut ::core::mem::MaybeUninit<
1978 crate::wire::BufferCollectionTokenGroupCreateChildRequest<'static>,
1979 >,
1980 _: (),
1981 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1982 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenGroupCreateChildRequest { table } = out);
1983
1984 let max_ord = self.__max_ordinal();
1985
1986 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
1987 ::fidl_next::Wire::zero_padding(&mut out);
1988
1989 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
1990 ::fidl_next::wire::Envelope,
1991 >(encoder, max_ord);
1992
1993 for i in 1..=max_ord {
1994 match i {
1995 2 => {
1996 if let Some(value) = self.rights_attenuation_mask.take() {
1997 ::fidl_next::wire::Envelope::encode_value::<
1998 ::fidl_next::wire::fuchsia::Rights,
1999 ___E,
2000 >(
2001 value, preallocated.encoder, &mut out, ()
2002 )?;
2003 } else {
2004 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2005 }
2006 }
2007
2008 1 => {
2009 if let Some(value) = self.token_request.take() {
2010 ::fidl_next::wire::Envelope::encode_value::<
2011 ::fidl_next::ServerEnd<
2012 crate::BufferCollectionToken,
2013 ::fidl_next::wire::fuchsia::Channel,
2014 >,
2015 ___E,
2016 >(
2017 value, preallocated.encoder, &mut out, ()
2018 )?;
2019 } else {
2020 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2021 }
2022 }
2023
2024 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
2025 }
2026 unsafe {
2027 preallocated.write_next(out.assume_init_ref());
2028 }
2029 }
2030
2031 ::fidl_next::wire::Table::encode_len(table, max_ord);
2032
2033 Ok(())
2034 }
2035 }
2036
2037 impl<'de> ::fidl_next::FromWire<crate::wire::BufferCollectionTokenGroupCreateChildRequest<'de>>
2038 for BufferCollectionTokenGroupCreateChildRequest
2039 {
2040 #[inline]
2041 fn from_wire(
2042 wire_: crate::wire::BufferCollectionTokenGroupCreateChildRequest<'de>,
2043 ) -> Self {
2044 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
2045
2046 let token_request = wire_.table.get(1);
2047
2048 let rights_attenuation_mask = wire_.table.get(2);
2049
2050 Self {
2051 token_request: token_request.map(|envelope| {
2052 ::fidl_next::FromWire::from_wire(unsafe {
2053 envelope.read_unchecked::<::fidl_next::ServerEnd<
2054 crate::BufferCollectionToken,
2055 ::fidl_next::wire::fuchsia::Channel,
2056 >>()
2057 })
2058 }),
2059
2060 rights_attenuation_mask: rights_attenuation_mask.map(|envelope| {
2061 ::fidl_next::FromWire::from_wire(unsafe {
2062 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
2063 })
2064 }),
2065 }
2066 }
2067 }
2068
2069 #[derive(Debug, Default, PartialEq)]
2070 pub struct BufferCollectionTokenGroupCreateChildrenSyncResponse {
2071 pub tokens: ::core::option::Option<
2072 ::std::vec::Vec<
2073 ::fidl_next::ClientEnd<
2074 crate::BufferCollectionToken,
2075 ::fidl_next::fuchsia::zx::Channel,
2076 >,
2077 >,
2078 >,
2079 }
2080
2081 impl BufferCollectionTokenGroupCreateChildrenSyncResponse {
2082 fn __max_ordinal(&self) -> usize {
2083 if self.tokens.is_some() {
2084 return 1;
2085 }
2086
2087 0
2088 }
2089 }
2090
2091 unsafe impl<___E>
2092 ::fidl_next::Encode<
2093 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'static>,
2094 ___E,
2095 > for BufferCollectionTokenGroupCreateChildrenSyncResponse
2096 where
2097 ___E: ::fidl_next::Encoder + ?Sized,
2098 ___E: ::fidl_next::fuchsia::HandleEncoder,
2099 {
2100 #[inline]
2101 fn encode(
2102 mut self,
2103 encoder: &mut ___E,
2104 out: &mut ::core::mem::MaybeUninit<
2105 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'static>,
2106 >,
2107 _: (),
2108 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
2109 ::fidl_next::munge!(let crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse { table } = out);
2110
2111 let max_ord = self.__max_ordinal();
2112
2113 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
2114 ::fidl_next::Wire::zero_padding(&mut out);
2115
2116 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
2117 ::fidl_next::wire::Envelope,
2118 >(encoder, max_ord);
2119
2120 for i in 1..=max_ord {
2121 match i {
2122 1 => {
2123 if let Some(value) = self.tokens.take() {
2124 ::fidl_next::wire::Envelope::encode_value::<
2125 ::fidl_next::wire::Vector<
2126 'static,
2127 ::fidl_next::ClientEnd<
2128 crate::BufferCollectionToken,
2129 ::fidl_next::wire::fuchsia::Channel,
2130 >,
2131 >,
2132 ___E,
2133 >(
2134 value, preallocated.encoder, &mut out, (64, ())
2135 )?;
2136 } else {
2137 ::fidl_next::wire::Envelope::encode_zero(&mut out)
2138 }
2139 }
2140
2141 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
2142 }
2143 unsafe {
2144 preallocated.write_next(out.assume_init_ref());
2145 }
2146 }
2147
2148 ::fidl_next::wire::Table::encode_len(table, max_ord);
2149
2150 Ok(())
2151 }
2152 }
2153
2154 impl<'de>
2155 ::fidl_next::FromWire<
2156 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'de>,
2157 > for BufferCollectionTokenGroupCreateChildrenSyncResponse
2158 {
2159 #[inline]
2160 fn from_wire(
2161 wire_: crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'de>,
2162 ) -> Self {
2163 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
2164
2165 let tokens = wire_.table.get(1);
2166
2167 Self {
2168 tokens: tokens.map(|envelope| {
2169 ::fidl_next::FromWire::from_wire(unsafe {
2170 envelope.read_unchecked::<::fidl_next::wire::Vector<
2171 'de,
2172 ::fidl_next::ClientEnd<
2173 crate::BufferCollectionToken,
2174 ::fidl_next::wire::fuchsia::Channel,
2175 >,
2176 >>()
2177 })
2178 }),
2179 }
2180 }
2181 }
2182}
2183
2184pub mod wire {
2185
2186 pub use fidl_next_common_fuchsia_sysmem2::wire::*;
2187
2188 #[repr(C)]
2190 pub struct AllocatorGetVmoInfoRequest<'de> {
2191 pub(crate) table: ::fidl_next::wire::Table<'de>,
2192 }
2193
2194 impl<'de> Drop for AllocatorGetVmoInfoRequest<'de> {
2195 fn drop(&mut self) {
2196 let _ = self.table.get(1).map(|envelope| unsafe {
2197 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
2198 });
2199 }
2200 }
2201
2202 impl ::fidl_next::Constrained for AllocatorGetVmoInfoRequest<'_> {
2203 type Constraint = ();
2204
2205 fn validate(
2206 _: ::fidl_next::Slot<'_, Self>,
2207 _: Self::Constraint,
2208 ) -> Result<(), ::fidl_next::ValidationError> {
2209 Ok(())
2210 }
2211 }
2212
2213 unsafe impl ::fidl_next::Wire for AllocatorGetVmoInfoRequest<'static> {
2214 type Narrowed<'de> = AllocatorGetVmoInfoRequest<'de>;
2215
2216 #[inline]
2217 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2218 ::fidl_next::munge!(let Self { table } = out);
2219 ::fidl_next::wire::Table::zero_padding(table);
2220 }
2221 }
2222
2223 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for AllocatorGetVmoInfoRequest<'de>
2224 where
2225 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2226 ___D: ::fidl_next::fuchsia::HandleDecoder,
2227 {
2228 fn decode(
2229 slot: ::fidl_next::Slot<'_, Self>,
2230 decoder: &mut ___D,
2231 _: (),
2232 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2233 ::fidl_next::munge!(let Self { table } = slot);
2234
2235 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2236 match ordinal {
2237 0 => unsafe { ::core::hint::unreachable_unchecked() },
2238
2239 1 => {
2240 ::fidl_next::wire::Envelope::decode_as::<
2241 ___D,
2242 ::fidl_next::wire::fuchsia::Vmo,
2243 >(slot.as_mut(), decoder, ())?;
2244
2245 Ok(())
2246 }
2247
2248 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2249 }
2250 })
2251 }
2252 }
2253
2254 impl<'de> AllocatorGetVmoInfoRequest<'de> {
2255 pub fn vmo(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
2256 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2257 }
2258 }
2259
2260 impl<'de> ::core::fmt::Debug for AllocatorGetVmoInfoRequest<'de> {
2261 fn fmt(
2262 &self,
2263 f: &mut ::core::fmt::Formatter<'_>,
2264 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2265 f.debug_struct("AllocatorGetVmoInfoRequest").field("vmo", &self.vmo()).finish()
2266 }
2267 }
2268
2269 impl<'de> ::fidl_next::IntoNatural for AllocatorGetVmoInfoRequest<'de> {
2270 type Natural = crate::natural::AllocatorGetVmoInfoRequest;
2271 }
2272
2273 #[repr(C)]
2275 pub struct AllocatorGetVmoInfoResponse<'de> {
2276 pub(crate) table: ::fidl_next::wire::Table<'de>,
2277 }
2278
2279 impl<'de> Drop for AllocatorGetVmoInfoResponse<'de> {
2280 fn drop(&mut self) {
2281 let _ = self
2282 .table
2283 .get(1)
2284 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
2285
2286 let _ = self
2287 .table
2288 .get(2)
2289 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
2290
2291 let _ = self.table.get(3).map(|envelope| unsafe {
2292 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
2293 });
2294 }
2295 }
2296
2297 impl ::fidl_next::Constrained for AllocatorGetVmoInfoResponse<'_> {
2298 type Constraint = ();
2299
2300 fn validate(
2301 _: ::fidl_next::Slot<'_, Self>,
2302 _: Self::Constraint,
2303 ) -> Result<(), ::fidl_next::ValidationError> {
2304 Ok(())
2305 }
2306 }
2307
2308 unsafe impl ::fidl_next::Wire for AllocatorGetVmoInfoResponse<'static> {
2309 type Narrowed<'de> = AllocatorGetVmoInfoResponse<'de>;
2310
2311 #[inline]
2312 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2313 ::fidl_next::munge!(let Self { table } = out);
2314 ::fidl_next::wire::Table::zero_padding(table);
2315 }
2316 }
2317
2318 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for AllocatorGetVmoInfoResponse<'de>
2319 where
2320 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2321 ___D: ::fidl_next::fuchsia::HandleDecoder,
2322 {
2323 fn decode(
2324 slot: ::fidl_next::Slot<'_, Self>,
2325 decoder: &mut ___D,
2326 _: (),
2327 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2328 ::fidl_next::munge!(let Self { table } = slot);
2329
2330 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2331 match ordinal {
2332 0 => unsafe { ::core::hint::unreachable_unchecked() },
2333
2334 1 => {
2335 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
2336 slot.as_mut(),
2337 decoder,
2338 (),
2339 )?;
2340
2341 Ok(())
2342 }
2343
2344 2 => {
2345 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
2346 slot.as_mut(),
2347 decoder,
2348 (),
2349 )?;
2350
2351 Ok(())
2352 }
2353
2354 3 => {
2355 ::fidl_next::wire::Envelope::decode_as::<
2356 ___D,
2357 ::fidl_next::wire::fuchsia::EventPair,
2358 >(slot.as_mut(), decoder, ())?;
2359
2360 Ok(())
2361 }
2362
2363 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2364 }
2365 })
2366 }
2367 }
2368
2369 impl<'de> AllocatorGetVmoInfoResponse<'de> {
2370 pub fn buffer_collection_id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
2371 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2372 }
2373
2374 pub fn buffer_index(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
2375 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2376 }
2377
2378 pub fn close_weak_asap(
2379 &self,
2380 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
2381 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
2382 }
2383 }
2384
2385 impl<'de> ::core::fmt::Debug for AllocatorGetVmoInfoResponse<'de> {
2386 fn fmt(
2387 &self,
2388 f: &mut ::core::fmt::Formatter<'_>,
2389 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2390 f.debug_struct("AllocatorGetVmoInfoResponse")
2391 .field("buffer_collection_id", &self.buffer_collection_id())
2392 .field("buffer_index", &self.buffer_index())
2393 .field("close_weak_asap", &self.close_weak_asap())
2394 .finish()
2395 }
2396 }
2397
2398 impl<'de> ::fidl_next::IntoNatural for AllocatorGetVmoInfoResponse<'de> {
2399 type Natural = crate::natural::AllocatorGetVmoInfoResponse;
2400 }
2401
2402 #[repr(C)]
2404 pub struct AllocatorAllocateSharedCollectionRequest<'de> {
2405 pub(crate) table: ::fidl_next::wire::Table<'de>,
2406 }
2407
2408 impl<'de> Drop for AllocatorAllocateSharedCollectionRequest<'de> {
2409 fn drop(&mut self) {
2410 let _ = self.table.get(1).map(|envelope| unsafe {
2411 envelope.read_unchecked::<::fidl_next::ServerEnd<
2412 crate::BufferCollectionToken,
2413 ::fidl_next::wire::fuchsia::Channel,
2414 >>()
2415 });
2416 }
2417 }
2418
2419 impl ::fidl_next::Constrained for AllocatorAllocateSharedCollectionRequest<'_> {
2420 type Constraint = ();
2421
2422 fn validate(
2423 _: ::fidl_next::Slot<'_, Self>,
2424 _: Self::Constraint,
2425 ) -> Result<(), ::fidl_next::ValidationError> {
2426 Ok(())
2427 }
2428 }
2429
2430 unsafe impl ::fidl_next::Wire for AllocatorAllocateSharedCollectionRequest<'static> {
2431 type Narrowed<'de> = AllocatorAllocateSharedCollectionRequest<'de>;
2432
2433 #[inline]
2434 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2435 ::fidl_next::munge!(let Self { table } = out);
2436 ::fidl_next::wire::Table::zero_padding(table);
2437 }
2438 }
2439
2440 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for AllocatorAllocateSharedCollectionRequest<'de>
2441 where
2442 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2443 ___D: ::fidl_next::fuchsia::HandleDecoder,
2444 {
2445 fn decode(
2446 slot: ::fidl_next::Slot<'_, Self>,
2447 decoder: &mut ___D,
2448 _: (),
2449 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2450 ::fidl_next::munge!(let Self { table } = slot);
2451
2452 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2453 match ordinal {
2454 0 => unsafe { ::core::hint::unreachable_unchecked() },
2455
2456 1 => {
2457 ::fidl_next::wire::Envelope::decode_as::<
2458 ___D,
2459 ::fidl_next::ServerEnd<
2460 crate::BufferCollectionToken,
2461 ::fidl_next::wire::fuchsia::Channel,
2462 >,
2463 >(slot.as_mut(), decoder, ())?;
2464
2465 Ok(())
2466 }
2467
2468 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2469 }
2470 })
2471 }
2472 }
2473
2474 impl<'de> AllocatorAllocateSharedCollectionRequest<'de> {
2475 pub fn token_request(
2476 &self,
2477 ) -> ::core::option::Option<
2478 &::fidl_next::ServerEnd<
2479 crate::BufferCollectionToken,
2480 ::fidl_next::wire::fuchsia::Channel,
2481 >,
2482 > {
2483 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2484 }
2485 }
2486
2487 impl<'de> ::core::fmt::Debug for AllocatorAllocateSharedCollectionRequest<'de> {
2488 fn fmt(
2489 &self,
2490 f: &mut ::core::fmt::Formatter<'_>,
2491 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2492 f.debug_struct("AllocatorAllocateSharedCollectionRequest")
2493 .field("token_request", &self.token_request())
2494 .finish()
2495 }
2496 }
2497
2498 impl<'de> ::fidl_next::IntoNatural for AllocatorAllocateSharedCollectionRequest<'de> {
2499 type Natural = crate::natural::AllocatorAllocateSharedCollectionRequest;
2500 }
2501
2502 #[repr(C)]
2504 pub struct AllocatorAllocateNonSharedCollectionRequest<'de> {
2505 pub(crate) table: ::fidl_next::wire::Table<'de>,
2506 }
2507
2508 impl<'de> Drop for AllocatorAllocateNonSharedCollectionRequest<'de> {
2509 fn drop(&mut self) {
2510 let _ = self.table.get(1).map(|envelope| unsafe {
2511 envelope.read_unchecked::<::fidl_next::ServerEnd<
2512 crate::BufferCollection,
2513 ::fidl_next::wire::fuchsia::Channel,
2514 >>()
2515 });
2516 }
2517 }
2518
2519 impl ::fidl_next::Constrained for AllocatorAllocateNonSharedCollectionRequest<'_> {
2520 type Constraint = ();
2521
2522 fn validate(
2523 _: ::fidl_next::Slot<'_, Self>,
2524 _: Self::Constraint,
2525 ) -> Result<(), ::fidl_next::ValidationError> {
2526 Ok(())
2527 }
2528 }
2529
2530 unsafe impl ::fidl_next::Wire for AllocatorAllocateNonSharedCollectionRequest<'static> {
2531 type Narrowed<'de> = AllocatorAllocateNonSharedCollectionRequest<'de>;
2532
2533 #[inline]
2534 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2535 ::fidl_next::munge!(let Self { table } = out);
2536 ::fidl_next::wire::Table::zero_padding(table);
2537 }
2538 }
2539
2540 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
2541 for AllocatorAllocateNonSharedCollectionRequest<'de>
2542 where
2543 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2544 ___D: ::fidl_next::fuchsia::HandleDecoder,
2545 {
2546 fn decode(
2547 slot: ::fidl_next::Slot<'_, Self>,
2548 decoder: &mut ___D,
2549 _: (),
2550 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2551 ::fidl_next::munge!(let Self { table } = slot);
2552
2553 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2554 match ordinal {
2555 0 => unsafe { ::core::hint::unreachable_unchecked() },
2556
2557 1 => {
2558 ::fidl_next::wire::Envelope::decode_as::<
2559 ___D,
2560 ::fidl_next::ServerEnd<
2561 crate::BufferCollection,
2562 ::fidl_next::wire::fuchsia::Channel,
2563 >,
2564 >(slot.as_mut(), decoder, ())?;
2565
2566 Ok(())
2567 }
2568
2569 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2570 }
2571 })
2572 }
2573 }
2574
2575 impl<'de> AllocatorAllocateNonSharedCollectionRequest<'de> {
2576 pub fn collection_request(
2577 &self,
2578 ) -> ::core::option::Option<
2579 &::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::wire::fuchsia::Channel>,
2580 > {
2581 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2582 }
2583 }
2584
2585 impl<'de> ::core::fmt::Debug for AllocatorAllocateNonSharedCollectionRequest<'de> {
2586 fn fmt(
2587 &self,
2588 f: &mut ::core::fmt::Formatter<'_>,
2589 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2590 f.debug_struct("AllocatorAllocateNonSharedCollectionRequest")
2591 .field("collection_request", &self.collection_request())
2592 .finish()
2593 }
2594 }
2595
2596 impl<'de> ::fidl_next::IntoNatural for AllocatorAllocateNonSharedCollectionRequest<'de> {
2597 type Natural = crate::natural::AllocatorAllocateNonSharedCollectionRequest;
2598 }
2599
2600 #[repr(C)]
2602 pub struct AllocatorBindSharedCollectionRequest<'de> {
2603 pub(crate) table: ::fidl_next::wire::Table<'de>,
2604 }
2605
2606 impl<'de> Drop for AllocatorBindSharedCollectionRequest<'de> {
2607 fn drop(&mut self) {
2608 let _ = self.table.get(1).map(|envelope| unsafe {
2609 envelope.read_unchecked::<::fidl_next::ClientEnd<
2610 crate::BufferCollectionToken,
2611 ::fidl_next::wire::fuchsia::Channel,
2612 >>()
2613 });
2614
2615 let _ = self.table.get(2).map(|envelope| unsafe {
2616 envelope.read_unchecked::<::fidl_next::ServerEnd<
2617 crate::BufferCollection,
2618 ::fidl_next::wire::fuchsia::Channel,
2619 >>()
2620 });
2621 }
2622 }
2623
2624 impl ::fidl_next::Constrained for AllocatorBindSharedCollectionRequest<'_> {
2625 type Constraint = ();
2626
2627 fn validate(
2628 _: ::fidl_next::Slot<'_, Self>,
2629 _: Self::Constraint,
2630 ) -> Result<(), ::fidl_next::ValidationError> {
2631 Ok(())
2632 }
2633 }
2634
2635 unsafe impl ::fidl_next::Wire for AllocatorBindSharedCollectionRequest<'static> {
2636 type Narrowed<'de> = AllocatorBindSharedCollectionRequest<'de>;
2637
2638 #[inline]
2639 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2640 ::fidl_next::munge!(let Self { table } = out);
2641 ::fidl_next::wire::Table::zero_padding(table);
2642 }
2643 }
2644
2645 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for AllocatorBindSharedCollectionRequest<'de>
2646 where
2647 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2648 ___D: ::fidl_next::fuchsia::HandleDecoder,
2649 {
2650 fn decode(
2651 slot: ::fidl_next::Slot<'_, Self>,
2652 decoder: &mut ___D,
2653 _: (),
2654 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2655 ::fidl_next::munge!(let Self { table } = slot);
2656
2657 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2658 match ordinal {
2659 0 => unsafe { ::core::hint::unreachable_unchecked() },
2660
2661 1 => {
2662 ::fidl_next::wire::Envelope::decode_as::<
2663 ___D,
2664 ::fidl_next::ClientEnd<
2665 crate::BufferCollectionToken,
2666 ::fidl_next::wire::fuchsia::Channel,
2667 >,
2668 >(slot.as_mut(), decoder, ())?;
2669
2670 Ok(())
2671 }
2672
2673 2 => {
2674 ::fidl_next::wire::Envelope::decode_as::<
2675 ___D,
2676 ::fidl_next::ServerEnd<
2677 crate::BufferCollection,
2678 ::fidl_next::wire::fuchsia::Channel,
2679 >,
2680 >(slot.as_mut(), decoder, ())?;
2681
2682 Ok(())
2683 }
2684
2685 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2686 }
2687 })
2688 }
2689 }
2690
2691 impl<'de> AllocatorBindSharedCollectionRequest<'de> {
2692 pub fn token(
2693 &self,
2694 ) -> ::core::option::Option<
2695 &::fidl_next::ClientEnd<
2696 crate::BufferCollectionToken,
2697 ::fidl_next::wire::fuchsia::Channel,
2698 >,
2699 > {
2700 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2701 }
2702
2703 pub fn buffer_collection_request(
2704 &self,
2705 ) -> ::core::option::Option<
2706 &::fidl_next::ServerEnd<crate::BufferCollection, ::fidl_next::wire::fuchsia::Channel>,
2707 > {
2708 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
2709 }
2710 }
2711
2712 impl<'de> ::core::fmt::Debug for AllocatorBindSharedCollectionRequest<'de> {
2713 fn fmt(
2714 &self,
2715 f: &mut ::core::fmt::Formatter<'_>,
2716 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2717 f.debug_struct("AllocatorBindSharedCollectionRequest")
2718 .field("token", &self.token())
2719 .field("buffer_collection_request", &self.buffer_collection_request())
2720 .finish()
2721 }
2722 }
2723
2724 impl<'de> ::fidl_next::IntoNatural for AllocatorBindSharedCollectionRequest<'de> {
2725 type Natural = crate::natural::AllocatorBindSharedCollectionRequest;
2726 }
2727
2728 #[repr(C)]
2730 pub struct NodeGetNodeRefResponse<'de> {
2731 pub(crate) table: ::fidl_next::wire::Table<'de>,
2732 }
2733
2734 impl<'de> Drop for NodeGetNodeRefResponse<'de> {
2735 fn drop(&mut self) {
2736 let _ = self.table.get(1).map(|envelope| unsafe {
2737 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2738 });
2739 }
2740 }
2741
2742 impl ::fidl_next::Constrained for NodeGetNodeRefResponse<'_> {
2743 type Constraint = ();
2744
2745 fn validate(
2746 _: ::fidl_next::Slot<'_, Self>,
2747 _: Self::Constraint,
2748 ) -> Result<(), ::fidl_next::ValidationError> {
2749 Ok(())
2750 }
2751 }
2752
2753 unsafe impl ::fidl_next::Wire for NodeGetNodeRefResponse<'static> {
2754 type Narrowed<'de> = NodeGetNodeRefResponse<'de>;
2755
2756 #[inline]
2757 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2758 ::fidl_next::munge!(let Self { table } = out);
2759 ::fidl_next::wire::Table::zero_padding(table);
2760 }
2761 }
2762
2763 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeGetNodeRefResponse<'de>
2764 where
2765 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2766 ___D: ::fidl_next::fuchsia::HandleDecoder,
2767 {
2768 fn decode(
2769 slot: ::fidl_next::Slot<'_, Self>,
2770 decoder: &mut ___D,
2771 _: (),
2772 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2773 ::fidl_next::munge!(let Self { table } = slot);
2774
2775 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2776 match ordinal {
2777 0 => unsafe { ::core::hint::unreachable_unchecked() },
2778
2779 1 => {
2780 ::fidl_next::wire::Envelope::decode_as::<
2781 ___D,
2782 ::fidl_next::wire::fuchsia::Event,
2783 >(slot.as_mut(), decoder, ())?;
2784
2785 Ok(())
2786 }
2787
2788 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2789 }
2790 })
2791 }
2792 }
2793
2794 impl<'de> NodeGetNodeRefResponse<'de> {
2795 pub fn node_ref(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2796 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2797 }
2798 }
2799
2800 impl<'de> ::core::fmt::Debug for NodeGetNodeRefResponse<'de> {
2801 fn fmt(
2802 &self,
2803 f: &mut ::core::fmt::Formatter<'_>,
2804 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2805 f.debug_struct("NodeGetNodeRefResponse").field("node_ref", &self.node_ref()).finish()
2806 }
2807 }
2808
2809 impl<'de> ::fidl_next::IntoNatural for NodeGetNodeRefResponse<'de> {
2810 type Natural = crate::natural::NodeGetNodeRefResponse;
2811 }
2812
2813 #[repr(C)]
2815 pub struct NodeIsAlternateForRequest<'de> {
2816 pub(crate) table: ::fidl_next::wire::Table<'de>,
2817 }
2818
2819 impl<'de> Drop for NodeIsAlternateForRequest<'de> {
2820 fn drop(&mut self) {
2821 let _ = self.table.get(1).map(|envelope| unsafe {
2822 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Event>()
2823 });
2824 }
2825 }
2826
2827 impl ::fidl_next::Constrained for NodeIsAlternateForRequest<'_> {
2828 type Constraint = ();
2829
2830 fn validate(
2831 _: ::fidl_next::Slot<'_, Self>,
2832 _: Self::Constraint,
2833 ) -> Result<(), ::fidl_next::ValidationError> {
2834 Ok(())
2835 }
2836 }
2837
2838 unsafe impl ::fidl_next::Wire for NodeIsAlternateForRequest<'static> {
2839 type Narrowed<'de> = NodeIsAlternateForRequest<'de>;
2840
2841 #[inline]
2842 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2843 ::fidl_next::munge!(let Self { table } = out);
2844 ::fidl_next::wire::Table::zero_padding(table);
2845 }
2846 }
2847
2848 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeIsAlternateForRequest<'de>
2849 where
2850 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2851 ___D: ::fidl_next::fuchsia::HandleDecoder,
2852 {
2853 fn decode(
2854 slot: ::fidl_next::Slot<'_, Self>,
2855 decoder: &mut ___D,
2856 _: (),
2857 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2858 ::fidl_next::munge!(let Self { table } = slot);
2859
2860 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2861 match ordinal {
2862 0 => unsafe { ::core::hint::unreachable_unchecked() },
2863
2864 1 => {
2865 ::fidl_next::wire::Envelope::decode_as::<
2866 ___D,
2867 ::fidl_next::wire::fuchsia::Event,
2868 >(slot.as_mut(), decoder, ())?;
2869
2870 Ok(())
2871 }
2872
2873 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2874 }
2875 })
2876 }
2877 }
2878
2879 impl<'de> NodeIsAlternateForRequest<'de> {
2880 pub fn node_ref(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Event> {
2881 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2882 }
2883 }
2884
2885 impl<'de> ::core::fmt::Debug for NodeIsAlternateForRequest<'de> {
2886 fn fmt(
2887 &self,
2888 f: &mut ::core::fmt::Formatter<'_>,
2889 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2890 f.debug_struct("NodeIsAlternateForRequest").field("node_ref", &self.node_ref()).finish()
2891 }
2892 }
2893
2894 impl<'de> ::fidl_next::IntoNatural for NodeIsAlternateForRequest<'de> {
2895 type Natural = crate::natural::NodeIsAlternateForRequest;
2896 }
2897
2898 #[repr(C)]
2900 pub struct NodeSetWeakOkRequest<'de> {
2901 pub(crate) table: ::fidl_next::wire::Table<'de>,
2902 }
2903
2904 impl<'de> Drop for NodeSetWeakOkRequest<'de> {
2905 fn drop(&mut self) {
2906 let _ = self.table.get(1).map(|envelope| unsafe { envelope.read_unchecked::<bool>() });
2907 }
2908 }
2909
2910 impl ::fidl_next::Constrained for NodeSetWeakOkRequest<'_> {
2911 type Constraint = ();
2912
2913 fn validate(
2914 _: ::fidl_next::Slot<'_, Self>,
2915 _: Self::Constraint,
2916 ) -> Result<(), ::fidl_next::ValidationError> {
2917 Ok(())
2918 }
2919 }
2920
2921 unsafe impl ::fidl_next::Wire for NodeSetWeakOkRequest<'static> {
2922 type Narrowed<'de> = NodeSetWeakOkRequest<'de>;
2923
2924 #[inline]
2925 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
2926 ::fidl_next::munge!(let Self { table } = out);
2927 ::fidl_next::wire::Table::zero_padding(table);
2928 }
2929 }
2930
2931 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeSetWeakOkRequest<'de>
2932 where
2933 ___D: ::fidl_next::Decoder<'de> + ?Sized,
2934 ___D: ::fidl_next::fuchsia::HandleDecoder,
2935 {
2936 fn decode(
2937 slot: ::fidl_next::Slot<'_, Self>,
2938 decoder: &mut ___D,
2939 _: (),
2940 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
2941 ::fidl_next::munge!(let Self { table } = slot);
2942
2943 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
2944 match ordinal {
2945 0 => unsafe { ::core::hint::unreachable_unchecked() },
2946
2947 1 => {
2948 ::fidl_next::wire::Envelope::decode_as::<___D, bool>(
2949 slot.as_mut(),
2950 decoder,
2951 (),
2952 )?;
2953
2954 Ok(())
2955 }
2956
2957 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
2958 }
2959 })
2960 }
2961 }
2962
2963 impl<'de> NodeSetWeakOkRequest<'de> {
2964 pub fn for_child_nodes_also(&self) -> ::core::option::Option<&bool> {
2965 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
2966 }
2967 }
2968
2969 impl<'de> ::core::fmt::Debug for NodeSetWeakOkRequest<'de> {
2970 fn fmt(
2971 &self,
2972 f: &mut ::core::fmt::Formatter<'_>,
2973 ) -> ::core::result::Result<(), ::core::fmt::Error> {
2974 f.debug_struct("NodeSetWeakOkRequest")
2975 .field("for_child_nodes_also", &self.for_child_nodes_also())
2976 .finish()
2977 }
2978 }
2979
2980 impl<'de> ::fidl_next::IntoNatural for NodeSetWeakOkRequest<'de> {
2981 type Natural = crate::natural::NodeSetWeakOkRequest;
2982 }
2983
2984 #[repr(C)]
2986 pub struct VmoBuffer<'de> {
2987 pub(crate) table: ::fidl_next::wire::Table<'de>,
2988 }
2989
2990 impl<'de> Drop for VmoBuffer<'de> {
2991 fn drop(&mut self) {
2992 let _ = self.table.get(1).map(|envelope| unsafe {
2993 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Vmo>()
2994 });
2995
2996 let _ = self
2997 .table
2998 .get(2)
2999 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
3000
3001 let _ = self.table.get(3).map(|envelope| unsafe {
3002 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
3003 });
3004 }
3005 }
3006
3007 impl ::fidl_next::Constrained for VmoBuffer<'_> {
3008 type Constraint = ();
3009
3010 fn validate(
3011 _: ::fidl_next::Slot<'_, Self>,
3012 _: Self::Constraint,
3013 ) -> Result<(), ::fidl_next::ValidationError> {
3014 Ok(())
3015 }
3016 }
3017
3018 unsafe impl ::fidl_next::Wire for VmoBuffer<'static> {
3019 type Narrowed<'de> = VmoBuffer<'de>;
3020
3021 #[inline]
3022 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3023 ::fidl_next::munge!(let Self { table } = out);
3024 ::fidl_next::wire::Table::zero_padding(table);
3025 }
3026 }
3027
3028 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for VmoBuffer<'de>
3029 where
3030 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3031 ___D: ::fidl_next::fuchsia::HandleDecoder,
3032 {
3033 fn decode(
3034 slot: ::fidl_next::Slot<'_, Self>,
3035 decoder: &mut ___D,
3036 _: (),
3037 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3038 ::fidl_next::munge!(let Self { table } = slot);
3039
3040 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3041 match ordinal {
3042 0 => unsafe { ::core::hint::unreachable_unchecked() },
3043
3044 1 => {
3045 ::fidl_next::wire::Envelope::decode_as::<
3046 ___D,
3047 ::fidl_next::wire::fuchsia::Vmo,
3048 >(slot.as_mut(), decoder, ())?;
3049
3050 Ok(())
3051 }
3052
3053 2 => {
3054 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
3055 slot.as_mut(),
3056 decoder,
3057 (),
3058 )?;
3059
3060 Ok(())
3061 }
3062
3063 3 => {
3064 ::fidl_next::wire::Envelope::decode_as::<
3065 ___D,
3066 ::fidl_next::wire::fuchsia::EventPair,
3067 >(slot.as_mut(), decoder, ())?;
3068
3069 Ok(())
3070 }
3071
3072 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3073 }
3074 })
3075 }
3076 }
3077
3078 impl<'de> VmoBuffer<'de> {
3079 pub fn vmo(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Vmo> {
3080 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3081 }
3082
3083 pub fn vmo_usable_start(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
3084 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3085 }
3086
3087 pub fn close_weak_asap(
3088 &self,
3089 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
3090 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
3091 }
3092 }
3093
3094 impl<'de> ::core::fmt::Debug for VmoBuffer<'de> {
3095 fn fmt(
3096 &self,
3097 f: &mut ::core::fmt::Formatter<'_>,
3098 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3099 f.debug_struct("VmoBuffer")
3100 .field("vmo", &self.vmo())
3101 .field("vmo_usable_start", &self.vmo_usable_start())
3102 .field("close_weak_asap", &self.close_weak_asap())
3103 .finish()
3104 }
3105 }
3106
3107 impl<'de> ::fidl_next::IntoNatural for VmoBuffer<'de> {
3108 type Natural = crate::natural::VmoBuffer;
3109 }
3110
3111 #[repr(C)]
3113 pub struct BufferCollectionAttachLifetimeTrackingRequest<'de> {
3114 pub(crate) table: ::fidl_next::wire::Table<'de>,
3115 }
3116
3117 impl<'de> Drop for BufferCollectionAttachLifetimeTrackingRequest<'de> {
3118 fn drop(&mut self) {
3119 let _ = self.table.get(1).map(|envelope| unsafe {
3120 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
3121 });
3122
3123 let _ = self
3124 .table
3125 .get(2)
3126 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint32>() });
3127 }
3128 }
3129
3130 impl ::fidl_next::Constrained for BufferCollectionAttachLifetimeTrackingRequest<'_> {
3131 type Constraint = ();
3132
3133 fn validate(
3134 _: ::fidl_next::Slot<'_, Self>,
3135 _: Self::Constraint,
3136 ) -> Result<(), ::fidl_next::ValidationError> {
3137 Ok(())
3138 }
3139 }
3140
3141 unsafe impl ::fidl_next::Wire for BufferCollectionAttachLifetimeTrackingRequest<'static> {
3142 type Narrowed<'de> = BufferCollectionAttachLifetimeTrackingRequest<'de>;
3143
3144 #[inline]
3145 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3146 ::fidl_next::munge!(let Self { table } = out);
3147 ::fidl_next::wire::Table::zero_padding(table);
3148 }
3149 }
3150
3151 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
3152 for BufferCollectionAttachLifetimeTrackingRequest<'de>
3153 where
3154 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3155 ___D: ::fidl_next::fuchsia::HandleDecoder,
3156 {
3157 fn decode(
3158 slot: ::fidl_next::Slot<'_, Self>,
3159 decoder: &mut ___D,
3160 _: (),
3161 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3162 ::fidl_next::munge!(let Self { table } = slot);
3163
3164 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3165 match ordinal {
3166 0 => unsafe { ::core::hint::unreachable_unchecked() },
3167
3168 1 => {
3169 ::fidl_next::wire::Envelope::decode_as::<
3170 ___D,
3171 ::fidl_next::wire::fuchsia::EventPair,
3172 >(slot.as_mut(), decoder, ())?;
3173
3174 Ok(())
3175 }
3176
3177 2 => {
3178 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint32>(
3179 slot.as_mut(),
3180 decoder,
3181 (),
3182 )?;
3183
3184 Ok(())
3185 }
3186
3187 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3188 }
3189 })
3190 }
3191 }
3192
3193 impl<'de> BufferCollectionAttachLifetimeTrackingRequest<'de> {
3194 pub fn server_end(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
3195 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3196 }
3197
3198 pub fn buffers_remaining(&self) -> ::core::option::Option<&::fidl_next::wire::Uint32> {
3199 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3200 }
3201 }
3202
3203 impl<'de> ::core::fmt::Debug for BufferCollectionAttachLifetimeTrackingRequest<'de> {
3204 fn fmt(
3205 &self,
3206 f: &mut ::core::fmt::Formatter<'_>,
3207 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3208 f.debug_struct("BufferCollectionAttachLifetimeTrackingRequest")
3209 .field("server_end", &self.server_end())
3210 .field("buffers_remaining", &self.buffers_remaining())
3211 .finish()
3212 }
3213 }
3214
3215 impl<'de> ::fidl_next::IntoNatural for BufferCollectionAttachLifetimeTrackingRequest<'de> {
3216 type Natural = crate::natural::BufferCollectionAttachLifetimeTrackingRequest;
3217 }
3218
3219 #[repr(C)]
3221 pub struct NodeAttachNodeTrackingRequest<'de> {
3222 pub(crate) table: ::fidl_next::wire::Table<'de>,
3223 }
3224
3225 impl<'de> Drop for NodeAttachNodeTrackingRequest<'de> {
3226 fn drop(&mut self) {
3227 let _ = self.table.get(1).map(|envelope| unsafe {
3228 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
3229 });
3230 }
3231 }
3232
3233 impl ::fidl_next::Constrained for NodeAttachNodeTrackingRequest<'_> {
3234 type Constraint = ();
3235
3236 fn validate(
3237 _: ::fidl_next::Slot<'_, Self>,
3238 _: Self::Constraint,
3239 ) -> Result<(), ::fidl_next::ValidationError> {
3240 Ok(())
3241 }
3242 }
3243
3244 unsafe impl ::fidl_next::Wire for NodeAttachNodeTrackingRequest<'static> {
3245 type Narrowed<'de> = NodeAttachNodeTrackingRequest<'de>;
3246
3247 #[inline]
3248 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3249 ::fidl_next::munge!(let Self { table } = out);
3250 ::fidl_next::wire::Table::zero_padding(table);
3251 }
3252 }
3253
3254 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for NodeAttachNodeTrackingRequest<'de>
3255 where
3256 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3257 ___D: ::fidl_next::fuchsia::HandleDecoder,
3258 {
3259 fn decode(
3260 slot: ::fidl_next::Slot<'_, Self>,
3261 decoder: &mut ___D,
3262 _: (),
3263 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3264 ::fidl_next::munge!(let Self { table } = slot);
3265
3266 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3267 match ordinal {
3268 0 => unsafe { ::core::hint::unreachable_unchecked() },
3269
3270 1 => {
3271 ::fidl_next::wire::Envelope::decode_as::<
3272 ___D,
3273 ::fidl_next::wire::fuchsia::EventPair,
3274 >(slot.as_mut(), decoder, ())?;
3275
3276 Ok(())
3277 }
3278
3279 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3280 }
3281 })
3282 }
3283 }
3284
3285 impl<'de> NodeAttachNodeTrackingRequest<'de> {
3286 pub fn server_end(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
3287 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3288 }
3289 }
3290
3291 impl<'de> ::core::fmt::Debug for NodeAttachNodeTrackingRequest<'de> {
3292 fn fmt(
3293 &self,
3294 f: &mut ::core::fmt::Formatter<'_>,
3295 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3296 f.debug_struct("NodeAttachNodeTrackingRequest")
3297 .field("server_end", &self.server_end())
3298 .finish()
3299 }
3300 }
3301
3302 impl<'de> ::fidl_next::IntoNatural for NodeAttachNodeTrackingRequest<'de> {
3303 type Natural = crate::natural::NodeAttachNodeTrackingRequest;
3304 }
3305
3306 #[repr(C)]
3308 pub struct BufferCollectionAttachTokenRequest<'de> {
3309 pub(crate) table: ::fidl_next::wire::Table<'de>,
3310 }
3311
3312 impl<'de> Drop for BufferCollectionAttachTokenRequest<'de> {
3313 fn drop(&mut self) {
3314 let _ = self.table.get(1).map(|envelope| unsafe {
3315 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
3316 });
3317
3318 let _ = self.table.get(2).map(|envelope| unsafe {
3319 envelope.read_unchecked::<::fidl_next::ServerEnd<
3320 crate::BufferCollectionToken,
3321 ::fidl_next::wire::fuchsia::Channel,
3322 >>()
3323 });
3324 }
3325 }
3326
3327 impl ::fidl_next::Constrained for BufferCollectionAttachTokenRequest<'_> {
3328 type Constraint = ();
3329
3330 fn validate(
3331 _: ::fidl_next::Slot<'_, Self>,
3332 _: Self::Constraint,
3333 ) -> Result<(), ::fidl_next::ValidationError> {
3334 Ok(())
3335 }
3336 }
3337
3338 unsafe impl ::fidl_next::Wire for BufferCollectionAttachTokenRequest<'static> {
3339 type Narrowed<'de> = BufferCollectionAttachTokenRequest<'de>;
3340
3341 #[inline]
3342 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3343 ::fidl_next::munge!(let Self { table } = out);
3344 ::fidl_next::wire::Table::zero_padding(table);
3345 }
3346 }
3347
3348 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionAttachTokenRequest<'de>
3349 where
3350 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3351 ___D: ::fidl_next::fuchsia::HandleDecoder,
3352 {
3353 fn decode(
3354 slot: ::fidl_next::Slot<'_, Self>,
3355 decoder: &mut ___D,
3356 _: (),
3357 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3358 ::fidl_next::munge!(let Self { table } = slot);
3359
3360 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3361 match ordinal {
3362 0 => unsafe { ::core::hint::unreachable_unchecked() },
3363
3364 1 => {
3365 ::fidl_next::wire::Envelope::decode_as::<
3366 ___D,
3367 ::fidl_next::wire::fuchsia::Rights,
3368 >(slot.as_mut(), decoder, ())?;
3369
3370 Ok(())
3371 }
3372
3373 2 => {
3374 ::fidl_next::wire::Envelope::decode_as::<
3375 ___D,
3376 ::fidl_next::ServerEnd<
3377 crate::BufferCollectionToken,
3378 ::fidl_next::wire::fuchsia::Channel,
3379 >,
3380 >(slot.as_mut(), decoder, ())?;
3381
3382 Ok(())
3383 }
3384
3385 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3386 }
3387 })
3388 }
3389 }
3390
3391 impl<'de> BufferCollectionAttachTokenRequest<'de> {
3392 pub fn rights_attenuation_mask(
3393 &self,
3394 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Rights> {
3395 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3396 }
3397
3398 pub fn token_request(
3399 &self,
3400 ) -> ::core::option::Option<
3401 &::fidl_next::ServerEnd<
3402 crate::BufferCollectionToken,
3403 ::fidl_next::wire::fuchsia::Channel,
3404 >,
3405 > {
3406 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3407 }
3408 }
3409
3410 impl<'de> ::core::fmt::Debug for BufferCollectionAttachTokenRequest<'de> {
3411 fn fmt(
3412 &self,
3413 f: &mut ::core::fmt::Formatter<'_>,
3414 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3415 f.debug_struct("BufferCollectionAttachTokenRequest")
3416 .field("rights_attenuation_mask", &self.rights_attenuation_mask())
3417 .field("token_request", &self.token_request())
3418 .finish()
3419 }
3420 }
3421
3422 impl<'de> ::fidl_next::IntoNatural for BufferCollectionAttachTokenRequest<'de> {
3423 type Natural = crate::natural::BufferCollectionAttachTokenRequest;
3424 }
3425
3426 #[repr(C)]
3428 pub struct BufferCollectionSetConstraintsRequest<'de> {
3429 pub(crate) table: ::fidl_next::wire::Table<'de>,
3430 }
3431
3432 impl<'de> Drop for BufferCollectionSetConstraintsRequest<'de> {
3433 fn drop(&mut self) {
3434 let _ = self.table.get(1).map(|envelope| unsafe {
3435 envelope.read_unchecked::<crate::wire::BufferCollectionConstraints<'de>>()
3436 });
3437 }
3438 }
3439
3440 impl ::fidl_next::Constrained for BufferCollectionSetConstraintsRequest<'_> {
3441 type Constraint = ();
3442
3443 fn validate(
3444 _: ::fidl_next::Slot<'_, Self>,
3445 _: Self::Constraint,
3446 ) -> Result<(), ::fidl_next::ValidationError> {
3447 Ok(())
3448 }
3449 }
3450
3451 unsafe impl ::fidl_next::Wire for BufferCollectionSetConstraintsRequest<'static> {
3452 type Narrowed<'de> = BufferCollectionSetConstraintsRequest<'de>;
3453
3454 #[inline]
3455 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3456 ::fidl_next::munge!(let Self { table } = out);
3457 ::fidl_next::wire::Table::zero_padding(table);
3458 }
3459 }
3460
3461 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionSetConstraintsRequest<'de>
3462 where
3463 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3464 ___D: ::fidl_next::fuchsia::HandleDecoder,
3465 {
3466 fn decode(
3467 slot: ::fidl_next::Slot<'_, Self>,
3468 decoder: &mut ___D,
3469 _: (),
3470 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3471 ::fidl_next::munge!(let Self { table } = slot);
3472
3473 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3474 match ordinal {
3475 0 => unsafe { ::core::hint::unreachable_unchecked() },
3476
3477 1 => {
3478 ::fidl_next::wire::Envelope::decode_as::<
3479 ___D,
3480 crate::wire::BufferCollectionConstraints<'de>,
3481 >(slot.as_mut(), decoder, ())?;
3482
3483 Ok(())
3484 }
3485
3486 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3487 }
3488 })
3489 }
3490 }
3491
3492 impl<'de> BufferCollectionSetConstraintsRequest<'de> {
3493 pub fn constraints(
3494 &self,
3495 ) -> ::core::option::Option<&crate::wire::BufferCollectionConstraints<'de>> {
3496 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3497 }
3498 }
3499
3500 impl<'de> ::core::fmt::Debug for BufferCollectionSetConstraintsRequest<'de> {
3501 fn fmt(
3502 &self,
3503 f: &mut ::core::fmt::Formatter<'_>,
3504 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3505 f.debug_struct("BufferCollectionSetConstraintsRequest")
3506 .field("constraints", &self.constraints())
3507 .finish()
3508 }
3509 }
3510
3511 impl<'de> ::fidl_next::IntoNatural for BufferCollectionSetConstraintsRequest<'de> {
3512 type Natural = crate::natural::BufferCollectionSetConstraintsRequest;
3513 }
3514
3515 #[repr(C)]
3517 pub struct BufferCollectionInfo<'de> {
3518 pub(crate) table: ::fidl_next::wire::Table<'de>,
3519 }
3520
3521 impl<'de> Drop for BufferCollectionInfo<'de> {
3522 fn drop(&mut self) {
3523 let _ = self.table.get(1).map(|envelope| unsafe {
3524 envelope.read_unchecked::<crate::wire::SingleBufferSettings<'de>>()
3525 });
3526
3527 let _ = self.table.get(2)
3528 .map(|envelope| unsafe {
3529 envelope.read_unchecked::<::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>>()
3530 });
3531
3532 let _ = self
3533 .table
3534 .get(3)
3535 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
3536 }
3537 }
3538
3539 impl ::fidl_next::Constrained for BufferCollectionInfo<'_> {
3540 type Constraint = ();
3541
3542 fn validate(
3543 _: ::fidl_next::Slot<'_, Self>,
3544 _: Self::Constraint,
3545 ) -> Result<(), ::fidl_next::ValidationError> {
3546 Ok(())
3547 }
3548 }
3549
3550 unsafe impl ::fidl_next::Wire for BufferCollectionInfo<'static> {
3551 type Narrowed<'de> = BufferCollectionInfo<'de>;
3552
3553 #[inline]
3554 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3555 ::fidl_next::munge!(let Self { table } = out);
3556 ::fidl_next::wire::Table::zero_padding(table);
3557 }
3558 }
3559
3560 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionInfo<'de>
3561 where
3562 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3563 ___D: ::fidl_next::fuchsia::HandleDecoder,
3564 {
3565 fn decode(
3566 slot: ::fidl_next::Slot<'_, Self>,
3567 decoder: &mut ___D,
3568 _: (),
3569 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3570 ::fidl_next::munge!(let Self { table } = slot);
3571
3572 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3573 match ordinal {
3574 0 => unsafe { ::core::hint::unreachable_unchecked() },
3575
3576 1 => {
3577 ::fidl_next::wire::Envelope::decode_as::<
3578 ___D,
3579 crate::wire::SingleBufferSettings<'de>,
3580 >(slot.as_mut(), decoder, ())?;
3581
3582 Ok(())
3583 }
3584
3585 2 => {
3586 ::fidl_next::wire::Envelope::decode_as::<
3587 ___D,
3588 ::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>,
3589 >(slot.as_mut(), decoder, (128, ()))?;
3590
3591 let value = unsafe {
3592 slot
3593 .deref_unchecked()
3594 .deref_unchecked::<
3595 ::fidl_next::wire::Vector<'_, crate::wire::VmoBuffer<'_>>
3596 >()
3597 };
3598
3599 if value.len() > 128 {
3600 return Err(::fidl_next::DecodeError::VectorTooLong {
3601 size: value.len() as u64,
3602 limit: 128,
3603 });
3604 }
3605
3606 Ok(())
3607 }
3608
3609 3 => {
3610 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
3611 slot.as_mut(),
3612 decoder,
3613 (),
3614 )?;
3615
3616 Ok(())
3617 }
3618
3619 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3620 }
3621 })
3622 }
3623 }
3624
3625 impl<'de> BufferCollectionInfo<'de> {
3626 pub fn settings(&self) -> ::core::option::Option<&crate::wire::SingleBufferSettings<'de>> {
3627 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3628 }
3629
3630 pub fn buffers(
3631 &self,
3632 ) -> ::core::option::Option<&::fidl_next::wire::Vector<'de, crate::wire::VmoBuffer<'de>>>
3633 {
3634 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3635 }
3636
3637 pub fn buffer_collection_id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
3638 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
3639 }
3640 }
3641
3642 impl<'de> ::core::fmt::Debug for BufferCollectionInfo<'de> {
3643 fn fmt(
3644 &self,
3645 f: &mut ::core::fmt::Formatter<'_>,
3646 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3647 f.debug_struct("BufferCollectionInfo")
3648 .field("settings", &self.settings())
3649 .field("buffers", &self.buffers())
3650 .field("buffer_collection_id", &self.buffer_collection_id())
3651 .finish()
3652 }
3653 }
3654
3655 impl<'de> ::fidl_next::IntoNatural for BufferCollectionInfo<'de> {
3656 type Natural = crate::natural::BufferCollectionInfo;
3657 }
3658
3659 #[repr(C)]
3661 pub struct BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
3662 pub(crate) table: ::fidl_next::wire::Table<'de>,
3663 }
3664
3665 impl<'de> Drop for BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
3666 fn drop(&mut self) {
3667 let _ = self.table.get(1).map(|envelope| unsafe {
3668 envelope.read_unchecked::<crate::wire::BufferCollectionInfo<'de>>()
3669 });
3670 }
3671 }
3672
3673 impl ::fidl_next::Constrained for BufferCollectionWaitForAllBuffersAllocatedResponse<'_> {
3674 type Constraint = ();
3675
3676 fn validate(
3677 _: ::fidl_next::Slot<'_, Self>,
3678 _: Self::Constraint,
3679 ) -> Result<(), ::fidl_next::ValidationError> {
3680 Ok(())
3681 }
3682 }
3683
3684 unsafe impl ::fidl_next::Wire for BufferCollectionWaitForAllBuffersAllocatedResponse<'static> {
3685 type Narrowed<'de> = BufferCollectionWaitForAllBuffersAllocatedResponse<'de>;
3686
3687 #[inline]
3688 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3689 ::fidl_next::munge!(let Self { table } = out);
3690 ::fidl_next::wire::Table::zero_padding(table);
3691 }
3692 }
3693
3694 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
3695 for BufferCollectionWaitForAllBuffersAllocatedResponse<'de>
3696 where
3697 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3698 ___D: ::fidl_next::fuchsia::HandleDecoder,
3699 {
3700 fn decode(
3701 slot: ::fidl_next::Slot<'_, Self>,
3702 decoder: &mut ___D,
3703 _: (),
3704 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3705 ::fidl_next::munge!(let Self { table } = slot);
3706
3707 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3708 match ordinal {
3709 0 => unsafe { ::core::hint::unreachable_unchecked() },
3710
3711 1 => {
3712 ::fidl_next::wire::Envelope::decode_as::<
3713 ___D,
3714 crate::wire::BufferCollectionInfo<'de>,
3715 >(slot.as_mut(), decoder, ())?;
3716
3717 Ok(())
3718 }
3719
3720 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3721 }
3722 })
3723 }
3724 }
3725
3726 impl<'de> BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
3727 pub fn buffer_collection_info(
3728 &self,
3729 ) -> ::core::option::Option<&crate::wire::BufferCollectionInfo<'de>> {
3730 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3731 }
3732 }
3733
3734 impl<'de> ::core::fmt::Debug for BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
3735 fn fmt(
3736 &self,
3737 f: &mut ::core::fmt::Formatter<'_>,
3738 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3739 f.debug_struct("BufferCollectionWaitForAllBuffersAllocatedResponse")
3740 .field("buffer_collection_info", &self.buffer_collection_info())
3741 .finish()
3742 }
3743 }
3744
3745 impl<'de> ::fidl_next::IntoNatural for BufferCollectionWaitForAllBuffersAllocatedResponse<'de> {
3746 type Natural = crate::natural::BufferCollectionWaitForAllBuffersAllocatedResponse;
3747 }
3748
3749 #[repr(C)]
3751 pub struct BufferCollectionTokenDuplicateSyncResponse<'de> {
3752 pub(crate) table: ::fidl_next::wire::Table<'de>,
3753 }
3754
3755 impl<'de> Drop for BufferCollectionTokenDuplicateSyncResponse<'de> {
3756 fn drop(&mut self) {
3757 let _ = self.table.get(1).map(|envelope| unsafe {
3758 envelope.read_unchecked::<::fidl_next::wire::Vector<
3759 'de,
3760 ::fidl_next::ClientEnd<
3761 crate::BufferCollectionToken,
3762 ::fidl_next::wire::fuchsia::Channel,
3763 >,
3764 >>()
3765 });
3766 }
3767 }
3768
3769 impl ::fidl_next::Constrained for BufferCollectionTokenDuplicateSyncResponse<'_> {
3770 type Constraint = ();
3771
3772 fn validate(
3773 _: ::fidl_next::Slot<'_, Self>,
3774 _: Self::Constraint,
3775 ) -> Result<(), ::fidl_next::ValidationError> {
3776 Ok(())
3777 }
3778 }
3779
3780 unsafe impl ::fidl_next::Wire for BufferCollectionTokenDuplicateSyncResponse<'static> {
3781 type Narrowed<'de> = BufferCollectionTokenDuplicateSyncResponse<'de>;
3782
3783 #[inline]
3784 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3785 ::fidl_next::munge!(let Self { table } = out);
3786 ::fidl_next::wire::Table::zero_padding(table);
3787 }
3788 }
3789
3790 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionTokenDuplicateSyncResponse<'de>
3791 where
3792 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3793 ___D: ::fidl_next::fuchsia::HandleDecoder,
3794 {
3795 fn decode(
3796 slot: ::fidl_next::Slot<'_, Self>,
3797 decoder: &mut ___D,
3798 _: (),
3799 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3800 ::fidl_next::munge!(let Self { table } = slot);
3801
3802 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3803 match ordinal {
3804 0 => unsafe { ::core::hint::unreachable_unchecked() },
3805
3806 1 => {
3807 ::fidl_next::wire::Envelope::decode_as::<
3808 ___D,
3809 ::fidl_next::wire::Vector<
3810 'de,
3811 ::fidl_next::ClientEnd<
3812 crate::BufferCollectionToken,
3813 ::fidl_next::wire::fuchsia::Channel,
3814 >,
3815 >,
3816 >(slot.as_mut(), decoder, (64, ()))?;
3817
3818 let value = unsafe {
3819 slot.deref_unchecked().deref_unchecked::<::fidl_next::wire::Vector<
3820 '_,
3821 ::fidl_next::ClientEnd<
3822 crate::BufferCollectionToken,
3823 ::fidl_next::wire::fuchsia::Channel,
3824 >,
3825 >>()
3826 };
3827
3828 if value.len() > 64 {
3829 return Err(::fidl_next::DecodeError::VectorTooLong {
3830 size: value.len() as u64,
3831 limit: 64,
3832 });
3833 }
3834
3835 Ok(())
3836 }
3837
3838 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3839 }
3840 })
3841 }
3842 }
3843
3844 impl<'de> BufferCollectionTokenDuplicateSyncResponse<'de> {
3845 pub fn tokens(
3846 &self,
3847 ) -> ::core::option::Option<
3848 &::fidl_next::wire::Vector<
3849 'de,
3850 ::fidl_next::ClientEnd<
3851 crate::BufferCollectionToken,
3852 ::fidl_next::wire::fuchsia::Channel,
3853 >,
3854 >,
3855 > {
3856 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3857 }
3858 }
3859
3860 impl<'de> ::core::fmt::Debug for BufferCollectionTokenDuplicateSyncResponse<'de> {
3861 fn fmt(
3862 &self,
3863 f: &mut ::core::fmt::Formatter<'_>,
3864 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3865 f.debug_struct("BufferCollectionTokenDuplicateSyncResponse")
3866 .field("tokens", &self.tokens())
3867 .finish()
3868 }
3869 }
3870
3871 impl<'de> ::fidl_next::IntoNatural for BufferCollectionTokenDuplicateSyncResponse<'de> {
3872 type Natural = crate::natural::BufferCollectionTokenDuplicateSyncResponse;
3873 }
3874
3875 #[repr(C)]
3877 pub struct BufferCollectionTokenDuplicateRequest<'de> {
3878 pub(crate) table: ::fidl_next::wire::Table<'de>,
3879 }
3880
3881 impl<'de> Drop for BufferCollectionTokenDuplicateRequest<'de> {
3882 fn drop(&mut self) {
3883 let _ = self.table.get(1).map(|envelope| unsafe {
3884 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
3885 });
3886
3887 let _ = self.table.get(2).map(|envelope| unsafe {
3888 envelope.read_unchecked::<::fidl_next::ServerEnd<
3889 crate::BufferCollectionToken,
3890 ::fidl_next::wire::fuchsia::Channel,
3891 >>()
3892 });
3893 }
3894 }
3895
3896 impl ::fidl_next::Constrained for BufferCollectionTokenDuplicateRequest<'_> {
3897 type Constraint = ();
3898
3899 fn validate(
3900 _: ::fidl_next::Slot<'_, Self>,
3901 _: Self::Constraint,
3902 ) -> Result<(), ::fidl_next::ValidationError> {
3903 Ok(())
3904 }
3905 }
3906
3907 unsafe impl ::fidl_next::Wire for BufferCollectionTokenDuplicateRequest<'static> {
3908 type Narrowed<'de> = BufferCollectionTokenDuplicateRequest<'de>;
3909
3910 #[inline]
3911 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
3912 ::fidl_next::munge!(let Self { table } = out);
3913 ::fidl_next::wire::Table::zero_padding(table);
3914 }
3915 }
3916
3917 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for BufferCollectionTokenDuplicateRequest<'de>
3918 where
3919 ___D: ::fidl_next::Decoder<'de> + ?Sized,
3920 ___D: ::fidl_next::fuchsia::HandleDecoder,
3921 {
3922 fn decode(
3923 slot: ::fidl_next::Slot<'_, Self>,
3924 decoder: &mut ___D,
3925 _: (),
3926 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
3927 ::fidl_next::munge!(let Self { table } = slot);
3928
3929 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
3930 match ordinal {
3931 0 => unsafe { ::core::hint::unreachable_unchecked() },
3932
3933 1 => {
3934 ::fidl_next::wire::Envelope::decode_as::<
3935 ___D,
3936 ::fidl_next::wire::fuchsia::Rights,
3937 >(slot.as_mut(), decoder, ())?;
3938
3939 Ok(())
3940 }
3941
3942 2 => {
3943 ::fidl_next::wire::Envelope::decode_as::<
3944 ___D,
3945 ::fidl_next::ServerEnd<
3946 crate::BufferCollectionToken,
3947 ::fidl_next::wire::fuchsia::Channel,
3948 >,
3949 >(slot.as_mut(), decoder, ())?;
3950
3951 Ok(())
3952 }
3953
3954 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
3955 }
3956 })
3957 }
3958 }
3959
3960 impl<'de> BufferCollectionTokenDuplicateRequest<'de> {
3961 pub fn rights_attenuation_mask(
3962 &self,
3963 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Rights> {
3964 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
3965 }
3966
3967 pub fn token_request(
3968 &self,
3969 ) -> ::core::option::Option<
3970 &::fidl_next::ServerEnd<
3971 crate::BufferCollectionToken,
3972 ::fidl_next::wire::fuchsia::Channel,
3973 >,
3974 > {
3975 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
3976 }
3977 }
3978
3979 impl<'de> ::core::fmt::Debug for BufferCollectionTokenDuplicateRequest<'de> {
3980 fn fmt(
3981 &self,
3982 f: &mut ::core::fmt::Formatter<'_>,
3983 ) -> ::core::result::Result<(), ::core::fmt::Error> {
3984 f.debug_struct("BufferCollectionTokenDuplicateRequest")
3985 .field("rights_attenuation_mask", &self.rights_attenuation_mask())
3986 .field("token_request", &self.token_request())
3987 .finish()
3988 }
3989 }
3990
3991 impl<'de> ::fidl_next::IntoNatural for BufferCollectionTokenDuplicateRequest<'de> {
3992 type Natural = crate::natural::BufferCollectionTokenDuplicateRequest;
3993 }
3994
3995 #[repr(C)]
3997 pub struct BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de> {
3998 pub(crate) table: ::fidl_next::wire::Table<'de>,
3999 }
4000
4001 impl<'de> Drop for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de> {
4002 fn drop(&mut self) {
4003 let _ = self.table.get(1).map(|envelope| unsafe {
4004 envelope.read_unchecked::<::fidl_next::ServerEnd<
4005 crate::BufferCollectionTokenGroup,
4006 ::fidl_next::wire::fuchsia::Channel,
4007 >>()
4008 });
4009 }
4010 }
4011
4012 impl ::fidl_next::Constrained for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'_> {
4013 type Constraint = ();
4014
4015 fn validate(
4016 _: ::fidl_next::Slot<'_, Self>,
4017 _: Self::Constraint,
4018 ) -> Result<(), ::fidl_next::ValidationError> {
4019 Ok(())
4020 }
4021 }
4022
4023 unsafe impl ::fidl_next::Wire
4024 for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'static>
4025 {
4026 type Narrowed<'de> = BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>;
4027
4028 #[inline]
4029 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4030 ::fidl_next::munge!(let Self { table } = out);
4031 ::fidl_next::wire::Table::zero_padding(table);
4032 }
4033 }
4034
4035 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
4036 for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>
4037 where
4038 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4039 ___D: ::fidl_next::fuchsia::HandleDecoder,
4040 {
4041 fn decode(
4042 slot: ::fidl_next::Slot<'_, Self>,
4043 decoder: &mut ___D,
4044 _: (),
4045 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4046 ::fidl_next::munge!(let Self { table } = slot);
4047
4048 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4049 match ordinal {
4050 0 => unsafe { ::core::hint::unreachable_unchecked() },
4051
4052 1 => {
4053 ::fidl_next::wire::Envelope::decode_as::<
4054 ___D,
4055 ::fidl_next::ServerEnd<
4056 crate::BufferCollectionTokenGroup,
4057 ::fidl_next::wire::fuchsia::Channel,
4058 >,
4059 >(slot.as_mut(), decoder, ())?;
4060
4061 Ok(())
4062 }
4063
4064 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4065 }
4066 })
4067 }
4068 }
4069
4070 impl<'de> BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de> {
4071 pub fn group_request(
4072 &self,
4073 ) -> ::core::option::Option<
4074 &::fidl_next::ServerEnd<
4075 crate::BufferCollectionTokenGroup,
4076 ::fidl_next::wire::fuchsia::Channel,
4077 >,
4078 > {
4079 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4080 }
4081 }
4082
4083 impl<'de> ::core::fmt::Debug for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de> {
4084 fn fmt(
4085 &self,
4086 f: &mut ::core::fmt::Formatter<'_>,
4087 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4088 f.debug_struct("BufferCollectionTokenCreateBufferCollectionTokenGroupRequest")
4089 .field("group_request", &self.group_request())
4090 .finish()
4091 }
4092 }
4093
4094 impl<'de> ::fidl_next::IntoNatural
4095 for BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>
4096 {
4097 type Natural = crate::natural::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest;
4098 }
4099
4100 #[repr(C)]
4102 pub struct BufferCollectionTokenGroupCreateChildRequest<'de> {
4103 pub(crate) table: ::fidl_next::wire::Table<'de>,
4104 }
4105
4106 impl<'de> Drop for BufferCollectionTokenGroupCreateChildRequest<'de> {
4107 fn drop(&mut self) {
4108 let _ = self.table.get(1).map(|envelope| unsafe {
4109 envelope.read_unchecked::<::fidl_next::ServerEnd<
4110 crate::BufferCollectionToken,
4111 ::fidl_next::wire::fuchsia::Channel,
4112 >>()
4113 });
4114
4115 let _ = self.table.get(2).map(|envelope| unsafe {
4116 envelope.read_unchecked::<::fidl_next::wire::fuchsia::Rights>()
4117 });
4118 }
4119 }
4120
4121 impl ::fidl_next::Constrained for BufferCollectionTokenGroupCreateChildRequest<'_> {
4122 type Constraint = ();
4123
4124 fn validate(
4125 _: ::fidl_next::Slot<'_, Self>,
4126 _: Self::Constraint,
4127 ) -> Result<(), ::fidl_next::ValidationError> {
4128 Ok(())
4129 }
4130 }
4131
4132 unsafe impl ::fidl_next::Wire for BufferCollectionTokenGroupCreateChildRequest<'static> {
4133 type Narrowed<'de> = BufferCollectionTokenGroupCreateChildRequest<'de>;
4134
4135 #[inline]
4136 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4137 ::fidl_next::munge!(let Self { table } = out);
4138 ::fidl_next::wire::Table::zero_padding(table);
4139 }
4140 }
4141
4142 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
4143 for BufferCollectionTokenGroupCreateChildRequest<'de>
4144 where
4145 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4146 ___D: ::fidl_next::fuchsia::HandleDecoder,
4147 {
4148 fn decode(
4149 slot: ::fidl_next::Slot<'_, Self>,
4150 decoder: &mut ___D,
4151 _: (),
4152 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4153 ::fidl_next::munge!(let Self { table } = slot);
4154
4155 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4156 match ordinal {
4157 0 => unsafe { ::core::hint::unreachable_unchecked() },
4158
4159 1 => {
4160 ::fidl_next::wire::Envelope::decode_as::<
4161 ___D,
4162 ::fidl_next::ServerEnd<
4163 crate::BufferCollectionToken,
4164 ::fidl_next::wire::fuchsia::Channel,
4165 >,
4166 >(slot.as_mut(), decoder, ())?;
4167
4168 Ok(())
4169 }
4170
4171 2 => {
4172 ::fidl_next::wire::Envelope::decode_as::<
4173 ___D,
4174 ::fidl_next::wire::fuchsia::Rights,
4175 >(slot.as_mut(), decoder, ())?;
4176
4177 Ok(())
4178 }
4179
4180 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4181 }
4182 })
4183 }
4184 }
4185
4186 impl<'de> BufferCollectionTokenGroupCreateChildRequest<'de> {
4187 pub fn token_request(
4188 &self,
4189 ) -> ::core::option::Option<
4190 &::fidl_next::ServerEnd<
4191 crate::BufferCollectionToken,
4192 ::fidl_next::wire::fuchsia::Channel,
4193 >,
4194 > {
4195 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4196 }
4197
4198 pub fn rights_attenuation_mask(
4199 &self,
4200 ) -> ::core::option::Option<&::fidl_next::wire::fuchsia::Rights> {
4201 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
4202 }
4203 }
4204
4205 impl<'de> ::core::fmt::Debug for BufferCollectionTokenGroupCreateChildRequest<'de> {
4206 fn fmt(
4207 &self,
4208 f: &mut ::core::fmt::Formatter<'_>,
4209 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4210 f.debug_struct("BufferCollectionTokenGroupCreateChildRequest")
4211 .field("token_request", &self.token_request())
4212 .field("rights_attenuation_mask", &self.rights_attenuation_mask())
4213 .finish()
4214 }
4215 }
4216
4217 impl<'de> ::fidl_next::IntoNatural for BufferCollectionTokenGroupCreateChildRequest<'de> {
4218 type Natural = crate::natural::BufferCollectionTokenGroupCreateChildRequest;
4219 }
4220
4221 #[repr(C)]
4223 pub struct BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
4224 pub(crate) table: ::fidl_next::wire::Table<'de>,
4225 }
4226
4227 impl<'de> Drop for BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
4228 fn drop(&mut self) {
4229 let _ = self.table.get(1).map(|envelope| unsafe {
4230 envelope.read_unchecked::<::fidl_next::wire::Vector<
4231 'de,
4232 ::fidl_next::ClientEnd<
4233 crate::BufferCollectionToken,
4234 ::fidl_next::wire::fuchsia::Channel,
4235 >,
4236 >>()
4237 });
4238 }
4239 }
4240
4241 impl ::fidl_next::Constrained for BufferCollectionTokenGroupCreateChildrenSyncResponse<'_> {
4242 type Constraint = ();
4243
4244 fn validate(
4245 _: ::fidl_next::Slot<'_, Self>,
4246 _: Self::Constraint,
4247 ) -> Result<(), ::fidl_next::ValidationError> {
4248 Ok(())
4249 }
4250 }
4251
4252 unsafe impl ::fidl_next::Wire for BufferCollectionTokenGroupCreateChildrenSyncResponse<'static> {
4253 type Narrowed<'de> = BufferCollectionTokenGroupCreateChildrenSyncResponse<'de>;
4254
4255 #[inline]
4256 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
4257 ::fidl_next::munge!(let Self { table } = out);
4258 ::fidl_next::wire::Table::zero_padding(table);
4259 }
4260 }
4261
4262 unsafe impl<'de, ___D> ::fidl_next::Decode<___D>
4263 for BufferCollectionTokenGroupCreateChildrenSyncResponse<'de>
4264 where
4265 ___D: ::fidl_next::Decoder<'de> + ?Sized,
4266 ___D: ::fidl_next::fuchsia::HandleDecoder,
4267 {
4268 fn decode(
4269 slot: ::fidl_next::Slot<'_, Self>,
4270 decoder: &mut ___D,
4271 _: (),
4272 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
4273 ::fidl_next::munge!(let Self { table } = slot);
4274
4275 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
4276 match ordinal {
4277 0 => unsafe { ::core::hint::unreachable_unchecked() },
4278
4279 1 => {
4280 ::fidl_next::wire::Envelope::decode_as::<
4281 ___D,
4282 ::fidl_next::wire::Vector<
4283 'de,
4284 ::fidl_next::ClientEnd<
4285 crate::BufferCollectionToken,
4286 ::fidl_next::wire::fuchsia::Channel,
4287 >,
4288 >,
4289 >(slot.as_mut(), decoder, (64, ()))?;
4290
4291 let value = unsafe {
4292 slot.deref_unchecked().deref_unchecked::<::fidl_next::wire::Vector<
4293 '_,
4294 ::fidl_next::ClientEnd<
4295 crate::BufferCollectionToken,
4296 ::fidl_next::wire::fuchsia::Channel,
4297 >,
4298 >>()
4299 };
4300
4301 if value.len() > 64 {
4302 return Err(::fidl_next::DecodeError::VectorTooLong {
4303 size: value.len() as u64,
4304 limit: 64,
4305 });
4306 }
4307
4308 Ok(())
4309 }
4310
4311 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
4312 }
4313 })
4314 }
4315 }
4316
4317 impl<'de> BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
4318 pub fn tokens(
4319 &self,
4320 ) -> ::core::option::Option<
4321 &::fidl_next::wire::Vector<
4322 'de,
4323 ::fidl_next::ClientEnd<
4324 crate::BufferCollectionToken,
4325 ::fidl_next::wire::fuchsia::Channel,
4326 >,
4327 >,
4328 > {
4329 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
4330 }
4331 }
4332
4333 impl<'de> ::core::fmt::Debug for BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
4334 fn fmt(
4335 &self,
4336 f: &mut ::core::fmt::Formatter<'_>,
4337 ) -> ::core::result::Result<(), ::core::fmt::Error> {
4338 f.debug_struct("BufferCollectionTokenGroupCreateChildrenSyncResponse")
4339 .field("tokens", &self.tokens())
4340 .finish()
4341 }
4342 }
4343
4344 impl<'de> ::fidl_next::IntoNatural for BufferCollectionTokenGroupCreateChildrenSyncResponse<'de> {
4345 type Natural = crate::natural::BufferCollectionTokenGroupCreateChildrenSyncResponse;
4346 }
4347}
4348
4349pub mod wire_optional {
4350
4351 pub use fidl_next_common_fuchsia_sysmem2::wire_optional::*;
4352}
4353
4354pub mod generic {
4355
4356 pub use fidl_next_common_fuchsia_sysmem2::generic::*;
4357}
4358
4359pub use self::natural::*;
4360
4361#[doc = " Allocates system memory buffers.\n\n Epitaphs are not used in this protocol.\n"]
4363#[derive(PartialEq, Debug)]
4364pub struct Allocator;
4365
4366impl ::fidl_next::Discoverable for Allocator {
4367 const PROTOCOL_NAME: &'static str = "fuchsia.sysmem2.Allocator";
4368}
4369
4370#[cfg(target_os = "fuchsia")]
4371impl ::fidl_next::HasTransport for Allocator {
4372 type Transport = ::fidl_next::fuchsia::zx::Channel;
4373}
4374
4375pub mod allocator {
4376 pub mod prelude {
4377 pub use crate::{
4378 Allocator, AllocatorClientHandler, AllocatorLocalClientHandler,
4379 AllocatorLocalServerHandler, AllocatorServerHandler, allocator,
4380 };
4381
4382 pub use crate::natural::AllocatorAllocateNonSharedCollectionRequest;
4383
4384 pub use crate::natural::AllocatorAllocateSharedCollectionRequest;
4385
4386 pub use crate::natural::AllocatorBindSharedCollectionRequest;
4387
4388 pub use crate::natural::AllocatorGetVmoInfoRequest;
4389
4390 pub use crate::natural::AllocatorSetDebugClientInfoRequest;
4391
4392 pub use crate::natural::AllocatorValidateBufferCollectionTokenRequest;
4393
4394 pub use crate::natural::AllocatorGetVmoInfoResponse;
4395
4396 pub use crate::natural::AllocatorValidateBufferCollectionTokenResponse;
4397
4398 pub use crate::natural::Error;
4399 }
4400
4401 pub struct AllocateNonSharedCollection;
4402
4403 impl ::fidl_next::Method for AllocateNonSharedCollection {
4404 const ORDINAL: u64 = 6676166366047243844;
4405 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4406 ::fidl_next::protocol::Flexibility::Flexible;
4407
4408 type Protocol = crate::Allocator;
4409
4410 type Request = crate::wire::AllocatorAllocateNonSharedCollectionRequest<'static>;
4411 }
4412
4413 pub struct AllocateSharedCollection;
4414
4415 impl ::fidl_next::Method for AllocateSharedCollection {
4416 const ORDINAL: u64 = 1270472445031827905;
4417 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4418 ::fidl_next::protocol::Flexibility::Flexible;
4419
4420 type Protocol = crate::Allocator;
4421
4422 type Request = crate::wire::AllocatorAllocateSharedCollectionRequest<'static>;
4423 }
4424
4425 pub struct BindSharedCollection;
4426
4427 impl ::fidl_next::Method for BindSharedCollection {
4428 const ORDINAL: u64 = 6127453716877237070;
4429 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4430 ::fidl_next::protocol::Flexibility::Flexible;
4431
4432 type Protocol = crate::Allocator;
4433
4434 type Request = crate::wire::AllocatorBindSharedCollectionRequest<'static>;
4435 }
4436
4437 pub struct ValidateBufferCollectionToken;
4438
4439 impl ::fidl_next::Method for ValidateBufferCollectionToken {
4440 const ORDINAL: u64 = 5503092096911271565;
4441 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4442 ::fidl_next::protocol::Flexibility::Flexible;
4443
4444 type Protocol = crate::Allocator;
4445
4446 type Request = crate::wire::AllocatorValidateBufferCollectionTokenRequest<'static>;
4447 }
4448
4449 impl ::fidl_next::TwoWayMethod for ValidateBufferCollectionToken {
4450 type Response = ::fidl_next::wire::Flexible<
4451 'static,
4452 crate::wire::AllocatorValidateBufferCollectionTokenResponse<'static>,
4453 >;
4454 }
4455
4456 impl<___R> ::fidl_next::Respond<___R> for ValidateBufferCollectionToken {
4457 type Output = ::fidl_next::Flexible<___R>;
4458
4459 fn respond(response: ___R) -> Self::Output {
4460 ::fidl_next::Flexible::Ok(response)
4461 }
4462 }
4463
4464 pub struct SetDebugClientInfo;
4465
4466 impl ::fidl_next::Method for SetDebugClientInfo {
4467 const ORDINAL: u64 = 8027931980577414221;
4468 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4469 ::fidl_next::protocol::Flexibility::Flexible;
4470
4471 type Protocol = crate::Allocator;
4472
4473 type Request = crate::wire::AllocatorSetDebugClientInfoRequest<'static>;
4474 }
4475
4476 pub struct GetVmoInfo;
4477
4478 impl ::fidl_next::Method for GetVmoInfo {
4479 const ORDINAL: u64 = 2425330313826721273;
4480 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
4481 ::fidl_next::protocol::Flexibility::Flexible;
4482
4483 type Protocol = crate::Allocator;
4484
4485 type Request = crate::wire::AllocatorGetVmoInfoRequest<'static>;
4486 }
4487
4488 impl ::fidl_next::TwoWayMethod for GetVmoInfo {
4489 type Response = ::fidl_next::wire::FlexibleResult<
4490 'static,
4491 crate::wire::AllocatorGetVmoInfoResponse<'static>,
4492 crate::wire::Error,
4493 >;
4494 }
4495
4496 impl<___R> ::fidl_next::Respond<___R> for GetVmoInfo {
4497 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
4498
4499 fn respond(response: ___R) -> Self::Output {
4500 ::fidl_next::FlexibleResult::Ok(response)
4501 }
4502 }
4503
4504 impl<___R> ::fidl_next::RespondErr<___R> for GetVmoInfo {
4505 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
4506
4507 fn respond_err(response: ___R) -> Self::Output {
4508 ::fidl_next::FlexibleResult::Err(response)
4509 }
4510 }
4511
4512 mod ___detail {
4513 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Allocator
4514 where
4515 ___T: ::fidl_next::Transport,
4516 {
4517 type Client = AllocatorClient<___T>;
4518 type Server = AllocatorServer<___T>;
4519 }
4520
4521 #[repr(transparent)]
4523 pub struct AllocatorClient<___T: ::fidl_next::Transport> {
4524 #[allow(dead_code)]
4525 client: ::fidl_next::protocol::Client<___T>,
4526 }
4527
4528 impl<___T> AllocatorClient<___T>
4529 where
4530 ___T: ::fidl_next::Transport,
4531 {
4532 #[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"]
4533 pub fn allocate_non_shared_collection_with<___R>(
4534 &self,
4535 request: ___R,
4536 ) -> ::fidl_next::SendFuture<'_, ___T>
4537 where
4538 ___R: ::fidl_next::Encode<
4539 crate::wire::AllocatorAllocateNonSharedCollectionRequest<'static>,
4540 <___T as ::fidl_next::Transport>::SendBuffer,
4541 >,
4542 {
4543 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
4544 6676166366047243844,
4545 <super::AllocateNonSharedCollection as ::fidl_next::Method>::FLEXIBILITY,
4546 request,
4547 ))
4548 }
4549
4550 #[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"]
4551 pub fn allocate_shared_collection_with<___R>(
4552 &self,
4553 request: ___R,
4554 ) -> ::fidl_next::SendFuture<'_, ___T>
4555 where
4556 ___R: ::fidl_next::Encode<
4557 crate::wire::AllocatorAllocateSharedCollectionRequest<'static>,
4558 <___T as ::fidl_next::Transport>::SendBuffer,
4559 >,
4560 {
4561 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
4562 1270472445031827905,
4563 <super::AllocateSharedCollection as ::fidl_next::Method>::FLEXIBILITY,
4564 request,
4565 ))
4566 }
4567
4568 #[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"]
4569 pub fn bind_shared_collection_with<___R>(
4570 &self,
4571 request: ___R,
4572 ) -> ::fidl_next::SendFuture<'_, ___T>
4573 where
4574 ___R: ::fidl_next::Encode<
4575 crate::wire::AllocatorBindSharedCollectionRequest<'static>,
4576 <___T as ::fidl_next::Transport>::SendBuffer,
4577 >,
4578 {
4579 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
4580 6127453716877237070,
4581 <super::BindSharedCollection as ::fidl_next::Method>::FLEXIBILITY,
4582 request,
4583 ))
4584 }
4585
4586 #[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"]
4587 pub fn validate_buffer_collection_token_with<___R>(
4588 &self,
4589 request: ___R,
4590 ) -> ::fidl_next::TwoWayFuture<'_, super::ValidateBufferCollectionToken, ___T>
4591 where
4592 ___R: ::fidl_next::Encode<
4593 crate::wire::AllocatorValidateBufferCollectionTokenRequest<'static>,
4594 <___T as ::fidl_next::Transport>::SendBuffer,
4595 >,
4596 {
4597 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
4598 5503092096911271565,
4599 <super::ValidateBufferCollectionToken as ::fidl_next::Method>::FLEXIBILITY,
4600 request,
4601 ))
4602 }
4603
4604 #[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"]
4605 pub fn set_debug_client_info_with<___R>(
4606 &self,
4607 request: ___R,
4608 ) -> ::fidl_next::SendFuture<'_, ___T>
4609 where
4610 ___R: ::fidl_next::Encode<
4611 crate::wire::AllocatorSetDebugClientInfoRequest<'static>,
4612 <___T as ::fidl_next::Transport>::SendBuffer,
4613 >,
4614 {
4615 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
4616 8027931980577414221,
4617 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
4618 request,
4619 ))
4620 }
4621
4622 #[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 - 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 the `close_weak_asap` field will be set in the response. This handle\n will signal `ZX_EVENTPAIR_PEER_CLOSED` when all weak VMO handles to\n the buffer should be closed as soon as possible. This is signalled\n shortly after all strong sysmem VMOs to the buffer are closed\n (including any held indirectly via strong `BufferCollectionToken` or\n strong `BufferCollection`). Failure to close all weak sysmem VMO\n handles to the buffer quickly upon `ZX_EVENTPAIR_PEER_CLOSED` is\n considered a VMO leak caused by the client still holding a weak sysmem\n VMO handle and results in loud complaints to the log by sysmem. The\n buffers of a 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 handle\n weak sysmem VMOs, on seeing this field set, can close all handles to\n the buffer and fail any associated request.\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.HANDLE_ACCESS_DENIED]` The vmo isn\'t\n capable of being used with GetVmoInfo due to rights/capability\n attenuation. The VMO needs to be usable with [`zx_vmo_get_info`] with\n topic [`ZX_INFO_HANDLE_BASIC`].\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"]
4623 pub fn get_vmo_info_with<___R>(
4624 &self,
4625 request: ___R,
4626 ) -> ::fidl_next::TwoWayFuture<'_, super::GetVmoInfo, ___T>
4627 where
4628 ___R: ::fidl_next::Encode<
4629 crate::wire::AllocatorGetVmoInfoRequest<'static>,
4630 <___T as ::fidl_next::Transport>::SendBuffer,
4631 >,
4632 {
4633 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
4634 2425330313826721273,
4635 <super::GetVmoInfo as ::fidl_next::Method>::FLEXIBILITY,
4636 request,
4637 ))
4638 }
4639 }
4640
4641 #[repr(transparent)]
4643 pub struct AllocatorServer<___T: ::fidl_next::Transport> {
4644 server: ::fidl_next::protocol::Server<___T>,
4645 }
4646
4647 impl<___T> AllocatorServer<___T> where ___T: ::fidl_next::Transport {}
4648 }
4649}
4650
4651#[diagnostic::on_unimplemented(
4652 note = "If {Self} implements the non-local AllocatorClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
4653)]
4654
4655pub trait AllocatorLocalClientHandler<
4659 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4660 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4661>
4662{
4663 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4664 ::core::future::ready(())
4665 }
4666}
4667
4668impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Allocator
4669where
4670 ___H: AllocatorLocalClientHandler<___T>,
4671 ___T: ::fidl_next::Transport,
4672{
4673 async fn on_event(
4674 handler: &mut ___H,
4675 ordinal: u64,
4676 flexibility: ::fidl_next::protocol::Flexibility,
4677 body: ::fidl_next::Body<___T>,
4678 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4679 match ordinal {
4680 ordinal => {
4681 handler.on_unknown_interaction(ordinal).await;
4682 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4683 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4684 } else {
4685 Ok(())
4686 }
4687 }
4688 }
4689 }
4690}
4691
4692#[diagnostic::on_unimplemented(
4693 note = "If {Self} implements the non-local AllocatorServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
4694)]
4695
4696pub trait AllocatorLocalServerHandler<
4700 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4701 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4702>
4703{
4704 #[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"]
4705 fn allocate_non_shared_collection(
4706 &mut self,
4707
4708 request: ::fidl_next::Request<allocator::AllocateNonSharedCollection, ___T>,
4709 ) -> impl ::core::future::Future<Output = ()>;
4710
4711 #[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"]
4712 fn allocate_shared_collection(
4713 &mut self,
4714
4715 request: ::fidl_next::Request<allocator::AllocateSharedCollection, ___T>,
4716 ) -> impl ::core::future::Future<Output = ()>;
4717
4718 #[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"]
4719 fn bind_shared_collection(
4720 &mut self,
4721
4722 request: ::fidl_next::Request<allocator::BindSharedCollection, ___T>,
4723 ) -> impl ::core::future::Future<Output = ()>;
4724
4725 #[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"]
4726 fn validate_buffer_collection_token(
4727 &mut self,
4728
4729 request: ::fidl_next::Request<allocator::ValidateBufferCollectionToken, ___T>,
4730
4731 responder: ::fidl_next::Responder<allocator::ValidateBufferCollectionToken, ___T>,
4732 ) -> impl ::core::future::Future<Output = ()>;
4733
4734 #[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"]
4735 fn set_debug_client_info(
4736 &mut self,
4737
4738 request: ::fidl_next::Request<allocator::SetDebugClientInfo, ___T>,
4739 ) -> impl ::core::future::Future<Output = ()>;
4740
4741 #[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 - 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 the `close_weak_asap` field will be set in the response. This handle\n will signal `ZX_EVENTPAIR_PEER_CLOSED` when all weak VMO handles to\n the buffer should be closed as soon as possible. This is signalled\n shortly after all strong sysmem VMOs to the buffer are closed\n (including any held indirectly via strong `BufferCollectionToken` or\n strong `BufferCollection`). Failure to close all weak sysmem VMO\n handles to the buffer quickly upon `ZX_EVENTPAIR_PEER_CLOSED` is\n considered a VMO leak caused by the client still holding a weak sysmem\n VMO handle and results in loud complaints to the log by sysmem. The\n buffers of a 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 handle\n weak sysmem VMOs, on seeing this field set, can close all handles to\n the buffer and fail any associated request.\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.HANDLE_ACCESS_DENIED]` The vmo isn\'t\n capable of being used with GetVmoInfo due to rights/capability\n attenuation. The VMO needs to be usable with [`zx_vmo_get_info`] with\n topic [`ZX_INFO_HANDLE_BASIC`].\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"]
4742 fn get_vmo_info(
4743 &mut self,
4744
4745 request: ::fidl_next::Request<allocator::GetVmoInfo, ___T>,
4746
4747 responder: ::fidl_next::Responder<allocator::GetVmoInfo, ___T>,
4748 ) -> impl ::core::future::Future<Output = ()>;
4749
4750 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
4751 ::core::future::ready(())
4752 }
4753}
4754
4755impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Allocator
4756where
4757 ___H: AllocatorLocalServerHandler<___T>,
4758 ___T: ::fidl_next::Transport,
4759 for<'de> crate::wire::AllocatorAllocateNonSharedCollectionRequest<'de>: ::fidl_next::Decode<
4760 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4761 Constraint = (),
4762 >,
4763 for<'de> crate::wire::AllocatorAllocateSharedCollectionRequest<'de>: ::fidl_next::Decode<
4764 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4765 Constraint = (),
4766 >,
4767 for<'de> crate::wire::AllocatorBindSharedCollectionRequest<'de>: ::fidl_next::Decode<
4768 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4769 Constraint = (),
4770 >,
4771 for<'de> crate::wire::AllocatorValidateBufferCollectionTokenRequest<'de>: ::fidl_next::Decode<
4772 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4773 Constraint = (),
4774 >,
4775 for<'de> crate::wire::AllocatorSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
4776 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4777 Constraint = (),
4778 >,
4779 for<'de> crate::wire::AllocatorGetVmoInfoRequest<'de>: ::fidl_next::Decode<
4780 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
4781 Constraint = (),
4782 >,
4783{
4784 async fn on_one_way(
4785 handler: &mut ___H,
4786 ordinal: u64,
4787 flexibility: ::fidl_next::protocol::Flexibility,
4788 body: ::fidl_next::Body<___T>,
4789 ) -> ::core::result::Result<
4790 (),
4791 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4792 > {
4793 match ordinal {
4794 6676166366047243844 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
4795 Ok(decoded) => {
4796 handler
4797 .allocate_non_shared_collection(::fidl_next::Request::from_decoded(decoded))
4798 .await;
4799 Ok(())
4800 }
4801 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4802 ordinal: 6676166366047243844,
4803 error,
4804 }),
4805 },
4806
4807 1270472445031827905 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
4808 Ok(decoded) => {
4809 handler
4810 .allocate_shared_collection(::fidl_next::Request::from_decoded(decoded))
4811 .await;
4812 Ok(())
4813 }
4814 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4815 ordinal: 1270472445031827905,
4816 error,
4817 }),
4818 },
4819
4820 6127453716877237070 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
4821 Ok(decoded) => {
4822 handler
4823 .bind_shared_collection(::fidl_next::Request::from_decoded(decoded))
4824 .await;
4825 Ok(())
4826 }
4827 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4828 ordinal: 6127453716877237070,
4829 error,
4830 }),
4831 },
4832
4833 8027931980577414221 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
4834 Ok(decoded) => {
4835 handler
4836 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
4837 .await;
4838 Ok(())
4839 }
4840 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4841 ordinal: 8027931980577414221,
4842 error,
4843 }),
4844 },
4845
4846 ordinal => {
4847 handler.on_unknown_interaction(ordinal).await;
4848 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4849 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4850 } else {
4851 Ok(())
4852 }
4853 }
4854 }
4855 }
4856
4857 async fn on_two_way(
4858 handler: &mut ___H,
4859 ordinal: u64,
4860 flexibility: ::fidl_next::protocol::Flexibility,
4861 body: ::fidl_next::Body<___T>,
4862 responder: ::fidl_next::protocol::Responder<___T>,
4863 ) -> ::core::result::Result<
4864 (),
4865 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
4866 > {
4867 match ordinal {
4868 5503092096911271565 => {
4869 let responder = ::fidl_next::Responder::from_untyped(responder);
4870
4871 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4872 Ok(decoded) => {
4873 handler
4874 .validate_buffer_collection_token(
4875 ::fidl_next::Request::from_decoded(decoded),
4876 responder,
4877 )
4878 .await;
4879 Ok(())
4880 }
4881 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4882 ordinal: 5503092096911271565,
4883 error,
4884 }),
4885 }
4886 }
4887
4888 2425330313826721273 => {
4889 let responder = ::fidl_next::Responder::from_untyped(responder);
4890
4891 match ::fidl_next::AsDecoderExt::into_decoded(body) {
4892 Ok(decoded) => {
4893 handler
4894 .get_vmo_info(::fidl_next::Request::from_decoded(decoded), responder)
4895 .await;
4896 Ok(())
4897 }
4898 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
4899 ordinal: 2425330313826721273,
4900 error,
4901 }),
4902 }
4903 }
4904
4905 ordinal => {
4906 handler.on_unknown_interaction(ordinal).await;
4907 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4908 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4909 } else {
4910 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
4911 ordinal,
4912 flexibility,
4913 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
4914 )
4915 .expect("encoding a framework error should never fail")
4916 .await?;
4917 Ok(())
4918 }
4919 }
4920 }
4921 }
4922}
4923
4924pub trait AllocatorClientHandler<
4928 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4929 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4930>
4931{
4932 fn on_unknown_interaction(
4933 &mut self,
4934 ordinal: u64,
4935 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
4936 ::core::future::ready(())
4937 }
4938}
4939
4940impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Allocator
4941where
4942 ___H: AllocatorClientHandler<___T> + ::core::marker::Send,
4943 ___T: ::fidl_next::Transport,
4944{
4945 async fn on_event(
4946 handler: &mut ___H,
4947 ordinal: u64,
4948 flexibility: ::fidl_next::protocol::Flexibility,
4949 body: ::fidl_next::Body<___T>,
4950 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
4951 match ordinal {
4952 ordinal => {
4953 handler.on_unknown_interaction(ordinal).await;
4954 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
4955 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
4956 } else {
4957 Ok(())
4958 }
4959 }
4960 }
4961 }
4962}
4963
4964pub trait AllocatorServerHandler<
4968 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
4969 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
4970>
4971{
4972 #[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"]
4973 fn allocate_non_shared_collection(
4974 &mut self,
4975
4976 request: ::fidl_next::Request<allocator::AllocateNonSharedCollection, ___T>,
4977 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4978
4979 #[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"]
4980 fn allocate_shared_collection(
4981 &mut self,
4982
4983 request: ::fidl_next::Request<allocator::AllocateSharedCollection, ___T>,
4984 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4985
4986 #[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"]
4987 fn bind_shared_collection(
4988 &mut self,
4989
4990 request: ::fidl_next::Request<allocator::BindSharedCollection, ___T>,
4991 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
4992
4993 #[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"]
4994 fn validate_buffer_collection_token(
4995 &mut self,
4996
4997 request: ::fidl_next::Request<allocator::ValidateBufferCollectionToken, ___T>,
4998
4999 responder: ::fidl_next::Responder<allocator::ValidateBufferCollectionToken, ___T>,
5000 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5001
5002 #[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"]
5003 fn set_debug_client_info(
5004 &mut self,
5005
5006 request: ::fidl_next::Request<allocator::SetDebugClientInfo, ___T>,
5007 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5008
5009 #[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 - 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 the `close_weak_asap` field will be set in the response. This handle\n will signal `ZX_EVENTPAIR_PEER_CLOSED` when all weak VMO handles to\n the buffer should be closed as soon as possible. This is signalled\n shortly after all strong sysmem VMOs to the buffer are closed\n (including any held indirectly via strong `BufferCollectionToken` or\n strong `BufferCollection`). Failure to close all weak sysmem VMO\n handles to the buffer quickly upon `ZX_EVENTPAIR_PEER_CLOSED` is\n considered a VMO leak caused by the client still holding a weak sysmem\n VMO handle and results in loud complaints to the log by sysmem. The\n buffers of a 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 handle\n weak sysmem VMOs, on seeing this field set, can close all handles to\n the buffer and fail any associated request.\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.HANDLE_ACCESS_DENIED]` The vmo isn\'t\n capable of being used with GetVmoInfo due to rights/capability\n attenuation. The VMO needs to be usable with [`zx_vmo_get_info`] with\n topic [`ZX_INFO_HANDLE_BASIC`].\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"]
5010 fn get_vmo_info(
5011 &mut self,
5012
5013 request: ::fidl_next::Request<allocator::GetVmoInfo, ___T>,
5014
5015 responder: ::fidl_next::Responder<allocator::GetVmoInfo, ___T>,
5016 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
5017
5018 fn on_unknown_interaction(
5019 &mut self,
5020 ordinal: u64,
5021 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
5022 ::core::future::ready(())
5023 }
5024}
5025
5026impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Allocator
5027where
5028 ___H: AllocatorServerHandler<___T> + ::core::marker::Send,
5029 ___T: ::fidl_next::Transport,
5030 for<'de> crate::wire::AllocatorAllocateNonSharedCollectionRequest<'de>: ::fidl_next::Decode<
5031 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5032 Constraint = (),
5033 >,
5034 for<'de> crate::wire::AllocatorAllocateSharedCollectionRequest<'de>: ::fidl_next::Decode<
5035 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5036 Constraint = (),
5037 >,
5038 for<'de> crate::wire::AllocatorBindSharedCollectionRequest<'de>: ::fidl_next::Decode<
5039 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5040 Constraint = (),
5041 >,
5042 for<'de> crate::wire::AllocatorValidateBufferCollectionTokenRequest<'de>: ::fidl_next::Decode<
5043 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5044 Constraint = (),
5045 >,
5046 for<'de> crate::wire::AllocatorSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
5047 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5048 Constraint = (),
5049 >,
5050 for<'de> crate::wire::AllocatorGetVmoInfoRequest<'de>: ::fidl_next::Decode<
5051 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5052 Constraint = (),
5053 >,
5054{
5055 async fn on_one_way(
5056 handler: &mut ___H,
5057 ordinal: u64,
5058 flexibility: ::fidl_next::protocol::Flexibility,
5059 body: ::fidl_next::Body<___T>,
5060 ) -> ::core::result::Result<
5061 (),
5062 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5063 > {
5064 match ordinal {
5065 6676166366047243844 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5066 Ok(decoded) => {
5067 handler
5068 .allocate_non_shared_collection(::fidl_next::Request::from_decoded(decoded))
5069 .await;
5070 Ok(())
5071 }
5072 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5073 ordinal: 6676166366047243844,
5074 error,
5075 }),
5076 },
5077
5078 1270472445031827905 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5079 Ok(decoded) => {
5080 handler
5081 .allocate_shared_collection(::fidl_next::Request::from_decoded(decoded))
5082 .await;
5083 Ok(())
5084 }
5085 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5086 ordinal: 1270472445031827905,
5087 error,
5088 }),
5089 },
5090
5091 6127453716877237070 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5092 Ok(decoded) => {
5093 handler
5094 .bind_shared_collection(::fidl_next::Request::from_decoded(decoded))
5095 .await;
5096 Ok(())
5097 }
5098 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5099 ordinal: 6127453716877237070,
5100 error,
5101 }),
5102 },
5103
5104 8027931980577414221 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5105 Ok(decoded) => {
5106 handler
5107 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
5108 .await;
5109 Ok(())
5110 }
5111 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5112 ordinal: 8027931980577414221,
5113 error,
5114 }),
5115 },
5116
5117 ordinal => {
5118 handler.on_unknown_interaction(ordinal).await;
5119 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5120 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5121 } else {
5122 Ok(())
5123 }
5124 }
5125 }
5126 }
5127
5128 async fn on_two_way(
5129 handler: &mut ___H,
5130 ordinal: u64,
5131 flexibility: ::fidl_next::protocol::Flexibility,
5132 body: ::fidl_next::Body<___T>,
5133 responder: ::fidl_next::protocol::Responder<___T>,
5134 ) -> ::core::result::Result<
5135 (),
5136 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5137 > {
5138 match ordinal {
5139 5503092096911271565 => {
5140 let responder = ::fidl_next::Responder::from_untyped(responder);
5141
5142 match ::fidl_next::AsDecoderExt::into_decoded(body) {
5143 Ok(decoded) => {
5144 handler
5145 .validate_buffer_collection_token(
5146 ::fidl_next::Request::from_decoded(decoded),
5147 responder,
5148 )
5149 .await;
5150 Ok(())
5151 }
5152 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5153 ordinal: 5503092096911271565,
5154 error,
5155 }),
5156 }
5157 }
5158
5159 2425330313826721273 => {
5160 let responder = ::fidl_next::Responder::from_untyped(responder);
5161
5162 match ::fidl_next::AsDecoderExt::into_decoded(body) {
5163 Ok(decoded) => {
5164 handler
5165 .get_vmo_info(::fidl_next::Request::from_decoded(decoded), responder)
5166 .await;
5167 Ok(())
5168 }
5169 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5170 ordinal: 2425330313826721273,
5171 error,
5172 }),
5173 }
5174 }
5175
5176 ordinal => {
5177 handler.on_unknown_interaction(ordinal).await;
5178 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5179 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5180 } else {
5181 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
5182 ordinal,
5183 flexibility,
5184 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
5185 )
5186 .expect("encoding a framework error should never fail")
5187 .await?;
5188 Ok(())
5189 }
5190 }
5191 }
5192 }
5193}
5194
5195impl<___T> AllocatorClientHandler<___T> for ::fidl_next::IgnoreEvents
5196where
5197 ___T: ::fidl_next::Transport,
5198{
5199 async fn on_unknown_interaction(&mut self, _: u64) {}
5200}
5201
5202impl<___H, ___T> AllocatorLocalClientHandler<___T> for ::fidl_next::Local<___H>
5203where
5204 ___H: AllocatorClientHandler<___T>,
5205 ___T: ::fidl_next::Transport,
5206{
5207 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5208 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5209 }
5210}
5211
5212impl<___H, ___T> AllocatorLocalServerHandler<___T> for ::fidl_next::Local<___H>
5213where
5214 ___H: AllocatorServerHandler<___T>,
5215 ___T: ::fidl_next::Transport,
5216{
5217 async fn allocate_non_shared_collection(
5218 &mut self,
5219
5220 request: ::fidl_next::Request<allocator::AllocateNonSharedCollection, ___T>,
5221 ) {
5222 ___H::allocate_non_shared_collection(&mut self.0, request).await
5223 }
5224
5225 async fn allocate_shared_collection(
5226 &mut self,
5227
5228 request: ::fidl_next::Request<allocator::AllocateSharedCollection, ___T>,
5229 ) {
5230 ___H::allocate_shared_collection(&mut self.0, request).await
5231 }
5232
5233 async fn bind_shared_collection(
5234 &mut self,
5235
5236 request: ::fidl_next::Request<allocator::BindSharedCollection, ___T>,
5237 ) {
5238 ___H::bind_shared_collection(&mut self.0, request).await
5239 }
5240
5241 async fn validate_buffer_collection_token(
5242 &mut self,
5243
5244 request: ::fidl_next::Request<allocator::ValidateBufferCollectionToken, ___T>,
5245
5246 responder: ::fidl_next::Responder<allocator::ValidateBufferCollectionToken, ___T>,
5247 ) {
5248 ___H::validate_buffer_collection_token(&mut self.0, request, responder).await
5249 }
5250
5251 async fn set_debug_client_info(
5252 &mut self,
5253
5254 request: ::fidl_next::Request<allocator::SetDebugClientInfo, ___T>,
5255 ) {
5256 ___H::set_debug_client_info(&mut self.0, request).await
5257 }
5258
5259 async fn get_vmo_info(
5260 &mut self,
5261
5262 request: ::fidl_next::Request<allocator::GetVmoInfo, ___T>,
5263
5264 responder: ::fidl_next::Responder<allocator::GetVmoInfo, ___T>,
5265 ) {
5266 ___H::get_vmo_info(&mut self.0, request, responder).await
5267 }
5268
5269 async fn on_unknown_interaction(&mut self, ordinal: u64) {
5270 ___H::on_unknown_interaction(&mut self.0, ordinal).await
5271 }
5272}
5273
5274#[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"]
5276#[derive(PartialEq, Debug)]
5277pub struct Node;
5278
5279#[cfg(target_os = "fuchsia")]
5280impl ::fidl_next::HasTransport for Node {
5281 type Transport = ::fidl_next::fuchsia::zx::Channel;
5282}
5283
5284pub mod node {
5285 pub mod prelude {
5286 pub use crate::{
5287 Node, NodeClientHandler, NodeLocalClientHandler, NodeLocalServerHandler,
5288 NodeServerHandler, node,
5289 };
5290
5291 pub use crate::natural::Error;
5292
5293 pub use crate::natural::NodeAttachNodeTrackingRequest;
5294
5295 pub use crate::natural::NodeIsAlternateForRequest;
5296
5297 pub use crate::natural::NodeSetDebugClientInfoRequest;
5298
5299 pub use crate::natural::NodeSetDebugTimeoutLogDeadlineRequest;
5300
5301 pub use crate::natural::NodeSetNameRequest;
5302
5303 pub use crate::natural::NodeSetWeakOkRequest;
5304
5305 pub use crate::natural::NodeGetBufferCollectionIdResponse;
5306
5307 pub use crate::natural::NodeGetNodeRefResponse;
5308
5309 pub use crate::natural::NodeIsAlternateForResponse;
5310
5311 pub use crate::natural::NodeSyncResponse;
5312 }
5313
5314 pub struct Sync;
5315
5316 impl ::fidl_next::Method for Sync {
5317 const ORDINAL: u64 = 1273433845120064340;
5318 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5319 ::fidl_next::protocol::Flexibility::Flexible;
5320
5321 type Protocol = crate::Node;
5322
5323 type Request = ::fidl_next::wire::EmptyMessageBody;
5324 }
5325
5326 impl ::fidl_next::TwoWayMethod for Sync {
5327 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::NodeSyncResponse>;
5328 }
5329
5330 impl<___R> ::fidl_next::Respond<___R> for Sync {
5331 type Output = ::fidl_next::Flexible<___R>;
5332
5333 fn respond(response: ___R) -> Self::Output {
5334 ::fidl_next::Flexible::Ok(response)
5335 }
5336 }
5337
5338 pub struct Release;
5339
5340 impl ::fidl_next::Method for Release {
5341 const ORDINAL: u64 = 7664192519607813318;
5342 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5343 ::fidl_next::protocol::Flexibility::Flexible;
5344
5345 type Protocol = crate::Node;
5346
5347 type Request = ::fidl_next::wire::EmptyMessageBody;
5348 }
5349
5350 pub struct SetName;
5351
5352 impl ::fidl_next::Method for SetName {
5353 const ORDINAL: u64 = 811194812442657257;
5354 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5355 ::fidl_next::protocol::Flexibility::Flexible;
5356
5357 type Protocol = crate::Node;
5358
5359 type Request = crate::wire::NodeSetNameRequest<'static>;
5360 }
5361
5362 pub struct SetDebugClientInfo;
5363
5364 impl ::fidl_next::Method for SetDebugClientInfo {
5365 const ORDINAL: u64 = 6691936816931379633;
5366 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5367 ::fidl_next::protocol::Flexibility::Flexible;
5368
5369 type Protocol = crate::Node;
5370
5371 type Request = crate::wire::NodeSetDebugClientInfoRequest<'static>;
5372 }
5373
5374 pub struct SetDebugTimeoutLogDeadline;
5375
5376 impl ::fidl_next::Method for SetDebugTimeoutLogDeadline {
5377 const ORDINAL: u64 = 8172637980026734598;
5378 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5379 ::fidl_next::protocol::Flexibility::Flexible;
5380
5381 type Protocol = crate::Node;
5382
5383 type Request = crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>;
5384 }
5385
5386 pub struct SetVerboseLogging;
5387
5388 impl ::fidl_next::Method for SetVerboseLogging {
5389 const ORDINAL: u64 = 5911475287294795693;
5390 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5391 ::fidl_next::protocol::Flexibility::Flexible;
5392
5393 type Protocol = crate::Node;
5394
5395 type Request = ::fidl_next::wire::EmptyMessageBody;
5396 }
5397
5398 pub struct GetNodeRef;
5399
5400 impl ::fidl_next::Method for GetNodeRef {
5401 const ORDINAL: u64 = 6574426773718429779;
5402 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5403 ::fidl_next::protocol::Flexibility::Flexible;
5404
5405 type Protocol = crate::Node;
5406
5407 type Request = ::fidl_next::wire::EmptyMessageBody;
5408 }
5409
5410 impl ::fidl_next::TwoWayMethod for GetNodeRef {
5411 type Response =
5412 ::fidl_next::wire::Flexible<'static, crate::wire::NodeGetNodeRefResponse<'static>>;
5413 }
5414
5415 impl<___R> ::fidl_next::Respond<___R> for GetNodeRef {
5416 type Output = ::fidl_next::Flexible<___R>;
5417
5418 fn respond(response: ___R) -> Self::Output {
5419 ::fidl_next::Flexible::Ok(response)
5420 }
5421 }
5422
5423 pub struct IsAlternateFor;
5424
5425 impl ::fidl_next::Method for IsAlternateFor {
5426 const ORDINAL: u64 = 262772284282767397;
5427 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5428 ::fidl_next::protocol::Flexibility::Flexible;
5429
5430 type Protocol = crate::Node;
5431
5432 type Request = crate::wire::NodeIsAlternateForRequest<'static>;
5433 }
5434
5435 impl ::fidl_next::TwoWayMethod for IsAlternateFor {
5436 type Response = ::fidl_next::wire::FlexibleResult<
5437 'static,
5438 crate::wire::NodeIsAlternateForResponse<'static>,
5439 crate::wire::Error,
5440 >;
5441 }
5442
5443 impl<___R> ::fidl_next::Respond<___R> for IsAlternateFor {
5444 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
5445
5446 fn respond(response: ___R) -> Self::Output {
5447 ::fidl_next::FlexibleResult::Ok(response)
5448 }
5449 }
5450
5451 impl<___R> ::fidl_next::RespondErr<___R> for IsAlternateFor {
5452 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
5453
5454 fn respond_err(response: ___R) -> Self::Output {
5455 ::fidl_next::FlexibleResult::Err(response)
5456 }
5457 }
5458
5459 pub struct GetBufferCollectionId;
5460
5461 impl ::fidl_next::Method for GetBufferCollectionId {
5462 const ORDINAL: u64 = 8633851600235444876;
5463 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5464 ::fidl_next::protocol::Flexibility::Flexible;
5465
5466 type Protocol = crate::Node;
5467
5468 type Request = ::fidl_next::wire::EmptyMessageBody;
5469 }
5470
5471 impl ::fidl_next::TwoWayMethod for GetBufferCollectionId {
5472 type Response = ::fidl_next::wire::Flexible<
5473 'static,
5474 crate::wire::NodeGetBufferCollectionIdResponse<'static>,
5475 >;
5476 }
5477
5478 impl<___R> ::fidl_next::Respond<___R> for GetBufferCollectionId {
5479 type Output = ::fidl_next::Flexible<___R>;
5480
5481 fn respond(response: ___R) -> Self::Output {
5482 ::fidl_next::Flexible::Ok(response)
5483 }
5484 }
5485
5486 pub struct SetWeak;
5487
5488 impl ::fidl_next::Method for SetWeak {
5489 const ORDINAL: u64 = 2512233045884338145;
5490 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5491 ::fidl_next::protocol::Flexibility::Flexible;
5492
5493 type Protocol = crate::Node;
5494
5495 type Request = ::fidl_next::wire::EmptyMessageBody;
5496 }
5497
5498 pub struct SetWeakOk;
5499
5500 impl ::fidl_next::Method for SetWeakOk {
5501 const ORDINAL: u64 = 4081474869151288297;
5502 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5503 ::fidl_next::protocol::Flexibility::Flexible;
5504
5505 type Protocol = crate::Node;
5506
5507 type Request = crate::wire::NodeSetWeakOkRequest<'static>;
5508 }
5509
5510 pub struct AttachNodeTracking;
5511
5512 impl ::fidl_next::Method for AttachNodeTracking {
5513 const ORDINAL: u64 = 4549465353676377516;
5514 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
5515 ::fidl_next::protocol::Flexibility::Flexible;
5516
5517 type Protocol = crate::Node;
5518
5519 type Request = crate::wire::NodeAttachNodeTrackingRequest<'static>;
5520 }
5521
5522 mod ___detail {
5523 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::Node
5524 where
5525 ___T: ::fidl_next::Transport,
5526 {
5527 type Client = NodeClient<___T>;
5528 type Server = NodeServer<___T>;
5529 }
5530
5531 #[repr(transparent)]
5533 pub struct NodeClient<___T: ::fidl_next::Transport> {
5534 #[allow(dead_code)]
5535 client: ::fidl_next::protocol::Client<___T>,
5536 }
5537
5538 impl<___T> NodeClient<___T>
5539 where
5540 ___T: ::fidl_next::Transport,
5541 {
5542 #[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"]
5543 pub fn sync(&self) -> ::fidl_next::TwoWayFuture<'_, super::Sync, ___T> {
5544 ::fidl_next::TwoWayFuture::from_untyped(
5545 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
5546 1273433845120064340,
5547 <super::Sync as ::fidl_next::Method>::FLEXIBILITY,
5548 (),
5549 ),
5550 )
5551 }
5552
5553 #[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"]
5554 pub fn release(&self) -> ::fidl_next::SendFuture<'_, ___T> {
5555 ::fidl_next::SendFuture::from_untyped(
5556 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
5557 7664192519607813318,
5558 <super::Release as ::fidl_next::Method>::FLEXIBILITY,
5559 (),
5560 ),
5561 )
5562 }
5563
5564 #[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"]
5565 pub fn set_name_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
5566 where
5567 ___R: ::fidl_next::Encode<
5568 crate::wire::NodeSetNameRequest<'static>,
5569 <___T as ::fidl_next::Transport>::SendBuffer,
5570 >,
5571 {
5572 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5573 811194812442657257,
5574 <super::SetName as ::fidl_next::Method>::FLEXIBILITY,
5575 request,
5576 ))
5577 }
5578
5579 #[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"]
5580 pub fn set_debug_client_info_with<___R>(
5581 &self,
5582 request: ___R,
5583 ) -> ::fidl_next::SendFuture<'_, ___T>
5584 where
5585 ___R: ::fidl_next::Encode<
5586 crate::wire::NodeSetDebugClientInfoRequest<'static>,
5587 <___T as ::fidl_next::Transport>::SendBuffer,
5588 >,
5589 {
5590 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5591 6691936816931379633,
5592 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
5593 request,
5594 ))
5595 }
5596
5597 #[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"]
5598 pub fn set_debug_timeout_log_deadline_with<___R>(
5599 &self,
5600 request: ___R,
5601 ) -> ::fidl_next::SendFuture<'_, ___T>
5602 where
5603 ___R: ::fidl_next::Encode<
5604 crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>,
5605 <___T as ::fidl_next::Transport>::SendBuffer,
5606 >,
5607 {
5608 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5609 8172637980026734598,
5610 <super::SetDebugTimeoutLogDeadline as ::fidl_next::Method>::FLEXIBILITY,
5611 request,
5612 ))
5613 }
5614
5615 #[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"]
5616 pub fn set_verbose_logging(&self) -> ::fidl_next::SendFuture<'_, ___T> {
5617 ::fidl_next::SendFuture::from_untyped(
5618 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
5619 5911475287294795693,
5620 <super::SetVerboseLogging as ::fidl_next::Method>::FLEXIBILITY,
5621 (),
5622 ),
5623 )
5624 }
5625
5626 #[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"]
5627 pub fn get_node_ref(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetNodeRef, ___T> {
5628 ::fidl_next::TwoWayFuture::from_untyped(
5629 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
5630 6574426773718429779,
5631 <super::GetNodeRef as ::fidl_next::Method>::FLEXIBILITY,
5632 (),
5633 ),
5634 )
5635 }
5636
5637 #[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"]
5638 pub fn is_alternate_for_with<___R>(
5639 &self,
5640 request: ___R,
5641 ) -> ::fidl_next::TwoWayFuture<'_, super::IsAlternateFor, ___T>
5642 where
5643 ___R: ::fidl_next::Encode<
5644 crate::wire::NodeIsAlternateForRequest<'static>,
5645 <___T as ::fidl_next::Transport>::SendBuffer,
5646 >,
5647 {
5648 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
5649 262772284282767397,
5650 <super::IsAlternateFor as ::fidl_next::Method>::FLEXIBILITY,
5651 request,
5652 ))
5653 }
5654
5655 #[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"]
5656 pub fn get_buffer_collection_id(
5657 &self,
5658 ) -> ::fidl_next::TwoWayFuture<'_, super::GetBufferCollectionId, ___T> {
5659 ::fidl_next::TwoWayFuture::from_untyped(
5660 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
5661 8633851600235444876,
5662 <super::GetBufferCollectionId as ::fidl_next::Method>::FLEXIBILITY,
5663 (),
5664 ),
5665 )
5666 }
5667
5668 #[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"]
5669 pub fn set_weak(&self) -> ::fidl_next::SendFuture<'_, ___T> {
5670 ::fidl_next::SendFuture::from_untyped(
5671 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
5672 2512233045884338145,
5673 <super::SetWeak as ::fidl_next::Method>::FLEXIBILITY,
5674 (),
5675 ),
5676 )
5677 }
5678
5679 #[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"]
5680 pub fn set_weak_ok_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
5681 where
5682 ___R: ::fidl_next::Encode<
5683 crate::wire::NodeSetWeakOkRequest<'static>,
5684 <___T as ::fidl_next::Transport>::SendBuffer,
5685 >,
5686 {
5687 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5688 4081474869151288297,
5689 <super::SetWeakOk as ::fidl_next::Method>::FLEXIBILITY,
5690 request,
5691 ))
5692 }
5693
5694 #[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"]
5695 pub fn attach_node_tracking_with<___R>(
5696 &self,
5697 request: ___R,
5698 ) -> ::fidl_next::SendFuture<'_, ___T>
5699 where
5700 ___R: ::fidl_next::Encode<
5701 crate::wire::NodeAttachNodeTrackingRequest<'static>,
5702 <___T as ::fidl_next::Transport>::SendBuffer,
5703 >,
5704 {
5705 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
5706 4549465353676377516,
5707 <super::AttachNodeTracking as ::fidl_next::Method>::FLEXIBILITY,
5708 request,
5709 ))
5710 }
5711 }
5712
5713 #[repr(transparent)]
5715 pub struct NodeServer<___T: ::fidl_next::Transport> {
5716 server: ::fidl_next::protocol::Server<___T>,
5717 }
5718
5719 impl<___T> NodeServer<___T> where ___T: ::fidl_next::Transport {}
5720 }
5721}
5722
5723#[diagnostic::on_unimplemented(
5724 note = "If {Self} implements the non-local NodeClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
5725)]
5726
5727pub trait NodeLocalClientHandler<
5731 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5732 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5733>
5734{
5735 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5736 ::core::future::ready(())
5737 }
5738}
5739
5740impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for Node
5741where
5742 ___H: NodeLocalClientHandler<___T>,
5743 ___T: ::fidl_next::Transport,
5744{
5745 async fn on_event(
5746 handler: &mut ___H,
5747 ordinal: u64,
5748 flexibility: ::fidl_next::protocol::Flexibility,
5749 body: ::fidl_next::Body<___T>,
5750 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
5751 match ordinal {
5752 ordinal => {
5753 handler.on_unknown_interaction(ordinal).await;
5754 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5755 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5756 } else {
5757 Ok(())
5758 }
5759 }
5760 }
5761 }
5762}
5763
5764#[diagnostic::on_unimplemented(
5765 note = "If {Self} implements the non-local NodeServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
5766)]
5767
5768pub trait NodeLocalServerHandler<
5772 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
5773 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
5774>
5775{
5776 #[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"]
5777 fn sync(
5778 &mut self,
5779
5780 responder: ::fidl_next::Responder<node::Sync, ___T>,
5781 ) -> impl ::core::future::Future<Output = ()>;
5782
5783 #[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"]
5784 fn release(&mut self) -> impl ::core::future::Future<Output = ()>;
5785
5786 #[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"]
5787 fn set_name(
5788 &mut self,
5789
5790 request: ::fidl_next::Request<node::SetName, ___T>,
5791 ) -> impl ::core::future::Future<Output = ()>;
5792
5793 #[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"]
5794 fn set_debug_client_info(
5795 &mut self,
5796
5797 request: ::fidl_next::Request<node::SetDebugClientInfo, ___T>,
5798 ) -> impl ::core::future::Future<Output = ()>;
5799
5800 #[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"]
5801 fn set_debug_timeout_log_deadline(
5802 &mut self,
5803
5804 request: ::fidl_next::Request<node::SetDebugTimeoutLogDeadline, ___T>,
5805 ) -> impl ::core::future::Future<Output = ()>;
5806
5807 #[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"]
5808 fn set_verbose_logging(&mut self) -> impl ::core::future::Future<Output = ()>;
5809
5810 #[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"]
5811 fn get_node_ref(
5812 &mut self,
5813
5814 responder: ::fidl_next::Responder<node::GetNodeRef, ___T>,
5815 ) -> impl ::core::future::Future<Output = ()>;
5816
5817 #[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"]
5818 fn is_alternate_for(
5819 &mut self,
5820
5821 request: ::fidl_next::Request<node::IsAlternateFor, ___T>,
5822
5823 responder: ::fidl_next::Responder<node::IsAlternateFor, ___T>,
5824 ) -> impl ::core::future::Future<Output = ()>;
5825
5826 #[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"]
5827 fn get_buffer_collection_id(
5828 &mut self,
5829
5830 responder: ::fidl_next::Responder<node::GetBufferCollectionId, ___T>,
5831 ) -> impl ::core::future::Future<Output = ()>;
5832
5833 #[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"]
5834 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()>;
5835
5836 #[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"]
5837 fn set_weak_ok(
5838 &mut self,
5839
5840 request: ::fidl_next::Request<node::SetWeakOk, ___T>,
5841 ) -> impl ::core::future::Future<Output = ()>;
5842
5843 #[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"]
5844 fn attach_node_tracking(
5845 &mut self,
5846
5847 request: ::fidl_next::Request<node::AttachNodeTracking, ___T>,
5848 ) -> impl ::core::future::Future<Output = ()>;
5849
5850 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
5851 ::core::future::ready(())
5852 }
5853}
5854
5855impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for Node
5856where
5857 ___H: NodeLocalServerHandler<___T>,
5858 ___T: ::fidl_next::Transport,
5859 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
5860 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5861 Constraint = (),
5862 >,
5863 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
5864 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5865 Constraint = (),
5866 >,
5867 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
5868 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5869 Constraint = (),
5870 >,
5871 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
5872 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5873 Constraint = (),
5874 >,
5875 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
5876 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5877 Constraint = (),
5878 >,
5879 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
5880 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
5881 Constraint = (),
5882 >,
5883{
5884 async fn on_one_way(
5885 handler: &mut ___H,
5886 ordinal: u64,
5887 flexibility: ::fidl_next::protocol::Flexibility,
5888 body: ::fidl_next::Body<___T>,
5889 ) -> ::core::result::Result<
5890 (),
5891 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5892 > {
5893 match ordinal {
5894 7664192519607813318 => {
5895 handler.release().await;
5896 Ok(())
5897 }
5898
5899 811194812442657257 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5900 Ok(decoded) => {
5901 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
5902 Ok(())
5903 }
5904 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5905 ordinal: 811194812442657257,
5906 error,
5907 }),
5908 },
5909
5910 6691936816931379633 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5911 Ok(decoded) => {
5912 handler
5913 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
5914 .await;
5915 Ok(())
5916 }
5917 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5918 ordinal: 6691936816931379633,
5919 error,
5920 }),
5921 },
5922
5923 8172637980026734598 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5924 Ok(decoded) => {
5925 handler
5926 .set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded))
5927 .await;
5928 Ok(())
5929 }
5930 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5931 ordinal: 8172637980026734598,
5932 error,
5933 }),
5934 },
5935
5936 5911475287294795693 => {
5937 handler.set_verbose_logging().await;
5938 Ok(())
5939 }
5940
5941 2512233045884338145 => {
5942 handler.set_weak().await;
5943 Ok(())
5944 }
5945
5946 4081474869151288297 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5947 Ok(decoded) => {
5948 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
5949 Ok(())
5950 }
5951 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5952 ordinal: 4081474869151288297,
5953 error,
5954 }),
5955 },
5956
5957 4549465353676377516 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
5958 Ok(decoded) => {
5959 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
5960 Ok(())
5961 }
5962 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
5963 ordinal: 4549465353676377516,
5964 error,
5965 }),
5966 },
5967
5968 ordinal => {
5969 handler.on_unknown_interaction(ordinal).await;
5970 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
5971 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
5972 } else {
5973 Ok(())
5974 }
5975 }
5976 }
5977 }
5978
5979 async fn on_two_way(
5980 handler: &mut ___H,
5981 ordinal: u64,
5982 flexibility: ::fidl_next::protocol::Flexibility,
5983 body: ::fidl_next::Body<___T>,
5984 responder: ::fidl_next::protocol::Responder<___T>,
5985 ) -> ::core::result::Result<
5986 (),
5987 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
5988 > {
5989 match ordinal {
5990 1273433845120064340 => {
5991 let responder = ::fidl_next::Responder::from_untyped(responder);
5992
5993 handler.sync(responder).await;
5994 Ok(())
5995 }
5996
5997 6574426773718429779 => {
5998 let responder = ::fidl_next::Responder::from_untyped(responder);
5999
6000 handler.get_node_ref(responder).await;
6001 Ok(())
6002 }
6003
6004 262772284282767397 => {
6005 let responder = ::fidl_next::Responder::from_untyped(responder);
6006
6007 match ::fidl_next::AsDecoderExt::into_decoded(body) {
6008 Ok(decoded) => {
6009 handler
6010 .is_alternate_for(
6011 ::fidl_next::Request::from_decoded(decoded),
6012 responder,
6013 )
6014 .await;
6015 Ok(())
6016 }
6017 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6018 ordinal: 262772284282767397,
6019 error,
6020 }),
6021 }
6022 }
6023
6024 8633851600235444876 => {
6025 let responder = ::fidl_next::Responder::from_untyped(responder);
6026
6027 handler.get_buffer_collection_id(responder).await;
6028 Ok(())
6029 }
6030
6031 ordinal => {
6032 handler.on_unknown_interaction(ordinal).await;
6033 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
6034 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6035 } else {
6036 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
6037 ordinal,
6038 flexibility,
6039 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
6040 )
6041 .expect("encoding a framework error should never fail")
6042 .await?;
6043 Ok(())
6044 }
6045 }
6046 }
6047 }
6048}
6049
6050pub trait NodeClientHandler<
6054 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6055 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6056>
6057{
6058 fn on_unknown_interaction(
6059 &mut self,
6060 ordinal: u64,
6061 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
6062 ::core::future::ready(())
6063 }
6064}
6065
6066impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for Node
6067where
6068 ___H: NodeClientHandler<___T> + ::core::marker::Send,
6069 ___T: ::fidl_next::Transport,
6070{
6071 async fn on_event(
6072 handler: &mut ___H,
6073 ordinal: u64,
6074 flexibility: ::fidl_next::protocol::Flexibility,
6075 body: ::fidl_next::Body<___T>,
6076 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
6077 match ordinal {
6078 ordinal => {
6079 handler.on_unknown_interaction(ordinal).await;
6080 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
6081 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6082 } else {
6083 Ok(())
6084 }
6085 }
6086 }
6087 }
6088}
6089
6090pub trait NodeServerHandler<
6094 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
6095 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
6096>
6097{
6098 #[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"]
6099 fn sync(
6100 &mut self,
6101
6102 responder: ::fidl_next::Responder<node::Sync, ___T>,
6103 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6104
6105 #[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"]
6106 fn release(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6107
6108 #[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"]
6109 fn set_name(
6110 &mut self,
6111
6112 request: ::fidl_next::Request<node::SetName, ___T>,
6113 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6114
6115 #[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"]
6116 fn set_debug_client_info(
6117 &mut self,
6118
6119 request: ::fidl_next::Request<node::SetDebugClientInfo, ___T>,
6120 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6121
6122 #[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"]
6123 fn set_debug_timeout_log_deadline(
6124 &mut self,
6125
6126 request: ::fidl_next::Request<node::SetDebugTimeoutLogDeadline, ___T>,
6127 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6128
6129 #[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"]
6130 fn set_verbose_logging(
6131 &mut self,
6132 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6133
6134 #[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"]
6135 fn get_node_ref(
6136 &mut self,
6137
6138 responder: ::fidl_next::Responder<node::GetNodeRef, ___T>,
6139 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6140
6141 #[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"]
6142 fn is_alternate_for(
6143 &mut self,
6144
6145 request: ::fidl_next::Request<node::IsAlternateFor, ___T>,
6146
6147 responder: ::fidl_next::Responder<node::IsAlternateFor, ___T>,
6148 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6149
6150 #[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"]
6151 fn get_buffer_collection_id(
6152 &mut self,
6153
6154 responder: ::fidl_next::Responder<node::GetBufferCollectionId, ___T>,
6155 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6156
6157 #[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"]
6158 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6159
6160 #[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"]
6161 fn set_weak_ok(
6162 &mut self,
6163
6164 request: ::fidl_next::Request<node::SetWeakOk, ___T>,
6165 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6166
6167 #[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"]
6168 fn attach_node_tracking(
6169 &mut self,
6170
6171 request: ::fidl_next::Request<node::AttachNodeTracking, ___T>,
6172 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
6173
6174 fn on_unknown_interaction(
6175 &mut self,
6176 ordinal: u64,
6177 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
6178 ::core::future::ready(())
6179 }
6180}
6181
6182impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for Node
6183where
6184 ___H: NodeServerHandler<___T> + ::core::marker::Send,
6185 ___T: ::fidl_next::Transport,
6186 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
6187 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6188 Constraint = (),
6189 >,
6190 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
6191 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6192 Constraint = (),
6193 >,
6194 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
6195 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6196 Constraint = (),
6197 >,
6198 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
6199 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6200 Constraint = (),
6201 >,
6202 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
6203 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6204 Constraint = (),
6205 >,
6206 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
6207 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
6208 Constraint = (),
6209 >,
6210{
6211 async fn on_one_way(
6212 handler: &mut ___H,
6213 ordinal: u64,
6214 flexibility: ::fidl_next::protocol::Flexibility,
6215 body: ::fidl_next::Body<___T>,
6216 ) -> ::core::result::Result<
6217 (),
6218 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6219 > {
6220 match ordinal {
6221 7664192519607813318 => {
6222 handler.release().await;
6223 Ok(())
6224 }
6225
6226 811194812442657257 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
6227 Ok(decoded) => {
6228 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
6229 Ok(())
6230 }
6231 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6232 ordinal: 811194812442657257,
6233 error,
6234 }),
6235 },
6236
6237 6691936816931379633 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
6238 Ok(decoded) => {
6239 handler
6240 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
6241 .await;
6242 Ok(())
6243 }
6244 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6245 ordinal: 6691936816931379633,
6246 error,
6247 }),
6248 },
6249
6250 8172637980026734598 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
6251 Ok(decoded) => {
6252 handler
6253 .set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded))
6254 .await;
6255 Ok(())
6256 }
6257 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6258 ordinal: 8172637980026734598,
6259 error,
6260 }),
6261 },
6262
6263 5911475287294795693 => {
6264 handler.set_verbose_logging().await;
6265 Ok(())
6266 }
6267
6268 2512233045884338145 => {
6269 handler.set_weak().await;
6270 Ok(())
6271 }
6272
6273 4081474869151288297 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
6274 Ok(decoded) => {
6275 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
6276 Ok(())
6277 }
6278 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6279 ordinal: 4081474869151288297,
6280 error,
6281 }),
6282 },
6283
6284 4549465353676377516 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
6285 Ok(decoded) => {
6286 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
6287 Ok(())
6288 }
6289 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6290 ordinal: 4549465353676377516,
6291 error,
6292 }),
6293 },
6294
6295 ordinal => {
6296 handler.on_unknown_interaction(ordinal).await;
6297 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
6298 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6299 } else {
6300 Ok(())
6301 }
6302 }
6303 }
6304 }
6305
6306 async fn on_two_way(
6307 handler: &mut ___H,
6308 ordinal: u64,
6309 flexibility: ::fidl_next::protocol::Flexibility,
6310 body: ::fidl_next::Body<___T>,
6311 responder: ::fidl_next::protocol::Responder<___T>,
6312 ) -> ::core::result::Result<
6313 (),
6314 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
6315 > {
6316 match ordinal {
6317 1273433845120064340 => {
6318 let responder = ::fidl_next::Responder::from_untyped(responder);
6319
6320 handler.sync(responder).await;
6321 Ok(())
6322 }
6323
6324 6574426773718429779 => {
6325 let responder = ::fidl_next::Responder::from_untyped(responder);
6326
6327 handler.get_node_ref(responder).await;
6328 Ok(())
6329 }
6330
6331 262772284282767397 => {
6332 let responder = ::fidl_next::Responder::from_untyped(responder);
6333
6334 match ::fidl_next::AsDecoderExt::into_decoded(body) {
6335 Ok(decoded) => {
6336 handler
6337 .is_alternate_for(
6338 ::fidl_next::Request::from_decoded(decoded),
6339 responder,
6340 )
6341 .await;
6342 Ok(())
6343 }
6344 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
6345 ordinal: 262772284282767397,
6346 error,
6347 }),
6348 }
6349 }
6350
6351 8633851600235444876 => {
6352 let responder = ::fidl_next::Responder::from_untyped(responder);
6353
6354 handler.get_buffer_collection_id(responder).await;
6355 Ok(())
6356 }
6357
6358 ordinal => {
6359 handler.on_unknown_interaction(ordinal).await;
6360 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
6361 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
6362 } else {
6363 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
6364 ordinal,
6365 flexibility,
6366 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
6367 )
6368 .expect("encoding a framework error should never fail")
6369 .await?;
6370 Ok(())
6371 }
6372 }
6373 }
6374 }
6375}
6376
6377impl<___T> NodeClientHandler<___T> for ::fidl_next::IgnoreEvents
6378where
6379 ___T: ::fidl_next::Transport,
6380{
6381 async fn on_unknown_interaction(&mut self, _: u64) {}
6382}
6383
6384impl<___H, ___T> NodeLocalClientHandler<___T> for ::fidl_next::Local<___H>
6385where
6386 ___H: NodeClientHandler<___T>,
6387 ___T: ::fidl_next::Transport,
6388{
6389 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6390 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6391 }
6392}
6393
6394impl<___H, ___T> NodeLocalServerHandler<___T> for ::fidl_next::Local<___H>
6395where
6396 ___H: NodeServerHandler<___T>,
6397 ___T: ::fidl_next::Transport,
6398{
6399 async fn sync(&mut self, responder: ::fidl_next::Responder<node::Sync, ___T>) {
6400 ___H::sync(&mut self.0, responder).await
6401 }
6402
6403 async fn release(&mut self) {
6404 ___H::release(&mut self.0).await
6405 }
6406
6407 async fn set_name(&mut self, request: ::fidl_next::Request<node::SetName, ___T>) {
6408 ___H::set_name(&mut self.0, request).await
6409 }
6410
6411 async fn set_debug_client_info(
6412 &mut self,
6413
6414 request: ::fidl_next::Request<node::SetDebugClientInfo, ___T>,
6415 ) {
6416 ___H::set_debug_client_info(&mut self.0, request).await
6417 }
6418
6419 async fn set_debug_timeout_log_deadline(
6420 &mut self,
6421
6422 request: ::fidl_next::Request<node::SetDebugTimeoutLogDeadline, ___T>,
6423 ) {
6424 ___H::set_debug_timeout_log_deadline(&mut self.0, request).await
6425 }
6426
6427 async fn set_verbose_logging(&mut self) {
6428 ___H::set_verbose_logging(&mut self.0).await
6429 }
6430
6431 async fn get_node_ref(&mut self, responder: ::fidl_next::Responder<node::GetNodeRef, ___T>) {
6432 ___H::get_node_ref(&mut self.0, responder).await
6433 }
6434
6435 async fn is_alternate_for(
6436 &mut self,
6437
6438 request: ::fidl_next::Request<node::IsAlternateFor, ___T>,
6439
6440 responder: ::fidl_next::Responder<node::IsAlternateFor, ___T>,
6441 ) {
6442 ___H::is_alternate_for(&mut self.0, request, responder).await
6443 }
6444
6445 async fn get_buffer_collection_id(
6446 &mut self,
6447
6448 responder: ::fidl_next::Responder<node::GetBufferCollectionId, ___T>,
6449 ) {
6450 ___H::get_buffer_collection_id(&mut self.0, responder).await
6451 }
6452
6453 async fn set_weak(&mut self) {
6454 ___H::set_weak(&mut self.0).await
6455 }
6456
6457 async fn set_weak_ok(&mut self, request: ::fidl_next::Request<node::SetWeakOk, ___T>) {
6458 ___H::set_weak_ok(&mut self.0, request).await
6459 }
6460
6461 async fn attach_node_tracking(
6462 &mut self,
6463
6464 request: ::fidl_next::Request<node::AttachNodeTracking, ___T>,
6465 ) {
6466 ___H::attach_node_tracking(&mut self.0, request).await
6467 }
6468
6469 async fn on_unknown_interaction(&mut self, ordinal: u64) {
6470 ___H::on_unknown_interaction(&mut self.0, ordinal).await
6471 }
6472}
6473
6474#[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"]
6476#[derive(PartialEq, Debug)]
6477pub struct BufferCollection;
6478
6479#[cfg(target_os = "fuchsia")]
6480impl ::fidl_next::HasTransport for BufferCollection {
6481 type Transport = ::fidl_next::fuchsia::zx::Channel;
6482}
6483
6484pub mod buffer_collection {
6485 pub mod prelude {
6486 pub use crate::{
6487 BufferCollection, BufferCollectionClientHandler, BufferCollectionLocalClientHandler,
6488 BufferCollectionLocalServerHandler, BufferCollectionServerHandler, buffer_collection,
6489 };
6490
6491 pub use crate::natural::BufferCollectionAttachLifetimeTrackingRequest;
6492
6493 pub use crate::natural::BufferCollectionAttachTokenRequest;
6494
6495 pub use crate::natural::BufferCollectionSetConstraintsRequest;
6496
6497 pub use crate::natural::BufferCollectionCheckAllBuffersAllocatedResponse;
6498
6499 pub use crate::natural::BufferCollectionWaitForAllBuffersAllocatedResponse;
6500
6501 pub use crate::natural::Error;
6502
6503 pub use crate::natural::NodeAttachNodeTrackingRequest;
6504
6505 pub use crate::natural::NodeIsAlternateForRequest;
6506
6507 pub use crate::natural::NodeSetDebugClientInfoRequest;
6508
6509 pub use crate::natural::NodeSetDebugTimeoutLogDeadlineRequest;
6510
6511 pub use crate::natural::NodeSetNameRequest;
6512
6513 pub use crate::natural::NodeSetWeakOkRequest;
6514
6515 pub use crate::natural::NodeGetBufferCollectionIdResponse;
6516
6517 pub use crate::natural::NodeGetNodeRefResponse;
6518
6519 pub use crate::natural::NodeIsAlternateForResponse;
6520
6521 pub use crate::natural::NodeSyncResponse;
6522 }
6523
6524 pub struct Sync;
6525
6526 impl ::fidl_next::Method for Sync {
6527 const ORDINAL: u64 = 1273433845120064340;
6528 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6529 ::fidl_next::protocol::Flexibility::Flexible;
6530
6531 type Protocol = crate::BufferCollection;
6532
6533 type Request = ::fidl_next::wire::EmptyMessageBody;
6534 }
6535
6536 impl ::fidl_next::TwoWayMethod for Sync {
6537 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::NodeSyncResponse>;
6538 }
6539
6540 impl<___R> ::fidl_next::Respond<___R> for Sync {
6541 type Output = ::fidl_next::Flexible<___R>;
6542
6543 fn respond(response: ___R) -> Self::Output {
6544 ::fidl_next::Flexible::Ok(response)
6545 }
6546 }
6547
6548 pub struct Release;
6549
6550 impl ::fidl_next::Method for Release {
6551 const ORDINAL: u64 = 7664192519607813318;
6552 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6553 ::fidl_next::protocol::Flexibility::Flexible;
6554
6555 type Protocol = crate::BufferCollection;
6556
6557 type Request = ::fidl_next::wire::EmptyMessageBody;
6558 }
6559
6560 pub struct SetName;
6561
6562 impl ::fidl_next::Method for SetName {
6563 const ORDINAL: u64 = 811194812442657257;
6564 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6565 ::fidl_next::protocol::Flexibility::Flexible;
6566
6567 type Protocol = crate::BufferCollection;
6568
6569 type Request = crate::wire::NodeSetNameRequest<'static>;
6570 }
6571
6572 pub struct SetDebugClientInfo;
6573
6574 impl ::fidl_next::Method for SetDebugClientInfo {
6575 const ORDINAL: u64 = 6691936816931379633;
6576 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6577 ::fidl_next::protocol::Flexibility::Flexible;
6578
6579 type Protocol = crate::BufferCollection;
6580
6581 type Request = crate::wire::NodeSetDebugClientInfoRequest<'static>;
6582 }
6583
6584 pub struct SetDebugTimeoutLogDeadline;
6585
6586 impl ::fidl_next::Method for SetDebugTimeoutLogDeadline {
6587 const ORDINAL: u64 = 8172637980026734598;
6588 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6589 ::fidl_next::protocol::Flexibility::Flexible;
6590
6591 type Protocol = crate::BufferCollection;
6592
6593 type Request = crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>;
6594 }
6595
6596 pub struct SetVerboseLogging;
6597
6598 impl ::fidl_next::Method for SetVerboseLogging {
6599 const ORDINAL: u64 = 5911475287294795693;
6600 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6601 ::fidl_next::protocol::Flexibility::Flexible;
6602
6603 type Protocol = crate::BufferCollection;
6604
6605 type Request = ::fidl_next::wire::EmptyMessageBody;
6606 }
6607
6608 pub struct GetNodeRef;
6609
6610 impl ::fidl_next::Method for GetNodeRef {
6611 const ORDINAL: u64 = 6574426773718429779;
6612 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6613 ::fidl_next::protocol::Flexibility::Flexible;
6614
6615 type Protocol = crate::BufferCollection;
6616
6617 type Request = ::fidl_next::wire::EmptyMessageBody;
6618 }
6619
6620 impl ::fidl_next::TwoWayMethod for GetNodeRef {
6621 type Response =
6622 ::fidl_next::wire::Flexible<'static, crate::wire::NodeGetNodeRefResponse<'static>>;
6623 }
6624
6625 impl<___R> ::fidl_next::Respond<___R> for GetNodeRef {
6626 type Output = ::fidl_next::Flexible<___R>;
6627
6628 fn respond(response: ___R) -> Self::Output {
6629 ::fidl_next::Flexible::Ok(response)
6630 }
6631 }
6632
6633 pub struct IsAlternateFor;
6634
6635 impl ::fidl_next::Method for IsAlternateFor {
6636 const ORDINAL: u64 = 262772284282767397;
6637 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6638 ::fidl_next::protocol::Flexibility::Flexible;
6639
6640 type Protocol = crate::BufferCollection;
6641
6642 type Request = crate::wire::NodeIsAlternateForRequest<'static>;
6643 }
6644
6645 impl ::fidl_next::TwoWayMethod for IsAlternateFor {
6646 type Response = ::fidl_next::wire::FlexibleResult<
6647 'static,
6648 crate::wire::NodeIsAlternateForResponse<'static>,
6649 crate::wire::Error,
6650 >;
6651 }
6652
6653 impl<___R> ::fidl_next::Respond<___R> for IsAlternateFor {
6654 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
6655
6656 fn respond(response: ___R) -> Self::Output {
6657 ::fidl_next::FlexibleResult::Ok(response)
6658 }
6659 }
6660
6661 impl<___R> ::fidl_next::RespondErr<___R> for IsAlternateFor {
6662 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
6663
6664 fn respond_err(response: ___R) -> Self::Output {
6665 ::fidl_next::FlexibleResult::Err(response)
6666 }
6667 }
6668
6669 pub struct GetBufferCollectionId;
6670
6671 impl ::fidl_next::Method for GetBufferCollectionId {
6672 const ORDINAL: u64 = 8633851600235444876;
6673 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6674 ::fidl_next::protocol::Flexibility::Flexible;
6675
6676 type Protocol = crate::BufferCollection;
6677
6678 type Request = ::fidl_next::wire::EmptyMessageBody;
6679 }
6680
6681 impl ::fidl_next::TwoWayMethod for GetBufferCollectionId {
6682 type Response = ::fidl_next::wire::Flexible<
6683 'static,
6684 crate::wire::NodeGetBufferCollectionIdResponse<'static>,
6685 >;
6686 }
6687
6688 impl<___R> ::fidl_next::Respond<___R> for GetBufferCollectionId {
6689 type Output = ::fidl_next::Flexible<___R>;
6690
6691 fn respond(response: ___R) -> Self::Output {
6692 ::fidl_next::Flexible::Ok(response)
6693 }
6694 }
6695
6696 pub struct SetWeak;
6697
6698 impl ::fidl_next::Method for SetWeak {
6699 const ORDINAL: u64 = 2512233045884338145;
6700 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6701 ::fidl_next::protocol::Flexibility::Flexible;
6702
6703 type Protocol = crate::BufferCollection;
6704
6705 type Request = ::fidl_next::wire::EmptyMessageBody;
6706 }
6707
6708 pub struct SetWeakOk;
6709
6710 impl ::fidl_next::Method for SetWeakOk {
6711 const ORDINAL: u64 = 4081474869151288297;
6712 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6713 ::fidl_next::protocol::Flexibility::Flexible;
6714
6715 type Protocol = crate::BufferCollection;
6716
6717 type Request = crate::wire::NodeSetWeakOkRequest<'static>;
6718 }
6719
6720 pub struct AttachNodeTracking;
6721
6722 impl ::fidl_next::Method for AttachNodeTracking {
6723 const ORDINAL: u64 = 4549465353676377516;
6724 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6725 ::fidl_next::protocol::Flexibility::Flexible;
6726
6727 type Protocol = crate::BufferCollection;
6728
6729 type Request = crate::wire::NodeAttachNodeTrackingRequest<'static>;
6730 }
6731
6732 pub struct SetConstraints;
6733
6734 impl ::fidl_next::Method for SetConstraints {
6735 const ORDINAL: u64 = 2296289463649704315;
6736 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6737 ::fidl_next::protocol::Flexibility::Flexible;
6738
6739 type Protocol = crate::BufferCollection;
6740
6741 type Request = crate::wire::BufferCollectionSetConstraintsRequest<'static>;
6742 }
6743
6744 pub struct WaitForAllBuffersAllocated;
6745
6746 impl ::fidl_next::Method for WaitForAllBuffersAllocated {
6747 const ORDINAL: u64 = 442197413015404622;
6748 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6749 ::fidl_next::protocol::Flexibility::Flexible;
6750
6751 type Protocol = crate::BufferCollection;
6752
6753 type Request = ::fidl_next::wire::EmptyMessageBody;
6754 }
6755
6756 impl ::fidl_next::TwoWayMethod for WaitForAllBuffersAllocated {
6757 type Response = ::fidl_next::wire::FlexibleResult<
6758 'static,
6759 crate::wire::BufferCollectionWaitForAllBuffersAllocatedResponse<'static>,
6760 crate::wire::Error,
6761 >;
6762 }
6763
6764 impl<___R> ::fidl_next::Respond<___R> for WaitForAllBuffersAllocated {
6765 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
6766
6767 fn respond(response: ___R) -> Self::Output {
6768 ::fidl_next::FlexibleResult::Ok(response)
6769 }
6770 }
6771
6772 impl<___R> ::fidl_next::RespondErr<___R> for WaitForAllBuffersAllocated {
6773 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
6774
6775 fn respond_err(response: ___R) -> Self::Output {
6776 ::fidl_next::FlexibleResult::Err(response)
6777 }
6778 }
6779
6780 pub struct CheckAllBuffersAllocated;
6781
6782 impl ::fidl_next::Method for CheckAllBuffersAllocated {
6783 const ORDINAL: u64 = 3865775645687782416;
6784 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6785 ::fidl_next::protocol::Flexibility::Flexible;
6786
6787 type Protocol = crate::BufferCollection;
6788
6789 type Request = ::fidl_next::wire::EmptyMessageBody;
6790 }
6791
6792 impl ::fidl_next::TwoWayMethod for CheckAllBuffersAllocated {
6793 type Response = ::fidl_next::wire::FlexibleResult<
6794 'static,
6795 crate::wire::BufferCollectionCheckAllBuffersAllocatedResponse,
6796 crate::wire::Error,
6797 >;
6798 }
6799
6800 impl<___R> ::fidl_next::Respond<___R> for CheckAllBuffersAllocated {
6801 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
6802
6803 fn respond(response: ___R) -> Self::Output {
6804 ::fidl_next::FlexibleResult::Ok(response)
6805 }
6806 }
6807
6808 impl<___R> ::fidl_next::RespondErr<___R> for CheckAllBuffersAllocated {
6809 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
6810
6811 fn respond_err(response: ___R) -> Self::Output {
6812 ::fidl_next::FlexibleResult::Err(response)
6813 }
6814 }
6815
6816 pub struct AttachToken;
6817
6818 impl ::fidl_next::Method for AttachToken {
6819 const ORDINAL: u64 = 5092582717741672834;
6820 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6821 ::fidl_next::protocol::Flexibility::Flexible;
6822
6823 type Protocol = crate::BufferCollection;
6824
6825 type Request = crate::wire::BufferCollectionAttachTokenRequest<'static>;
6826 }
6827
6828 pub struct AttachLifetimeTracking;
6829
6830 impl ::fidl_next::Method for AttachLifetimeTracking {
6831 const ORDINAL: u64 = 4524799315680521679;
6832 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
6833 ::fidl_next::protocol::Flexibility::Flexible;
6834
6835 type Protocol = crate::BufferCollection;
6836
6837 type Request = crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'static>;
6838 }
6839
6840 mod ___detail {
6841 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::BufferCollection
6842 where
6843 ___T: ::fidl_next::Transport,
6844 {
6845 type Client = BufferCollectionClient<___T>;
6846 type Server = BufferCollectionServer<___T>;
6847 }
6848
6849 #[repr(transparent)]
6851 pub struct BufferCollectionClient<___T: ::fidl_next::Transport> {
6852 #[allow(dead_code)]
6853 client: ::fidl_next::protocol::Client<___T>,
6854 }
6855
6856 impl<___T> BufferCollectionClient<___T>
6857 where
6858 ___T: ::fidl_next::Transport,
6859 {
6860 #[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"]
6861 pub fn sync(&self) -> ::fidl_next::TwoWayFuture<'_, super::Sync, ___T> {
6862 ::fidl_next::TwoWayFuture::from_untyped(
6863 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
6864 1273433845120064340,
6865 <super::Sync as ::fidl_next::Method>::FLEXIBILITY,
6866 (),
6867 ),
6868 )
6869 }
6870
6871 #[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"]
6872 pub fn release(&self) -> ::fidl_next::SendFuture<'_, ___T> {
6873 ::fidl_next::SendFuture::from_untyped(
6874 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
6875 7664192519607813318,
6876 <super::Release as ::fidl_next::Method>::FLEXIBILITY,
6877 (),
6878 ),
6879 )
6880 }
6881
6882 #[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"]
6883 pub fn set_name_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
6884 where
6885 ___R: ::fidl_next::Encode<
6886 crate::wire::NodeSetNameRequest<'static>,
6887 <___T as ::fidl_next::Transport>::SendBuffer,
6888 >,
6889 {
6890 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
6891 811194812442657257,
6892 <super::SetName as ::fidl_next::Method>::FLEXIBILITY,
6893 request,
6894 ))
6895 }
6896
6897 #[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"]
6898 pub fn set_debug_client_info_with<___R>(
6899 &self,
6900 request: ___R,
6901 ) -> ::fidl_next::SendFuture<'_, ___T>
6902 where
6903 ___R: ::fidl_next::Encode<
6904 crate::wire::NodeSetDebugClientInfoRequest<'static>,
6905 <___T as ::fidl_next::Transport>::SendBuffer,
6906 >,
6907 {
6908 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
6909 6691936816931379633,
6910 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
6911 request,
6912 ))
6913 }
6914
6915 #[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"]
6916 pub fn set_debug_timeout_log_deadline_with<___R>(
6917 &self,
6918 request: ___R,
6919 ) -> ::fidl_next::SendFuture<'_, ___T>
6920 where
6921 ___R: ::fidl_next::Encode<
6922 crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>,
6923 <___T as ::fidl_next::Transport>::SendBuffer,
6924 >,
6925 {
6926 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
6927 8172637980026734598,
6928 <super::SetDebugTimeoutLogDeadline as ::fidl_next::Method>::FLEXIBILITY,
6929 request,
6930 ))
6931 }
6932
6933 #[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"]
6934 pub fn set_verbose_logging(&self) -> ::fidl_next::SendFuture<'_, ___T> {
6935 ::fidl_next::SendFuture::from_untyped(
6936 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
6937 5911475287294795693,
6938 <super::SetVerboseLogging as ::fidl_next::Method>::FLEXIBILITY,
6939 (),
6940 ),
6941 )
6942 }
6943
6944 #[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"]
6945 pub fn get_node_ref(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetNodeRef, ___T> {
6946 ::fidl_next::TwoWayFuture::from_untyped(
6947 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
6948 6574426773718429779,
6949 <super::GetNodeRef as ::fidl_next::Method>::FLEXIBILITY,
6950 (),
6951 ),
6952 )
6953 }
6954
6955 #[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"]
6956 pub fn is_alternate_for_with<___R>(
6957 &self,
6958 request: ___R,
6959 ) -> ::fidl_next::TwoWayFuture<'_, super::IsAlternateFor, ___T>
6960 where
6961 ___R: ::fidl_next::Encode<
6962 crate::wire::NodeIsAlternateForRequest<'static>,
6963 <___T as ::fidl_next::Transport>::SendBuffer,
6964 >,
6965 {
6966 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
6967 262772284282767397,
6968 <super::IsAlternateFor as ::fidl_next::Method>::FLEXIBILITY,
6969 request,
6970 ))
6971 }
6972
6973 #[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"]
6974 pub fn get_buffer_collection_id(
6975 &self,
6976 ) -> ::fidl_next::TwoWayFuture<'_, super::GetBufferCollectionId, ___T> {
6977 ::fidl_next::TwoWayFuture::from_untyped(
6978 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
6979 8633851600235444876,
6980 <super::GetBufferCollectionId as ::fidl_next::Method>::FLEXIBILITY,
6981 (),
6982 ),
6983 )
6984 }
6985
6986 #[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"]
6987 pub fn set_weak(&self) -> ::fidl_next::SendFuture<'_, ___T> {
6988 ::fidl_next::SendFuture::from_untyped(
6989 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
6990 2512233045884338145,
6991 <super::SetWeak as ::fidl_next::Method>::FLEXIBILITY,
6992 (),
6993 ),
6994 )
6995 }
6996
6997 #[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"]
6998 pub fn set_weak_ok_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
6999 where
7000 ___R: ::fidl_next::Encode<
7001 crate::wire::NodeSetWeakOkRequest<'static>,
7002 <___T as ::fidl_next::Transport>::SendBuffer,
7003 >,
7004 {
7005 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7006 4081474869151288297,
7007 <super::SetWeakOk as ::fidl_next::Method>::FLEXIBILITY,
7008 request,
7009 ))
7010 }
7011
7012 #[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"]
7013 pub fn attach_node_tracking_with<___R>(
7014 &self,
7015 request: ___R,
7016 ) -> ::fidl_next::SendFuture<'_, ___T>
7017 where
7018 ___R: ::fidl_next::Encode<
7019 crate::wire::NodeAttachNodeTrackingRequest<'static>,
7020 <___T as ::fidl_next::Transport>::SendBuffer,
7021 >,
7022 {
7023 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7024 4549465353676377516,
7025 <super::AttachNodeTracking as ::fidl_next::Method>::FLEXIBILITY,
7026 request,
7027 ))
7028 }
7029
7030 #[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\n + request `constraints` These are the constraints on the buffer\n collection imposed by the sending client/participant. The\n `constraints` field is not required to be set. If not set, the client\n is not setting any actual constraints, but is indicating that the\n client has no constraints to set. A client that doesn\'t set the\n `constraints` field won\'t receive any VMO handles, but can still find\n out how many buffers were allocated and can still refer to buffers by\n their `buffer_index`.\n"]
7031 pub fn set_constraints_with<___R>(
7032 &self,
7033 request: ___R,
7034 ) -> ::fidl_next::SendFuture<'_, ___T>
7035 where
7036 ___R: ::fidl_next::Encode<
7037 crate::wire::BufferCollectionSetConstraintsRequest<'static>,
7038 <___T as ::fidl_next::Transport>::SendBuffer,
7039 >,
7040 {
7041 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7042 2296289463649704315,
7043 <super::SetConstraints as ::fidl_next::Method>::FLEXIBILITY,
7044 request,
7045 ))
7046 }
7047
7048 #[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"]
7049 pub fn wait_for_all_buffers_allocated(
7050 &self,
7051 ) -> ::fidl_next::TwoWayFuture<'_, super::WaitForAllBuffersAllocated, ___T>
7052 {
7053 ::fidl_next::TwoWayFuture::from_untyped(
7054 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7055 442197413015404622,
7056 <super::WaitForAllBuffersAllocated as ::fidl_next::Method>::FLEXIBILITY,
7057 (),
7058 ),
7059 )
7060 }
7061
7062 #[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"]
7063 pub fn check_all_buffers_allocated(
7064 &self,
7065 ) -> ::fidl_next::TwoWayFuture<'_, super::CheckAllBuffersAllocated, ___T> {
7066 ::fidl_next::TwoWayFuture::from_untyped(
7067 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
7068 3865775645687782416,
7069 <super::CheckAllBuffersAllocated as ::fidl_next::Method>::FLEXIBILITY,
7070 (),
7071 ),
7072 )
7073 }
7074
7075 #[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"]
7076 pub fn attach_token_with<___R>(
7077 &self,
7078 request: ___R,
7079 ) -> ::fidl_next::SendFuture<'_, ___T>
7080 where
7081 ___R: ::fidl_next::Encode<
7082 crate::wire::BufferCollectionAttachTokenRequest<'static>,
7083 <___T as ::fidl_next::Transport>::SendBuffer,
7084 >,
7085 {
7086 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7087 5092582717741672834,
7088 <super::AttachToken as ::fidl_next::Method>::FLEXIBILITY,
7089 request,
7090 ))
7091 }
7092
7093 #[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"]
7094 pub fn attach_lifetime_tracking_with<___R>(
7095 &self,
7096 request: ___R,
7097 ) -> ::fidl_next::SendFuture<'_, ___T>
7098 where
7099 ___R: ::fidl_next::Encode<
7100 crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'static>,
7101 <___T as ::fidl_next::Transport>::SendBuffer,
7102 >,
7103 {
7104 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
7105 4524799315680521679,
7106 <super::AttachLifetimeTracking as ::fidl_next::Method>::FLEXIBILITY,
7107 request,
7108 ))
7109 }
7110 }
7111
7112 #[repr(transparent)]
7114 pub struct BufferCollectionServer<___T: ::fidl_next::Transport> {
7115 server: ::fidl_next::protocol::Server<___T>,
7116 }
7117
7118 impl<___T> BufferCollectionServer<___T> where ___T: ::fidl_next::Transport {}
7119 }
7120}
7121
7122#[diagnostic::on_unimplemented(
7123 note = "If {Self} implements the non-local BufferCollectionClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
7124)]
7125
7126pub trait BufferCollectionLocalClientHandler<
7130 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7131 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7132>
7133{
7134 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
7135 ::core::future::ready(())
7136 }
7137}
7138
7139impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for BufferCollection
7140where
7141 ___H: BufferCollectionLocalClientHandler<___T>,
7142 ___T: ::fidl_next::Transport,
7143{
7144 async fn on_event(
7145 handler: &mut ___H,
7146 ordinal: u64,
7147 flexibility: ::fidl_next::protocol::Flexibility,
7148 body: ::fidl_next::Body<___T>,
7149 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
7150 match ordinal {
7151 ordinal => {
7152 handler.on_unknown_interaction(ordinal).await;
7153 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
7154 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7155 } else {
7156 Ok(())
7157 }
7158 }
7159 }
7160 }
7161}
7162
7163#[diagnostic::on_unimplemented(
7164 note = "If {Self} implements the non-local BufferCollectionServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
7165)]
7166
7167pub trait BufferCollectionLocalServerHandler<
7171 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7172 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7173>
7174{
7175 #[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"]
7176 fn sync(
7177 &mut self,
7178
7179 responder: ::fidl_next::Responder<buffer_collection::Sync, ___T>,
7180 ) -> impl ::core::future::Future<Output = ()>;
7181
7182 #[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"]
7183 fn release(&mut self) -> impl ::core::future::Future<Output = ()>;
7184
7185 #[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"]
7186 fn set_name(
7187 &mut self,
7188
7189 request: ::fidl_next::Request<buffer_collection::SetName, ___T>,
7190 ) -> impl ::core::future::Future<Output = ()>;
7191
7192 #[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"]
7193 fn set_debug_client_info(
7194 &mut self,
7195
7196 request: ::fidl_next::Request<buffer_collection::SetDebugClientInfo, ___T>,
7197 ) -> impl ::core::future::Future<Output = ()>;
7198
7199 #[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"]
7200 fn set_debug_timeout_log_deadline(
7201 &mut self,
7202
7203 request: ::fidl_next::Request<buffer_collection::SetDebugTimeoutLogDeadline, ___T>,
7204 ) -> impl ::core::future::Future<Output = ()>;
7205
7206 #[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"]
7207 fn set_verbose_logging(&mut self) -> impl ::core::future::Future<Output = ()>;
7208
7209 #[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"]
7210 fn get_node_ref(
7211 &mut self,
7212
7213 responder: ::fidl_next::Responder<buffer_collection::GetNodeRef, ___T>,
7214 ) -> impl ::core::future::Future<Output = ()>;
7215
7216 #[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"]
7217 fn is_alternate_for(
7218 &mut self,
7219
7220 request: ::fidl_next::Request<buffer_collection::IsAlternateFor, ___T>,
7221
7222 responder: ::fidl_next::Responder<buffer_collection::IsAlternateFor, ___T>,
7223 ) -> impl ::core::future::Future<Output = ()>;
7224
7225 #[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"]
7226 fn get_buffer_collection_id(
7227 &mut self,
7228
7229 responder: ::fidl_next::Responder<buffer_collection::GetBufferCollectionId, ___T>,
7230 ) -> impl ::core::future::Future<Output = ()>;
7231
7232 #[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"]
7233 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()>;
7234
7235 #[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"]
7236 fn set_weak_ok(
7237 &mut self,
7238
7239 request: ::fidl_next::Request<buffer_collection::SetWeakOk, ___T>,
7240 ) -> impl ::core::future::Future<Output = ()>;
7241
7242 #[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"]
7243 fn attach_node_tracking(
7244 &mut self,
7245
7246 request: ::fidl_next::Request<buffer_collection::AttachNodeTracking, ___T>,
7247 ) -> impl ::core::future::Future<Output = ()>;
7248
7249 #[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\n + request `constraints` These are the constraints on the buffer\n collection imposed by the sending client/participant. The\n `constraints` field is not required to be set. If not set, the client\n is not setting any actual constraints, but is indicating that the\n client has no constraints to set. A client that doesn\'t set the\n `constraints` field won\'t receive any VMO handles, but can still find\n out how many buffers were allocated and can still refer to buffers by\n their `buffer_index`.\n"]
7250 fn set_constraints(
7251 &mut self,
7252
7253 request: ::fidl_next::Request<buffer_collection::SetConstraints, ___T>,
7254 ) -> impl ::core::future::Future<Output = ()>;
7255
7256 #[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"]
7257 fn wait_for_all_buffers_allocated(
7258 &mut self,
7259
7260 responder: ::fidl_next::Responder<buffer_collection::WaitForAllBuffersAllocated, ___T>,
7261 ) -> impl ::core::future::Future<Output = ()>;
7262
7263 #[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"]
7264 fn check_all_buffers_allocated(
7265 &mut self,
7266
7267 responder: ::fidl_next::Responder<buffer_collection::CheckAllBuffersAllocated, ___T>,
7268 ) -> impl ::core::future::Future<Output = ()>;
7269
7270 #[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"]
7271 fn attach_token(
7272 &mut self,
7273
7274 request: ::fidl_next::Request<buffer_collection::AttachToken, ___T>,
7275 ) -> impl ::core::future::Future<Output = ()>;
7276
7277 #[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"]
7278 fn attach_lifetime_tracking(
7279 &mut self,
7280
7281 request: ::fidl_next::Request<buffer_collection::AttachLifetimeTracking, ___T>,
7282 ) -> impl ::core::future::Future<Output = ()>;
7283
7284 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
7285 ::core::future::ready(())
7286 }
7287}
7288
7289impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for BufferCollection
7290where
7291 ___H: BufferCollectionLocalServerHandler<___T>,
7292 ___T: ::fidl_next::Transport,
7293 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
7294 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7295 Constraint = (),
7296 >,
7297 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
7298 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7299 Constraint = (),
7300 >,
7301 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
7302 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7303 Constraint = (),
7304 >,
7305 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
7306 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7307 Constraint = (),
7308 >,
7309 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
7310 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7311 Constraint = (),
7312 >,
7313 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
7314 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7315 Constraint = (),
7316 >,
7317 for<'de> crate::wire::BufferCollectionSetConstraintsRequest<'de>: ::fidl_next::Decode<
7318 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7319 Constraint = (),
7320 >,
7321 for<'de> crate::wire::BufferCollectionAttachTokenRequest<'de>: ::fidl_next::Decode<
7322 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7323 Constraint = (),
7324 >,
7325 for<'de> crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'de>: ::fidl_next::Decode<
7326 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7327 Constraint = (),
7328 >,
7329{
7330 async fn on_one_way(
7331 handler: &mut ___H,
7332 ordinal: u64,
7333 flexibility: ::fidl_next::protocol::Flexibility,
7334 body: ::fidl_next::Body<___T>,
7335 ) -> ::core::result::Result<
7336 (),
7337 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7338 > {
7339 match ordinal {
7340 7664192519607813318 => {
7341 handler.release().await;
7342 Ok(())
7343 }
7344
7345 811194812442657257 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7346 Ok(decoded) => {
7347 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
7348 Ok(())
7349 }
7350 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7351 ordinal: 811194812442657257,
7352 error,
7353 }),
7354 },
7355
7356 6691936816931379633 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7357 Ok(decoded) => {
7358 handler
7359 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
7360 .await;
7361 Ok(())
7362 }
7363 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7364 ordinal: 6691936816931379633,
7365 error,
7366 }),
7367 },
7368
7369 8172637980026734598 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7370 Ok(decoded) => {
7371 handler
7372 .set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded))
7373 .await;
7374 Ok(())
7375 }
7376 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7377 ordinal: 8172637980026734598,
7378 error,
7379 }),
7380 },
7381
7382 5911475287294795693 => {
7383 handler.set_verbose_logging().await;
7384 Ok(())
7385 }
7386
7387 2512233045884338145 => {
7388 handler.set_weak().await;
7389 Ok(())
7390 }
7391
7392 4081474869151288297 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7393 Ok(decoded) => {
7394 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
7395 Ok(())
7396 }
7397 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7398 ordinal: 4081474869151288297,
7399 error,
7400 }),
7401 },
7402
7403 4549465353676377516 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7404 Ok(decoded) => {
7405 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
7406 Ok(())
7407 }
7408 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7409 ordinal: 4549465353676377516,
7410 error,
7411 }),
7412 },
7413
7414 2296289463649704315 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7415 Ok(decoded) => {
7416 handler.set_constraints(::fidl_next::Request::from_decoded(decoded)).await;
7417 Ok(())
7418 }
7419 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7420 ordinal: 2296289463649704315,
7421 error,
7422 }),
7423 },
7424
7425 5092582717741672834 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7426 Ok(decoded) => {
7427 handler.attach_token(::fidl_next::Request::from_decoded(decoded)).await;
7428 Ok(())
7429 }
7430 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7431 ordinal: 5092582717741672834,
7432 error,
7433 }),
7434 },
7435
7436 4524799315680521679 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7437 Ok(decoded) => {
7438 handler
7439 .attach_lifetime_tracking(::fidl_next::Request::from_decoded(decoded))
7440 .await;
7441 Ok(())
7442 }
7443 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7444 ordinal: 4524799315680521679,
7445 error,
7446 }),
7447 },
7448
7449 ordinal => {
7450 handler.on_unknown_interaction(ordinal).await;
7451 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
7452 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7453 } else {
7454 Ok(())
7455 }
7456 }
7457 }
7458 }
7459
7460 async fn on_two_way(
7461 handler: &mut ___H,
7462 ordinal: u64,
7463 flexibility: ::fidl_next::protocol::Flexibility,
7464 body: ::fidl_next::Body<___T>,
7465 responder: ::fidl_next::protocol::Responder<___T>,
7466 ) -> ::core::result::Result<
7467 (),
7468 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7469 > {
7470 match ordinal {
7471 1273433845120064340 => {
7472 let responder = ::fidl_next::Responder::from_untyped(responder);
7473
7474 handler.sync(responder).await;
7475 Ok(())
7476 }
7477
7478 6574426773718429779 => {
7479 let responder = ::fidl_next::Responder::from_untyped(responder);
7480
7481 handler.get_node_ref(responder).await;
7482 Ok(())
7483 }
7484
7485 262772284282767397 => {
7486 let responder = ::fidl_next::Responder::from_untyped(responder);
7487
7488 match ::fidl_next::AsDecoderExt::into_decoded(body) {
7489 Ok(decoded) => {
7490 handler
7491 .is_alternate_for(
7492 ::fidl_next::Request::from_decoded(decoded),
7493 responder,
7494 )
7495 .await;
7496 Ok(())
7497 }
7498 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7499 ordinal: 262772284282767397,
7500 error,
7501 }),
7502 }
7503 }
7504
7505 8633851600235444876 => {
7506 let responder = ::fidl_next::Responder::from_untyped(responder);
7507
7508 handler.get_buffer_collection_id(responder).await;
7509 Ok(())
7510 }
7511
7512 442197413015404622 => {
7513 let responder = ::fidl_next::Responder::from_untyped(responder);
7514
7515 handler.wait_for_all_buffers_allocated(responder).await;
7516 Ok(())
7517 }
7518
7519 3865775645687782416 => {
7520 let responder = ::fidl_next::Responder::from_untyped(responder);
7521
7522 handler.check_all_buffers_allocated(responder).await;
7523 Ok(())
7524 }
7525
7526 ordinal => {
7527 handler.on_unknown_interaction(ordinal).await;
7528 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
7529 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7530 } else {
7531 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
7532 ordinal,
7533 flexibility,
7534 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
7535 )
7536 .expect("encoding a framework error should never fail")
7537 .await?;
7538 Ok(())
7539 }
7540 }
7541 }
7542 }
7543}
7544
7545pub trait BufferCollectionClientHandler<
7549 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7550 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7551>
7552{
7553 fn on_unknown_interaction(
7554 &mut self,
7555 ordinal: u64,
7556 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
7557 ::core::future::ready(())
7558 }
7559}
7560
7561impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for BufferCollection
7562where
7563 ___H: BufferCollectionClientHandler<___T> + ::core::marker::Send,
7564 ___T: ::fidl_next::Transport,
7565{
7566 async fn on_event(
7567 handler: &mut ___H,
7568 ordinal: u64,
7569 flexibility: ::fidl_next::protocol::Flexibility,
7570 body: ::fidl_next::Body<___T>,
7571 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
7572 match ordinal {
7573 ordinal => {
7574 handler.on_unknown_interaction(ordinal).await;
7575 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
7576 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7577 } else {
7578 Ok(())
7579 }
7580 }
7581 }
7582 }
7583}
7584
7585pub trait BufferCollectionServerHandler<
7589 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
7590 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
7591>
7592{
7593 #[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"]
7594 fn sync(
7595 &mut self,
7596
7597 responder: ::fidl_next::Responder<buffer_collection::Sync, ___T>,
7598 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7599
7600 #[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"]
7601 fn release(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7602
7603 #[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"]
7604 fn set_name(
7605 &mut self,
7606
7607 request: ::fidl_next::Request<buffer_collection::SetName, ___T>,
7608 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7609
7610 #[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"]
7611 fn set_debug_client_info(
7612 &mut self,
7613
7614 request: ::fidl_next::Request<buffer_collection::SetDebugClientInfo, ___T>,
7615 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7616
7617 #[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"]
7618 fn set_debug_timeout_log_deadline(
7619 &mut self,
7620
7621 request: ::fidl_next::Request<buffer_collection::SetDebugTimeoutLogDeadline, ___T>,
7622 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7623
7624 #[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"]
7625 fn set_verbose_logging(
7626 &mut self,
7627 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7628
7629 #[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"]
7630 fn get_node_ref(
7631 &mut self,
7632
7633 responder: ::fidl_next::Responder<buffer_collection::GetNodeRef, ___T>,
7634 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7635
7636 #[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"]
7637 fn is_alternate_for(
7638 &mut self,
7639
7640 request: ::fidl_next::Request<buffer_collection::IsAlternateFor, ___T>,
7641
7642 responder: ::fidl_next::Responder<buffer_collection::IsAlternateFor, ___T>,
7643 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7644
7645 #[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"]
7646 fn get_buffer_collection_id(
7647 &mut self,
7648
7649 responder: ::fidl_next::Responder<buffer_collection::GetBufferCollectionId, ___T>,
7650 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7651
7652 #[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"]
7653 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7654
7655 #[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"]
7656 fn set_weak_ok(
7657 &mut self,
7658
7659 request: ::fidl_next::Request<buffer_collection::SetWeakOk, ___T>,
7660 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7661
7662 #[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"]
7663 fn attach_node_tracking(
7664 &mut self,
7665
7666 request: ::fidl_next::Request<buffer_collection::AttachNodeTracking, ___T>,
7667 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7668
7669 #[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\n + request `constraints` These are the constraints on the buffer\n collection imposed by the sending client/participant. The\n `constraints` field is not required to be set. If not set, the client\n is not setting any actual constraints, but is indicating that the\n client has no constraints to set. A client that doesn\'t set the\n `constraints` field won\'t receive any VMO handles, but can still find\n out how many buffers were allocated and can still refer to buffers by\n their `buffer_index`.\n"]
7670 fn set_constraints(
7671 &mut self,
7672
7673 request: ::fidl_next::Request<buffer_collection::SetConstraints, ___T>,
7674 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7675
7676 #[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"]
7677 fn wait_for_all_buffers_allocated(
7678 &mut self,
7679
7680 responder: ::fidl_next::Responder<buffer_collection::WaitForAllBuffersAllocated, ___T>,
7681 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7682
7683 #[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"]
7684 fn check_all_buffers_allocated(
7685 &mut self,
7686
7687 responder: ::fidl_next::Responder<buffer_collection::CheckAllBuffersAllocated, ___T>,
7688 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7689
7690 #[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"]
7691 fn attach_token(
7692 &mut self,
7693
7694 request: ::fidl_next::Request<buffer_collection::AttachToken, ___T>,
7695 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7696
7697 #[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"]
7698 fn attach_lifetime_tracking(
7699 &mut self,
7700
7701 request: ::fidl_next::Request<buffer_collection::AttachLifetimeTracking, ___T>,
7702 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
7703
7704 fn on_unknown_interaction(
7705 &mut self,
7706 ordinal: u64,
7707 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
7708 ::core::future::ready(())
7709 }
7710}
7711
7712impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for BufferCollection
7713where
7714 ___H: BufferCollectionServerHandler<___T> + ::core::marker::Send,
7715 ___T: ::fidl_next::Transport,
7716 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
7717 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7718 Constraint = (),
7719 >,
7720 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
7721 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7722 Constraint = (),
7723 >,
7724 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
7725 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7726 Constraint = (),
7727 >,
7728 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
7729 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7730 Constraint = (),
7731 >,
7732 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
7733 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7734 Constraint = (),
7735 >,
7736 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
7737 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7738 Constraint = (),
7739 >,
7740 for<'de> crate::wire::BufferCollectionSetConstraintsRequest<'de>: ::fidl_next::Decode<
7741 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7742 Constraint = (),
7743 >,
7744 for<'de> crate::wire::BufferCollectionAttachTokenRequest<'de>: ::fidl_next::Decode<
7745 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7746 Constraint = (),
7747 >,
7748 for<'de> crate::wire::BufferCollectionAttachLifetimeTrackingRequest<'de>: ::fidl_next::Decode<
7749 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
7750 Constraint = (),
7751 >,
7752{
7753 async fn on_one_way(
7754 handler: &mut ___H,
7755 ordinal: u64,
7756 flexibility: ::fidl_next::protocol::Flexibility,
7757 body: ::fidl_next::Body<___T>,
7758 ) -> ::core::result::Result<
7759 (),
7760 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7761 > {
7762 match ordinal {
7763 7664192519607813318 => {
7764 handler.release().await;
7765 Ok(())
7766 }
7767
7768 811194812442657257 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7769 Ok(decoded) => {
7770 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
7771 Ok(())
7772 }
7773 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7774 ordinal: 811194812442657257,
7775 error,
7776 }),
7777 },
7778
7779 6691936816931379633 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7780 Ok(decoded) => {
7781 handler
7782 .set_debug_client_info(::fidl_next::Request::from_decoded(decoded))
7783 .await;
7784 Ok(())
7785 }
7786 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7787 ordinal: 6691936816931379633,
7788 error,
7789 }),
7790 },
7791
7792 8172637980026734598 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7793 Ok(decoded) => {
7794 handler
7795 .set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded))
7796 .await;
7797 Ok(())
7798 }
7799 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7800 ordinal: 8172637980026734598,
7801 error,
7802 }),
7803 },
7804
7805 5911475287294795693 => {
7806 handler.set_verbose_logging().await;
7807 Ok(())
7808 }
7809
7810 2512233045884338145 => {
7811 handler.set_weak().await;
7812 Ok(())
7813 }
7814
7815 4081474869151288297 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7816 Ok(decoded) => {
7817 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
7818 Ok(())
7819 }
7820 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7821 ordinal: 4081474869151288297,
7822 error,
7823 }),
7824 },
7825
7826 4549465353676377516 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7827 Ok(decoded) => {
7828 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
7829 Ok(())
7830 }
7831 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7832 ordinal: 4549465353676377516,
7833 error,
7834 }),
7835 },
7836
7837 2296289463649704315 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7838 Ok(decoded) => {
7839 handler.set_constraints(::fidl_next::Request::from_decoded(decoded)).await;
7840 Ok(())
7841 }
7842 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7843 ordinal: 2296289463649704315,
7844 error,
7845 }),
7846 },
7847
7848 5092582717741672834 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7849 Ok(decoded) => {
7850 handler.attach_token(::fidl_next::Request::from_decoded(decoded)).await;
7851 Ok(())
7852 }
7853 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7854 ordinal: 5092582717741672834,
7855 error,
7856 }),
7857 },
7858
7859 4524799315680521679 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
7860 Ok(decoded) => {
7861 handler
7862 .attach_lifetime_tracking(::fidl_next::Request::from_decoded(decoded))
7863 .await;
7864 Ok(())
7865 }
7866 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7867 ordinal: 4524799315680521679,
7868 error,
7869 }),
7870 },
7871
7872 ordinal => {
7873 handler.on_unknown_interaction(ordinal).await;
7874 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
7875 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7876 } else {
7877 Ok(())
7878 }
7879 }
7880 }
7881 }
7882
7883 async fn on_two_way(
7884 handler: &mut ___H,
7885 ordinal: u64,
7886 flexibility: ::fidl_next::protocol::Flexibility,
7887 body: ::fidl_next::Body<___T>,
7888 responder: ::fidl_next::protocol::Responder<___T>,
7889 ) -> ::core::result::Result<
7890 (),
7891 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
7892 > {
7893 match ordinal {
7894 1273433845120064340 => {
7895 let responder = ::fidl_next::Responder::from_untyped(responder);
7896
7897 handler.sync(responder).await;
7898 Ok(())
7899 }
7900
7901 6574426773718429779 => {
7902 let responder = ::fidl_next::Responder::from_untyped(responder);
7903
7904 handler.get_node_ref(responder).await;
7905 Ok(())
7906 }
7907
7908 262772284282767397 => {
7909 let responder = ::fidl_next::Responder::from_untyped(responder);
7910
7911 match ::fidl_next::AsDecoderExt::into_decoded(body) {
7912 Ok(decoded) => {
7913 handler
7914 .is_alternate_for(
7915 ::fidl_next::Request::from_decoded(decoded),
7916 responder,
7917 )
7918 .await;
7919 Ok(())
7920 }
7921 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
7922 ordinal: 262772284282767397,
7923 error,
7924 }),
7925 }
7926 }
7927
7928 8633851600235444876 => {
7929 let responder = ::fidl_next::Responder::from_untyped(responder);
7930
7931 handler.get_buffer_collection_id(responder).await;
7932 Ok(())
7933 }
7934
7935 442197413015404622 => {
7936 let responder = ::fidl_next::Responder::from_untyped(responder);
7937
7938 handler.wait_for_all_buffers_allocated(responder).await;
7939 Ok(())
7940 }
7941
7942 3865775645687782416 => {
7943 let responder = ::fidl_next::Responder::from_untyped(responder);
7944
7945 handler.check_all_buffers_allocated(responder).await;
7946 Ok(())
7947 }
7948
7949 ordinal => {
7950 handler.on_unknown_interaction(ordinal).await;
7951 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
7952 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
7953 } else {
7954 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
7955 ordinal,
7956 flexibility,
7957 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
7958 )
7959 .expect("encoding a framework error should never fail")
7960 .await?;
7961 Ok(())
7962 }
7963 }
7964 }
7965 }
7966}
7967
7968impl<___T> BufferCollectionClientHandler<___T> for ::fidl_next::IgnoreEvents
7969where
7970 ___T: ::fidl_next::Transport,
7971{
7972 async fn on_unknown_interaction(&mut self, _: u64) {}
7973}
7974
7975impl<___H, ___T> BufferCollectionLocalClientHandler<___T> for ::fidl_next::Local<___H>
7976where
7977 ___H: BufferCollectionClientHandler<___T>,
7978 ___T: ::fidl_next::Transport,
7979{
7980 async fn on_unknown_interaction(&mut self, ordinal: u64) {
7981 ___H::on_unknown_interaction(&mut self.0, ordinal).await
7982 }
7983}
7984
7985impl<___H, ___T> BufferCollectionLocalServerHandler<___T> for ::fidl_next::Local<___H>
7986where
7987 ___H: BufferCollectionServerHandler<___T>,
7988 ___T: ::fidl_next::Transport,
7989{
7990 async fn sync(&mut self, responder: ::fidl_next::Responder<buffer_collection::Sync, ___T>) {
7991 ___H::sync(&mut self.0, responder).await
7992 }
7993
7994 async fn release(&mut self) {
7995 ___H::release(&mut self.0).await
7996 }
7997
7998 async fn set_name(&mut self, request: ::fidl_next::Request<buffer_collection::SetName, ___T>) {
7999 ___H::set_name(&mut self.0, request).await
8000 }
8001
8002 async fn set_debug_client_info(
8003 &mut self,
8004
8005 request: ::fidl_next::Request<buffer_collection::SetDebugClientInfo, ___T>,
8006 ) {
8007 ___H::set_debug_client_info(&mut self.0, request).await
8008 }
8009
8010 async fn set_debug_timeout_log_deadline(
8011 &mut self,
8012
8013 request: ::fidl_next::Request<buffer_collection::SetDebugTimeoutLogDeadline, ___T>,
8014 ) {
8015 ___H::set_debug_timeout_log_deadline(&mut self.0, request).await
8016 }
8017
8018 async fn set_verbose_logging(&mut self) {
8019 ___H::set_verbose_logging(&mut self.0).await
8020 }
8021
8022 async fn get_node_ref(
8023 &mut self,
8024
8025 responder: ::fidl_next::Responder<buffer_collection::GetNodeRef, ___T>,
8026 ) {
8027 ___H::get_node_ref(&mut self.0, responder).await
8028 }
8029
8030 async fn is_alternate_for(
8031 &mut self,
8032
8033 request: ::fidl_next::Request<buffer_collection::IsAlternateFor, ___T>,
8034
8035 responder: ::fidl_next::Responder<buffer_collection::IsAlternateFor, ___T>,
8036 ) {
8037 ___H::is_alternate_for(&mut self.0, request, responder).await
8038 }
8039
8040 async fn get_buffer_collection_id(
8041 &mut self,
8042
8043 responder: ::fidl_next::Responder<buffer_collection::GetBufferCollectionId, ___T>,
8044 ) {
8045 ___H::get_buffer_collection_id(&mut self.0, responder).await
8046 }
8047
8048 async fn set_weak(&mut self) {
8049 ___H::set_weak(&mut self.0).await
8050 }
8051
8052 async fn set_weak_ok(
8053 &mut self,
8054
8055 request: ::fidl_next::Request<buffer_collection::SetWeakOk, ___T>,
8056 ) {
8057 ___H::set_weak_ok(&mut self.0, request).await
8058 }
8059
8060 async fn attach_node_tracking(
8061 &mut self,
8062
8063 request: ::fidl_next::Request<buffer_collection::AttachNodeTracking, ___T>,
8064 ) {
8065 ___H::attach_node_tracking(&mut self.0, request).await
8066 }
8067
8068 async fn set_constraints(
8069 &mut self,
8070
8071 request: ::fidl_next::Request<buffer_collection::SetConstraints, ___T>,
8072 ) {
8073 ___H::set_constraints(&mut self.0, request).await
8074 }
8075
8076 async fn wait_for_all_buffers_allocated(
8077 &mut self,
8078
8079 responder: ::fidl_next::Responder<buffer_collection::WaitForAllBuffersAllocated, ___T>,
8080 ) {
8081 ___H::wait_for_all_buffers_allocated(&mut self.0, responder).await
8082 }
8083
8084 async fn check_all_buffers_allocated(
8085 &mut self,
8086
8087 responder: ::fidl_next::Responder<buffer_collection::CheckAllBuffersAllocated, ___T>,
8088 ) {
8089 ___H::check_all_buffers_allocated(&mut self.0, responder).await
8090 }
8091
8092 async fn attach_token(
8093 &mut self,
8094
8095 request: ::fidl_next::Request<buffer_collection::AttachToken, ___T>,
8096 ) {
8097 ___H::attach_token(&mut self.0, request).await
8098 }
8099
8100 async fn attach_lifetime_tracking(
8101 &mut self,
8102
8103 request: ::fidl_next::Request<buffer_collection::AttachLifetimeTracking, ___T>,
8104 ) {
8105 ___H::attach_lifetime_tracking(&mut self.0, request).await
8106 }
8107
8108 async fn on_unknown_interaction(&mut self, ordinal: u64) {
8109 ___H::on_unknown_interaction(&mut self.0, ordinal).await
8110 }
8111}
8112
8113#[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"]
8115#[derive(PartialEq, Debug)]
8116pub struct BufferCollectionToken;
8117
8118#[cfg(target_os = "fuchsia")]
8119impl ::fidl_next::HasTransport for BufferCollectionToken {
8120 type Transport = ::fidl_next::fuchsia::zx::Channel;
8121}
8122
8123pub mod buffer_collection_token {
8124 pub mod prelude {
8125 pub use crate::{
8126 BufferCollectionToken, BufferCollectionTokenClientHandler,
8127 BufferCollectionTokenLocalClientHandler, BufferCollectionTokenLocalServerHandler,
8128 BufferCollectionTokenServerHandler, buffer_collection_token,
8129 };
8130
8131 pub use crate::natural::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest;
8132
8133 pub use crate::natural::BufferCollectionTokenDuplicateRequest;
8134
8135 pub use crate::natural::BufferCollectionTokenDuplicateSyncRequest;
8136
8137 pub use crate::natural::BufferCollectionTokenDuplicateSyncResponse;
8138
8139 pub use crate::natural::Error;
8140
8141 pub use crate::natural::NodeAttachNodeTrackingRequest;
8142
8143 pub use crate::natural::NodeIsAlternateForRequest;
8144
8145 pub use crate::natural::NodeSetDebugClientInfoRequest;
8146
8147 pub use crate::natural::NodeSetDebugTimeoutLogDeadlineRequest;
8148
8149 pub use crate::natural::NodeSetNameRequest;
8150
8151 pub use crate::natural::NodeSetWeakOkRequest;
8152
8153 pub use crate::natural::NodeGetBufferCollectionIdResponse;
8154
8155 pub use crate::natural::NodeGetNodeRefResponse;
8156
8157 pub use crate::natural::NodeIsAlternateForResponse;
8158
8159 pub use crate::natural::NodeSyncResponse;
8160 }
8161
8162 pub struct Sync;
8163
8164 impl ::fidl_next::Method for Sync {
8165 const ORDINAL: u64 = 1273433845120064340;
8166 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8167 ::fidl_next::protocol::Flexibility::Flexible;
8168
8169 type Protocol = crate::BufferCollectionToken;
8170
8171 type Request = ::fidl_next::wire::EmptyMessageBody;
8172 }
8173
8174 impl ::fidl_next::TwoWayMethod for Sync {
8175 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::NodeSyncResponse>;
8176 }
8177
8178 impl<___R> ::fidl_next::Respond<___R> for Sync {
8179 type Output = ::fidl_next::Flexible<___R>;
8180
8181 fn respond(response: ___R) -> Self::Output {
8182 ::fidl_next::Flexible::Ok(response)
8183 }
8184 }
8185
8186 pub struct Release;
8187
8188 impl ::fidl_next::Method for Release {
8189 const ORDINAL: u64 = 7664192519607813318;
8190 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8191 ::fidl_next::protocol::Flexibility::Flexible;
8192
8193 type Protocol = crate::BufferCollectionToken;
8194
8195 type Request = ::fidl_next::wire::EmptyMessageBody;
8196 }
8197
8198 pub struct SetName;
8199
8200 impl ::fidl_next::Method for SetName {
8201 const ORDINAL: u64 = 811194812442657257;
8202 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8203 ::fidl_next::protocol::Flexibility::Flexible;
8204
8205 type Protocol = crate::BufferCollectionToken;
8206
8207 type Request = crate::wire::NodeSetNameRequest<'static>;
8208 }
8209
8210 pub struct SetDebugClientInfo;
8211
8212 impl ::fidl_next::Method for SetDebugClientInfo {
8213 const ORDINAL: u64 = 6691936816931379633;
8214 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8215 ::fidl_next::protocol::Flexibility::Flexible;
8216
8217 type Protocol = crate::BufferCollectionToken;
8218
8219 type Request = crate::wire::NodeSetDebugClientInfoRequest<'static>;
8220 }
8221
8222 pub struct SetDebugTimeoutLogDeadline;
8223
8224 impl ::fidl_next::Method for SetDebugTimeoutLogDeadline {
8225 const ORDINAL: u64 = 8172637980026734598;
8226 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8227 ::fidl_next::protocol::Flexibility::Flexible;
8228
8229 type Protocol = crate::BufferCollectionToken;
8230
8231 type Request = crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>;
8232 }
8233
8234 pub struct SetVerboseLogging;
8235
8236 impl ::fidl_next::Method for SetVerboseLogging {
8237 const ORDINAL: u64 = 5911475287294795693;
8238 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8239 ::fidl_next::protocol::Flexibility::Flexible;
8240
8241 type Protocol = crate::BufferCollectionToken;
8242
8243 type Request = ::fidl_next::wire::EmptyMessageBody;
8244 }
8245
8246 pub struct GetNodeRef;
8247
8248 impl ::fidl_next::Method for GetNodeRef {
8249 const ORDINAL: u64 = 6574426773718429779;
8250 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8251 ::fidl_next::protocol::Flexibility::Flexible;
8252
8253 type Protocol = crate::BufferCollectionToken;
8254
8255 type Request = ::fidl_next::wire::EmptyMessageBody;
8256 }
8257
8258 impl ::fidl_next::TwoWayMethod for GetNodeRef {
8259 type Response =
8260 ::fidl_next::wire::Flexible<'static, crate::wire::NodeGetNodeRefResponse<'static>>;
8261 }
8262
8263 impl<___R> ::fidl_next::Respond<___R> for GetNodeRef {
8264 type Output = ::fidl_next::Flexible<___R>;
8265
8266 fn respond(response: ___R) -> Self::Output {
8267 ::fidl_next::Flexible::Ok(response)
8268 }
8269 }
8270
8271 pub struct IsAlternateFor;
8272
8273 impl ::fidl_next::Method for IsAlternateFor {
8274 const ORDINAL: u64 = 262772284282767397;
8275 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8276 ::fidl_next::protocol::Flexibility::Flexible;
8277
8278 type Protocol = crate::BufferCollectionToken;
8279
8280 type Request = crate::wire::NodeIsAlternateForRequest<'static>;
8281 }
8282
8283 impl ::fidl_next::TwoWayMethod for IsAlternateFor {
8284 type Response = ::fidl_next::wire::FlexibleResult<
8285 'static,
8286 crate::wire::NodeIsAlternateForResponse<'static>,
8287 crate::wire::Error,
8288 >;
8289 }
8290
8291 impl<___R> ::fidl_next::Respond<___R> for IsAlternateFor {
8292 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
8293
8294 fn respond(response: ___R) -> Self::Output {
8295 ::fidl_next::FlexibleResult::Ok(response)
8296 }
8297 }
8298
8299 impl<___R> ::fidl_next::RespondErr<___R> for IsAlternateFor {
8300 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
8301
8302 fn respond_err(response: ___R) -> Self::Output {
8303 ::fidl_next::FlexibleResult::Err(response)
8304 }
8305 }
8306
8307 pub struct GetBufferCollectionId;
8308
8309 impl ::fidl_next::Method for GetBufferCollectionId {
8310 const ORDINAL: u64 = 8633851600235444876;
8311 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8312 ::fidl_next::protocol::Flexibility::Flexible;
8313
8314 type Protocol = crate::BufferCollectionToken;
8315
8316 type Request = ::fidl_next::wire::EmptyMessageBody;
8317 }
8318
8319 impl ::fidl_next::TwoWayMethod for GetBufferCollectionId {
8320 type Response = ::fidl_next::wire::Flexible<
8321 'static,
8322 crate::wire::NodeGetBufferCollectionIdResponse<'static>,
8323 >;
8324 }
8325
8326 impl<___R> ::fidl_next::Respond<___R> for GetBufferCollectionId {
8327 type Output = ::fidl_next::Flexible<___R>;
8328
8329 fn respond(response: ___R) -> Self::Output {
8330 ::fidl_next::Flexible::Ok(response)
8331 }
8332 }
8333
8334 pub struct SetWeak;
8335
8336 impl ::fidl_next::Method for SetWeak {
8337 const ORDINAL: u64 = 2512233045884338145;
8338 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8339 ::fidl_next::protocol::Flexibility::Flexible;
8340
8341 type Protocol = crate::BufferCollectionToken;
8342
8343 type Request = ::fidl_next::wire::EmptyMessageBody;
8344 }
8345
8346 pub struct SetWeakOk;
8347
8348 impl ::fidl_next::Method for SetWeakOk {
8349 const ORDINAL: u64 = 4081474869151288297;
8350 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8351 ::fidl_next::protocol::Flexibility::Flexible;
8352
8353 type Protocol = crate::BufferCollectionToken;
8354
8355 type Request = crate::wire::NodeSetWeakOkRequest<'static>;
8356 }
8357
8358 pub struct AttachNodeTracking;
8359
8360 impl ::fidl_next::Method for AttachNodeTracking {
8361 const ORDINAL: u64 = 4549465353676377516;
8362 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8363 ::fidl_next::protocol::Flexibility::Flexible;
8364
8365 type Protocol = crate::BufferCollectionToken;
8366
8367 type Request = crate::wire::NodeAttachNodeTrackingRequest<'static>;
8368 }
8369
8370 pub struct DuplicateSync;
8371
8372 impl ::fidl_next::Method for DuplicateSync {
8373 const ORDINAL: u64 = 2025205386257933404;
8374 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8375 ::fidl_next::protocol::Flexibility::Flexible;
8376
8377 type Protocol = crate::BufferCollectionToken;
8378
8379 type Request = crate::wire::BufferCollectionTokenDuplicateSyncRequest<'static>;
8380 }
8381
8382 impl ::fidl_next::TwoWayMethod for DuplicateSync {
8383 type Response = ::fidl_next::wire::Flexible<
8384 'static,
8385 crate::wire::BufferCollectionTokenDuplicateSyncResponse<'static>,
8386 >;
8387 }
8388
8389 impl<___R> ::fidl_next::Respond<___R> for DuplicateSync {
8390 type Output = ::fidl_next::Flexible<___R>;
8391
8392 fn respond(response: ___R) -> Self::Output {
8393 ::fidl_next::Flexible::Ok(response)
8394 }
8395 }
8396
8397 pub struct Duplicate;
8398
8399 impl ::fidl_next::Method for Duplicate {
8400 const ORDINAL: u64 = 8351801895211219079;
8401 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8402 ::fidl_next::protocol::Flexibility::Flexible;
8403
8404 type Protocol = crate::BufferCollectionToken;
8405
8406 type Request = crate::wire::BufferCollectionTokenDuplicateRequest<'static>;
8407 }
8408
8409 pub struct SetDispensable;
8410
8411 impl ::fidl_next::Method for SetDispensable {
8412 const ORDINAL: u64 = 2489029993977667467;
8413 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8414 ::fidl_next::protocol::Flexibility::Flexible;
8415
8416 type Protocol = crate::BufferCollectionToken;
8417
8418 type Request = ::fidl_next::wire::EmptyMessageBody;
8419 }
8420
8421 pub struct CreateBufferCollectionTokenGroup;
8422
8423 impl ::fidl_next::Method for CreateBufferCollectionTokenGroup {
8424 const ORDINAL: u64 = 3528804016404117234;
8425 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
8426 ::fidl_next::protocol::Flexibility::Flexible;
8427
8428 type Protocol = crate::BufferCollectionToken;
8429
8430 type Request =
8431 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'static>;
8432 }
8433
8434 mod ___detail {
8435 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::BufferCollectionToken
8436 where
8437 ___T: ::fidl_next::Transport,
8438 {
8439 type Client = BufferCollectionTokenClient<___T>;
8440 type Server = BufferCollectionTokenServer<___T>;
8441 }
8442
8443 #[repr(transparent)]
8445 pub struct BufferCollectionTokenClient<___T: ::fidl_next::Transport> {
8446 #[allow(dead_code)]
8447 client: ::fidl_next::protocol::Client<___T>,
8448 }
8449
8450 impl<___T> BufferCollectionTokenClient<___T>
8451 where
8452 ___T: ::fidl_next::Transport,
8453 {
8454 #[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"]
8455 pub fn sync(&self) -> ::fidl_next::TwoWayFuture<'_, super::Sync, ___T> {
8456 ::fidl_next::TwoWayFuture::from_untyped(
8457 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
8458 1273433845120064340,
8459 <super::Sync as ::fidl_next::Method>::FLEXIBILITY,
8460 (),
8461 ),
8462 )
8463 }
8464
8465 #[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"]
8466 pub fn release(&self) -> ::fidl_next::SendFuture<'_, ___T> {
8467 ::fidl_next::SendFuture::from_untyped(
8468 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
8469 7664192519607813318,
8470 <super::Release as ::fidl_next::Method>::FLEXIBILITY,
8471 (),
8472 ),
8473 )
8474 }
8475
8476 #[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"]
8477 pub fn set_name_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
8478 where
8479 ___R: ::fidl_next::Encode<
8480 crate::wire::NodeSetNameRequest<'static>,
8481 <___T as ::fidl_next::Transport>::SendBuffer,
8482 >,
8483 {
8484 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
8485 811194812442657257,
8486 <super::SetName as ::fidl_next::Method>::FLEXIBILITY,
8487 request,
8488 ))
8489 }
8490
8491 #[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"]
8492 pub fn set_debug_client_info_with<___R>(
8493 &self,
8494 request: ___R,
8495 ) -> ::fidl_next::SendFuture<'_, ___T>
8496 where
8497 ___R: ::fidl_next::Encode<
8498 crate::wire::NodeSetDebugClientInfoRequest<'static>,
8499 <___T as ::fidl_next::Transport>::SendBuffer,
8500 >,
8501 {
8502 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
8503 6691936816931379633,
8504 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
8505 request,
8506 ))
8507 }
8508
8509 #[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"]
8510 pub fn set_debug_timeout_log_deadline_with<___R>(
8511 &self,
8512 request: ___R,
8513 ) -> ::fidl_next::SendFuture<'_, ___T>
8514 where
8515 ___R: ::fidl_next::Encode<
8516 crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>,
8517 <___T as ::fidl_next::Transport>::SendBuffer,
8518 >,
8519 {
8520 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
8521 8172637980026734598,
8522 <super::SetDebugTimeoutLogDeadline as ::fidl_next::Method>::FLEXIBILITY,
8523 request,
8524 ))
8525 }
8526
8527 #[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"]
8528 pub fn set_verbose_logging(&self) -> ::fidl_next::SendFuture<'_, ___T> {
8529 ::fidl_next::SendFuture::from_untyped(
8530 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
8531 5911475287294795693,
8532 <super::SetVerboseLogging as ::fidl_next::Method>::FLEXIBILITY,
8533 (),
8534 ),
8535 )
8536 }
8537
8538 #[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"]
8539 pub fn get_node_ref(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetNodeRef, ___T> {
8540 ::fidl_next::TwoWayFuture::from_untyped(
8541 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
8542 6574426773718429779,
8543 <super::GetNodeRef as ::fidl_next::Method>::FLEXIBILITY,
8544 (),
8545 ),
8546 )
8547 }
8548
8549 #[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"]
8550 pub fn is_alternate_for_with<___R>(
8551 &self,
8552 request: ___R,
8553 ) -> ::fidl_next::TwoWayFuture<'_, super::IsAlternateFor, ___T>
8554 where
8555 ___R: ::fidl_next::Encode<
8556 crate::wire::NodeIsAlternateForRequest<'static>,
8557 <___T as ::fidl_next::Transport>::SendBuffer,
8558 >,
8559 {
8560 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
8561 262772284282767397,
8562 <super::IsAlternateFor as ::fidl_next::Method>::FLEXIBILITY,
8563 request,
8564 ))
8565 }
8566
8567 #[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"]
8568 pub fn get_buffer_collection_id(
8569 &self,
8570 ) -> ::fidl_next::TwoWayFuture<'_, super::GetBufferCollectionId, ___T> {
8571 ::fidl_next::TwoWayFuture::from_untyped(
8572 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
8573 8633851600235444876,
8574 <super::GetBufferCollectionId as ::fidl_next::Method>::FLEXIBILITY,
8575 (),
8576 ),
8577 )
8578 }
8579
8580 #[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"]
8581 pub fn set_weak(&self) -> ::fidl_next::SendFuture<'_, ___T> {
8582 ::fidl_next::SendFuture::from_untyped(
8583 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
8584 2512233045884338145,
8585 <super::SetWeak as ::fidl_next::Method>::FLEXIBILITY,
8586 (),
8587 ),
8588 )
8589 }
8590
8591 #[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"]
8592 pub fn set_weak_ok_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
8593 where
8594 ___R: ::fidl_next::Encode<
8595 crate::wire::NodeSetWeakOkRequest<'static>,
8596 <___T as ::fidl_next::Transport>::SendBuffer,
8597 >,
8598 {
8599 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
8600 4081474869151288297,
8601 <super::SetWeakOk as ::fidl_next::Method>::FLEXIBILITY,
8602 request,
8603 ))
8604 }
8605
8606 #[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"]
8607 pub fn attach_node_tracking_with<___R>(
8608 &self,
8609 request: ___R,
8610 ) -> ::fidl_next::SendFuture<'_, ___T>
8611 where
8612 ___R: ::fidl_next::Encode<
8613 crate::wire::NodeAttachNodeTrackingRequest<'static>,
8614 <___T as ::fidl_next::Transport>::SendBuffer,
8615 >,
8616 {
8617 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
8618 4549465353676377516,
8619 <super::AttachNodeTracking as ::fidl_next::Method>::FLEXIBILITY,
8620 request,
8621 ))
8622 }
8623
8624 #[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"]
8625 pub fn duplicate_sync_with<___R>(
8626 &self,
8627 request: ___R,
8628 ) -> ::fidl_next::TwoWayFuture<'_, super::DuplicateSync, ___T>
8629 where
8630 ___R: ::fidl_next::Encode<
8631 crate::wire::BufferCollectionTokenDuplicateSyncRequest<'static>,
8632 <___T as ::fidl_next::Transport>::SendBuffer,
8633 >,
8634 {
8635 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
8636 2025205386257933404,
8637 <super::DuplicateSync as ::fidl_next::Method>::FLEXIBILITY,
8638 request,
8639 ))
8640 }
8641
8642 #[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"]
8643 pub fn duplicate_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
8644 where
8645 ___R: ::fidl_next::Encode<
8646 crate::wire::BufferCollectionTokenDuplicateRequest<'static>,
8647 <___T as ::fidl_next::Transport>::SendBuffer,
8648 >,
8649 {
8650 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
8651 8351801895211219079,
8652 <super::Duplicate as ::fidl_next::Method>::FLEXIBILITY,
8653 request,
8654 ))
8655 }
8656
8657 #[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"]
8658 pub fn set_dispensable(&self) -> ::fidl_next::SendFuture<'_, ___T> {
8659 ::fidl_next::SendFuture::from_untyped(
8660 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
8661 2489029993977667467,
8662 <super::SetDispensable as ::fidl_next::Method>::FLEXIBILITY,
8663 (),
8664 ),
8665 )
8666 }
8667
8668 #[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"]
8669 pub fn create_buffer_collection_token_group_with<___R>(
8670 &self,
8671 request: ___R,
8672 ) -> ::fidl_next::SendFuture<'_, ___T>
8673 where
8674 ___R: ::fidl_next::Encode<
8675 crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<
8676 'static,
8677 >,
8678 <___T as ::fidl_next::Transport>::SendBuffer,
8679 >,
8680 {
8681 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
8682 3528804016404117234,
8683 <super::CreateBufferCollectionTokenGroup as ::fidl_next::Method>::FLEXIBILITY,
8684 request,
8685 ))
8686 }
8687 }
8688
8689 #[repr(transparent)]
8691 pub struct BufferCollectionTokenServer<___T: ::fidl_next::Transport> {
8692 server: ::fidl_next::protocol::Server<___T>,
8693 }
8694
8695 impl<___T> BufferCollectionTokenServer<___T> where ___T: ::fidl_next::Transport {}
8696 }
8697}
8698
8699#[diagnostic::on_unimplemented(
8700 note = "If {Self} implements the non-local BufferCollectionTokenClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
8701)]
8702
8703pub trait BufferCollectionTokenLocalClientHandler<
8707 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
8708 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
8709>
8710{
8711 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
8712 ::core::future::ready(())
8713 }
8714}
8715
8716impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for BufferCollectionToken
8717where
8718 ___H: BufferCollectionTokenLocalClientHandler<___T>,
8719 ___T: ::fidl_next::Transport,
8720{
8721 async fn on_event(
8722 handler: &mut ___H,
8723 ordinal: u64,
8724 flexibility: ::fidl_next::protocol::Flexibility,
8725 body: ::fidl_next::Body<___T>,
8726 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
8727 match ordinal {
8728 ordinal => {
8729 handler.on_unknown_interaction(ordinal).await;
8730 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
8731 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
8732 } else {
8733 Ok(())
8734 }
8735 }
8736 }
8737 }
8738}
8739
8740#[diagnostic::on_unimplemented(
8741 note = "If {Self} implements the non-local BufferCollectionTokenServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
8742)]
8743
8744pub trait BufferCollectionTokenLocalServerHandler<
8748 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
8749 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
8750>
8751{
8752 #[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"]
8753 fn sync(
8754 &mut self,
8755
8756 responder: ::fidl_next::Responder<buffer_collection_token::Sync, ___T>,
8757 ) -> impl ::core::future::Future<Output = ()>;
8758
8759 #[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"]
8760 fn release(&mut self) -> impl ::core::future::Future<Output = ()>;
8761
8762 #[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"]
8763 fn set_name(
8764 &mut self,
8765
8766 request: ::fidl_next::Request<buffer_collection_token::SetName, ___T>,
8767 ) -> impl ::core::future::Future<Output = ()>;
8768
8769 #[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"]
8770 fn set_debug_client_info(
8771 &mut self,
8772
8773 request: ::fidl_next::Request<buffer_collection_token::SetDebugClientInfo, ___T>,
8774 ) -> impl ::core::future::Future<Output = ()>;
8775
8776 #[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"]
8777 fn set_debug_timeout_log_deadline(
8778 &mut self,
8779
8780 request: ::fidl_next::Request<buffer_collection_token::SetDebugTimeoutLogDeadline, ___T>,
8781 ) -> impl ::core::future::Future<Output = ()>;
8782
8783 #[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"]
8784 fn set_verbose_logging(&mut self) -> impl ::core::future::Future<Output = ()>;
8785
8786 #[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"]
8787 fn get_node_ref(
8788 &mut self,
8789
8790 responder: ::fidl_next::Responder<buffer_collection_token::GetNodeRef, ___T>,
8791 ) -> impl ::core::future::Future<Output = ()>;
8792
8793 #[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"]
8794 fn is_alternate_for(
8795 &mut self,
8796
8797 request: ::fidl_next::Request<buffer_collection_token::IsAlternateFor, ___T>,
8798
8799 responder: ::fidl_next::Responder<buffer_collection_token::IsAlternateFor, ___T>,
8800 ) -> impl ::core::future::Future<Output = ()>;
8801
8802 #[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"]
8803 fn get_buffer_collection_id(
8804 &mut self,
8805
8806 responder: ::fidl_next::Responder<buffer_collection_token::GetBufferCollectionId, ___T>,
8807 ) -> impl ::core::future::Future<Output = ()>;
8808
8809 #[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"]
8810 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()>;
8811
8812 #[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"]
8813 fn set_weak_ok(
8814 &mut self,
8815
8816 request: ::fidl_next::Request<buffer_collection_token::SetWeakOk, ___T>,
8817 ) -> impl ::core::future::Future<Output = ()>;
8818
8819 #[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"]
8820 fn attach_node_tracking(
8821 &mut self,
8822
8823 request: ::fidl_next::Request<buffer_collection_token::AttachNodeTracking, ___T>,
8824 ) -> impl ::core::future::Future<Output = ()>;
8825
8826 #[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"]
8827 fn duplicate_sync(
8828 &mut self,
8829
8830 request: ::fidl_next::Request<buffer_collection_token::DuplicateSync, ___T>,
8831
8832 responder: ::fidl_next::Responder<buffer_collection_token::DuplicateSync, ___T>,
8833 ) -> impl ::core::future::Future<Output = ()>;
8834
8835 #[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"]
8836 fn duplicate(
8837 &mut self,
8838
8839 request: ::fidl_next::Request<buffer_collection_token::Duplicate, ___T>,
8840 ) -> impl ::core::future::Future<Output = ()>;
8841
8842 #[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"]
8843 fn set_dispensable(&mut self) -> impl ::core::future::Future<Output = ()>;
8844
8845 #[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"]
8846 fn create_buffer_collection_token_group(
8847 &mut self,
8848
8849 request: ::fidl_next::Request<
8850 buffer_collection_token::CreateBufferCollectionTokenGroup,
8851 ___T,
8852 >,
8853 ) -> impl ::core::future::Future<Output = ()>;
8854
8855 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
8856 ::core::future::ready(())
8857 }
8858}
8859
8860impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for BufferCollectionToken
8861where
8862 ___H: BufferCollectionTokenLocalServerHandler<___T> ,
8863 ___T: ::fidl_next::Transport,
8864
8865
8866
8867
8868
8869
8870 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
8871 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8872 Constraint = (),
8873 >,
8874
8875
8876
8877 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
8878 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8879 Constraint = (),
8880 >,
8881
8882
8883
8884 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
8885 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8886 Constraint = (),
8887 >,
8888
8889
8890
8891
8892
8893
8894
8895 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
8896 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8897 Constraint = (),
8898 >,
8899
8900
8901
8902
8903
8904
8905
8906 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
8907 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8908 Constraint = (),
8909 >,
8910
8911
8912
8913 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
8914 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8915 Constraint = (),
8916 >,
8917
8918
8919
8920 for<'de> crate::wire::BufferCollectionTokenDuplicateSyncRequest<'de>: ::fidl_next::Decode<
8921 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8922 Constraint = (),
8923 >,
8924
8925
8926
8927 for<'de> crate::wire::BufferCollectionTokenDuplicateRequest<'de>: ::fidl_next::Decode<
8928 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8929 Constraint = (),
8930 >,
8931
8932
8933
8934
8935
8936 for<'de> crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>: ::fidl_next::Decode<
8937 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
8938 Constraint = (),
8939 >,
8940
8941
8942{
8943 async fn on_one_way(
8944 handler: &mut ___H,
8945 ordinal: u64,
8946 flexibility: ::fidl_next::protocol::Flexibility,
8947 body: ::fidl_next::Body<___T>,
8948 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
8949 match ordinal {
8950
8951
8952
8953
8954
8955
8956 7664192519607813318 => {
8957
8958 handler.release().await;
8959 Ok(())
8960
8961 }
8962
8963
8964
8965
8966 811194812442657257 => {
8967
8968 match ::fidl_next::AsDecoderExt::into_decoded(body) {
8969 Ok(decoded) => {
8970 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
8971 Ok(())
8972 }
8973 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8974 ordinal: 811194812442657257,
8975 error,
8976 }),
8977 }
8978
8979 }
8980
8981
8982
8983
8984 6691936816931379633 => {
8985
8986 match ::fidl_next::AsDecoderExt::into_decoded(body) {
8987 Ok(decoded) => {
8988 handler.set_debug_client_info(::fidl_next::Request::from_decoded(decoded)).await;
8989 Ok(())
8990 }
8991 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
8992 ordinal: 6691936816931379633,
8993 error,
8994 }),
8995 }
8996
8997 }
8998
8999
9000
9001
9002 8172637980026734598 => {
9003
9004 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9005 Ok(decoded) => {
9006 handler.set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded)).await;
9007 Ok(())
9008 }
9009 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9010 ordinal: 8172637980026734598,
9011 error,
9012 }),
9013 }
9014
9015 }
9016
9017
9018
9019
9020 5911475287294795693 => {
9021
9022 handler.set_verbose_logging().await;
9023 Ok(())
9024
9025 }
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039 2512233045884338145 => {
9040
9041 handler.set_weak().await;
9042 Ok(())
9043
9044 }
9045
9046
9047
9048
9049 4081474869151288297 => {
9050
9051 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9052 Ok(decoded) => {
9053 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
9054 Ok(())
9055 }
9056 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9057 ordinal: 4081474869151288297,
9058 error,
9059 }),
9060 }
9061
9062 }
9063
9064
9065
9066
9067 4549465353676377516 => {
9068
9069 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9070 Ok(decoded) => {
9071 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
9072 Ok(())
9073 }
9074 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9075 ordinal: 4549465353676377516,
9076 error,
9077 }),
9078 }
9079
9080 }
9081
9082
9083
9084
9085
9086
9087
9088 8351801895211219079 => {
9089
9090 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9091 Ok(decoded) => {
9092 handler.duplicate(::fidl_next::Request::from_decoded(decoded)).await;
9093 Ok(())
9094 }
9095 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9096 ordinal: 8351801895211219079,
9097 error,
9098 }),
9099 }
9100
9101 }
9102
9103
9104
9105
9106 2489029993977667467 => {
9107
9108 handler.set_dispensable().await;
9109 Ok(())
9110
9111 }
9112
9113
9114
9115
9116 3528804016404117234 => {
9117
9118 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9119 Ok(decoded) => {
9120 handler.create_buffer_collection_token_group(::fidl_next::Request::from_decoded(decoded)).await;
9121 Ok(())
9122 }
9123 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9124 ordinal: 3528804016404117234,
9125 error,
9126 }),
9127 }
9128
9129 }
9130
9131
9132 ordinal => {
9133
9134 handler.on_unknown_interaction(ordinal).await;
9135 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
9136 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
9137 } else {
9138 Ok(())
9139 }
9140
9141 }
9142 }
9143 }
9144
9145 async fn on_two_way(
9146 handler: &mut ___H,
9147 ordinal: u64,
9148 flexibility: ::fidl_next::protocol::Flexibility,
9149 body: ::fidl_next::Body<___T>,
9150 responder: ::fidl_next::protocol::Responder<___T>,
9151 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
9152 match ordinal {
9153
9154
9155
9156 1273433845120064340 => {
9157 let responder = ::fidl_next::Responder::from_untyped(responder);
9158
9159 handler.sync(responder).await;
9160 Ok(())
9161
9162 }
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182 6574426773718429779 => {
9183 let responder = ::fidl_next::Responder::from_untyped(responder);
9184
9185 handler.get_node_ref(responder).await;
9186 Ok(())
9187
9188 }
9189
9190
9191
9192
9193 262772284282767397 => {
9194 let responder = ::fidl_next::Responder::from_untyped(responder);
9195
9196 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9197 Ok(decoded) => {
9198 handler.is_alternate_for(::fidl_next::Request::from_decoded(decoded), responder).await;
9199 Ok(())
9200 }
9201 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9202 ordinal: 262772284282767397,
9203 error,
9204 }),
9205 }
9206
9207 }
9208
9209
9210
9211
9212 8633851600235444876 => {
9213 let responder = ::fidl_next::Responder::from_untyped(responder);
9214
9215 handler.get_buffer_collection_id(responder).await;
9216 Ok(())
9217
9218 }
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232 2025205386257933404 => {
9233 let responder = ::fidl_next::Responder::from_untyped(responder);
9234
9235 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9236 Ok(decoded) => {
9237 handler.duplicate_sync(::fidl_next::Request::from_decoded(decoded), responder).await;
9238 Ok(())
9239 }
9240 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9241 ordinal: 2025205386257933404,
9242 error,
9243 }),
9244 }
9245
9246 }
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258 ordinal => {
9259
9260 handler.on_unknown_interaction(ordinal).await;
9261 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
9262 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
9263 } else {
9264 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
9265 ordinal,
9266 flexibility,
9267 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
9268 )
9269 .expect("encoding a framework error should never fail")
9270 .await?;
9271 Ok(())
9272 }
9273
9274 }
9275 }
9276 }
9277}
9278
9279pub trait BufferCollectionTokenClientHandler<
9283 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
9284 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
9285>
9286{
9287 fn on_unknown_interaction(
9288 &mut self,
9289 ordinal: u64,
9290 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
9291 ::core::future::ready(())
9292 }
9293}
9294
9295impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for BufferCollectionToken
9296where
9297 ___H: BufferCollectionTokenClientHandler<___T> + ::core::marker::Send,
9298 ___T: ::fidl_next::Transport,
9299{
9300 async fn on_event(
9301 handler: &mut ___H,
9302 ordinal: u64,
9303 flexibility: ::fidl_next::protocol::Flexibility,
9304 body: ::fidl_next::Body<___T>,
9305 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
9306 match ordinal {
9307 ordinal => {
9308 handler.on_unknown_interaction(ordinal).await;
9309 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
9310 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
9311 } else {
9312 Ok(())
9313 }
9314 }
9315 }
9316 }
9317}
9318
9319pub trait BufferCollectionTokenServerHandler<
9323 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
9324 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
9325>
9326{
9327 #[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"]
9328 fn sync(
9329 &mut self,
9330
9331 responder: ::fidl_next::Responder<buffer_collection_token::Sync, ___T>,
9332 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9333
9334 #[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"]
9335 fn release(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9336
9337 #[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"]
9338 fn set_name(
9339 &mut self,
9340
9341 request: ::fidl_next::Request<buffer_collection_token::SetName, ___T>,
9342 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9343
9344 #[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"]
9345 fn set_debug_client_info(
9346 &mut self,
9347
9348 request: ::fidl_next::Request<buffer_collection_token::SetDebugClientInfo, ___T>,
9349 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9350
9351 #[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"]
9352 fn set_debug_timeout_log_deadline(
9353 &mut self,
9354
9355 request: ::fidl_next::Request<buffer_collection_token::SetDebugTimeoutLogDeadline, ___T>,
9356 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9357
9358 #[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"]
9359 fn set_verbose_logging(
9360 &mut self,
9361 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9362
9363 #[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"]
9364 fn get_node_ref(
9365 &mut self,
9366
9367 responder: ::fidl_next::Responder<buffer_collection_token::GetNodeRef, ___T>,
9368 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9369
9370 #[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"]
9371 fn is_alternate_for(
9372 &mut self,
9373
9374 request: ::fidl_next::Request<buffer_collection_token::IsAlternateFor, ___T>,
9375
9376 responder: ::fidl_next::Responder<buffer_collection_token::IsAlternateFor, ___T>,
9377 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9378
9379 #[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"]
9380 fn get_buffer_collection_id(
9381 &mut self,
9382
9383 responder: ::fidl_next::Responder<buffer_collection_token::GetBufferCollectionId, ___T>,
9384 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9385
9386 #[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"]
9387 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9388
9389 #[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"]
9390 fn set_weak_ok(
9391 &mut self,
9392
9393 request: ::fidl_next::Request<buffer_collection_token::SetWeakOk, ___T>,
9394 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9395
9396 #[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"]
9397 fn attach_node_tracking(
9398 &mut self,
9399
9400 request: ::fidl_next::Request<buffer_collection_token::AttachNodeTracking, ___T>,
9401 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9402
9403 #[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"]
9404 fn duplicate_sync(
9405 &mut self,
9406
9407 request: ::fidl_next::Request<buffer_collection_token::DuplicateSync, ___T>,
9408
9409 responder: ::fidl_next::Responder<buffer_collection_token::DuplicateSync, ___T>,
9410 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9411
9412 #[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"]
9413 fn duplicate(
9414 &mut self,
9415
9416 request: ::fidl_next::Request<buffer_collection_token::Duplicate, ___T>,
9417 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9418
9419 #[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"]
9420 fn set_dispensable(
9421 &mut self,
9422 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9423
9424 #[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"]
9425 fn create_buffer_collection_token_group(
9426 &mut self,
9427
9428 request: ::fidl_next::Request<
9429 buffer_collection_token::CreateBufferCollectionTokenGroup,
9430 ___T,
9431 >,
9432 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
9433
9434 fn on_unknown_interaction(
9435 &mut self,
9436 ordinal: u64,
9437 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
9438 ::core::future::ready(())
9439 }
9440}
9441
9442impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for BufferCollectionToken
9443where
9444 ___H: BufferCollectionTokenServerHandler<___T> + ::core::marker::Send,
9445 ___T: ::fidl_next::Transport,
9446
9447
9448
9449
9450
9451
9452 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
9453 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9454 Constraint = (),
9455 >,
9456
9457
9458
9459 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
9460 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9461 Constraint = (),
9462 >,
9463
9464
9465
9466 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
9467 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9468 Constraint = (),
9469 >,
9470
9471
9472
9473
9474
9475
9476
9477 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
9478 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9479 Constraint = (),
9480 >,
9481
9482
9483
9484
9485
9486
9487
9488 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
9489 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9490 Constraint = (),
9491 >,
9492
9493
9494
9495 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
9496 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9497 Constraint = (),
9498 >,
9499
9500
9501
9502 for<'de> crate::wire::BufferCollectionTokenDuplicateSyncRequest<'de>: ::fidl_next::Decode<
9503 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9504 Constraint = (),
9505 >,
9506
9507
9508
9509 for<'de> crate::wire::BufferCollectionTokenDuplicateRequest<'de>: ::fidl_next::Decode<
9510 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9511 Constraint = (),
9512 >,
9513
9514
9515
9516
9517
9518 for<'de> crate::wire::BufferCollectionTokenCreateBufferCollectionTokenGroupRequest<'de>: ::fidl_next::Decode<
9519 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
9520 Constraint = (),
9521 >,
9522
9523
9524{
9525 async fn on_one_way(
9526 handler: &mut ___H,
9527 ordinal: u64,
9528 flexibility: ::fidl_next::protocol::Flexibility,
9529 body: ::fidl_next::Body<___T>,
9530 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
9531 match ordinal {
9532
9533
9534
9535
9536
9537
9538 7664192519607813318 => {
9539
9540 handler.release().await;
9541 Ok(())
9542
9543 }
9544
9545
9546
9547
9548 811194812442657257 => {
9549
9550 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9551 Ok(decoded) => {
9552 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
9553 Ok(())
9554 }
9555 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9556 ordinal: 811194812442657257,
9557 error,
9558 }),
9559 }
9560
9561 }
9562
9563
9564
9565
9566 6691936816931379633 => {
9567
9568 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9569 Ok(decoded) => {
9570 handler.set_debug_client_info(::fidl_next::Request::from_decoded(decoded)).await;
9571 Ok(())
9572 }
9573 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9574 ordinal: 6691936816931379633,
9575 error,
9576 }),
9577 }
9578
9579 }
9580
9581
9582
9583
9584 8172637980026734598 => {
9585
9586 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9587 Ok(decoded) => {
9588 handler.set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded)).await;
9589 Ok(())
9590 }
9591 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9592 ordinal: 8172637980026734598,
9593 error,
9594 }),
9595 }
9596
9597 }
9598
9599
9600
9601
9602 5911475287294795693 => {
9603
9604 handler.set_verbose_logging().await;
9605 Ok(())
9606
9607 }
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621 2512233045884338145 => {
9622
9623 handler.set_weak().await;
9624 Ok(())
9625
9626 }
9627
9628
9629
9630
9631 4081474869151288297 => {
9632
9633 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9634 Ok(decoded) => {
9635 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
9636 Ok(())
9637 }
9638 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9639 ordinal: 4081474869151288297,
9640 error,
9641 }),
9642 }
9643
9644 }
9645
9646
9647
9648
9649 4549465353676377516 => {
9650
9651 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9652 Ok(decoded) => {
9653 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
9654 Ok(())
9655 }
9656 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9657 ordinal: 4549465353676377516,
9658 error,
9659 }),
9660 }
9661
9662 }
9663
9664
9665
9666
9667
9668
9669
9670 8351801895211219079 => {
9671
9672 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9673 Ok(decoded) => {
9674 handler.duplicate(::fidl_next::Request::from_decoded(decoded)).await;
9675 Ok(())
9676 }
9677 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9678 ordinal: 8351801895211219079,
9679 error,
9680 }),
9681 }
9682
9683 }
9684
9685
9686
9687
9688 2489029993977667467 => {
9689
9690 handler.set_dispensable().await;
9691 Ok(())
9692
9693 }
9694
9695
9696
9697
9698 3528804016404117234 => {
9699
9700 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9701 Ok(decoded) => {
9702 handler.create_buffer_collection_token_group(::fidl_next::Request::from_decoded(decoded)).await;
9703 Ok(())
9704 }
9705 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9706 ordinal: 3528804016404117234,
9707 error,
9708 }),
9709 }
9710
9711 }
9712
9713
9714 ordinal => {
9715
9716 handler.on_unknown_interaction(ordinal).await;
9717 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
9718 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
9719 } else {
9720 Ok(())
9721 }
9722
9723 }
9724 }
9725 }
9726
9727 async fn on_two_way(
9728 handler: &mut ___H,
9729 ordinal: u64,
9730 flexibility: ::fidl_next::protocol::Flexibility,
9731 body: ::fidl_next::Body<___T>,
9732 responder: ::fidl_next::protocol::Responder<___T>,
9733 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
9734 match ordinal {
9735
9736
9737
9738 1273433845120064340 => {
9739 let responder = ::fidl_next::Responder::from_untyped(responder);
9740
9741 handler.sync(responder).await;
9742 Ok(())
9743
9744 }
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764 6574426773718429779 => {
9765 let responder = ::fidl_next::Responder::from_untyped(responder);
9766
9767 handler.get_node_ref(responder).await;
9768 Ok(())
9769
9770 }
9771
9772
9773
9774
9775 262772284282767397 => {
9776 let responder = ::fidl_next::Responder::from_untyped(responder);
9777
9778 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9779 Ok(decoded) => {
9780 handler.is_alternate_for(::fidl_next::Request::from_decoded(decoded), responder).await;
9781 Ok(())
9782 }
9783 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9784 ordinal: 262772284282767397,
9785 error,
9786 }),
9787 }
9788
9789 }
9790
9791
9792
9793
9794 8633851600235444876 => {
9795 let responder = ::fidl_next::Responder::from_untyped(responder);
9796
9797 handler.get_buffer_collection_id(responder).await;
9798 Ok(())
9799
9800 }
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814 2025205386257933404 => {
9815 let responder = ::fidl_next::Responder::from_untyped(responder);
9816
9817 match ::fidl_next::AsDecoderExt::into_decoded(body) {
9818 Ok(decoded) => {
9819 handler.duplicate_sync(::fidl_next::Request::from_decoded(decoded), responder).await;
9820 Ok(())
9821 }
9822 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
9823 ordinal: 2025205386257933404,
9824 error,
9825 }),
9826 }
9827
9828 }
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840 ordinal => {
9841
9842 handler.on_unknown_interaction(ordinal).await;
9843 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
9844 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
9845 } else {
9846 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
9847 ordinal,
9848 flexibility,
9849 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
9850 )
9851 .expect("encoding a framework error should never fail")
9852 .await?;
9853 Ok(())
9854 }
9855
9856 }
9857 }
9858 }
9859}
9860
9861impl<___T> BufferCollectionTokenClientHandler<___T> for ::fidl_next::IgnoreEvents
9862where
9863 ___T: ::fidl_next::Transport,
9864{
9865 async fn on_unknown_interaction(&mut self, _: u64) {}
9866}
9867
9868impl<___H, ___T> BufferCollectionTokenLocalClientHandler<___T> for ::fidl_next::Local<___H>
9869where
9870 ___H: BufferCollectionTokenClientHandler<___T>,
9871 ___T: ::fidl_next::Transport,
9872{
9873 async fn on_unknown_interaction(&mut self, ordinal: u64) {
9874 ___H::on_unknown_interaction(&mut self.0, ordinal).await
9875 }
9876}
9877
9878impl<___H, ___T> BufferCollectionTokenLocalServerHandler<___T> for ::fidl_next::Local<___H>
9879where
9880 ___H: BufferCollectionTokenServerHandler<___T>,
9881 ___T: ::fidl_next::Transport,
9882{
9883 async fn sync(
9884 &mut self,
9885
9886 responder: ::fidl_next::Responder<buffer_collection_token::Sync, ___T>,
9887 ) {
9888 ___H::sync(&mut self.0, responder).await
9889 }
9890
9891 async fn release(&mut self) {
9892 ___H::release(&mut self.0).await
9893 }
9894
9895 async fn set_name(
9896 &mut self,
9897
9898 request: ::fidl_next::Request<buffer_collection_token::SetName, ___T>,
9899 ) {
9900 ___H::set_name(&mut self.0, request).await
9901 }
9902
9903 async fn set_debug_client_info(
9904 &mut self,
9905
9906 request: ::fidl_next::Request<buffer_collection_token::SetDebugClientInfo, ___T>,
9907 ) {
9908 ___H::set_debug_client_info(&mut self.0, request).await
9909 }
9910
9911 async fn set_debug_timeout_log_deadline(
9912 &mut self,
9913
9914 request: ::fidl_next::Request<buffer_collection_token::SetDebugTimeoutLogDeadline, ___T>,
9915 ) {
9916 ___H::set_debug_timeout_log_deadline(&mut self.0, request).await
9917 }
9918
9919 async fn set_verbose_logging(&mut self) {
9920 ___H::set_verbose_logging(&mut self.0).await
9921 }
9922
9923 async fn get_node_ref(
9924 &mut self,
9925
9926 responder: ::fidl_next::Responder<buffer_collection_token::GetNodeRef, ___T>,
9927 ) {
9928 ___H::get_node_ref(&mut self.0, responder).await
9929 }
9930
9931 async fn is_alternate_for(
9932 &mut self,
9933
9934 request: ::fidl_next::Request<buffer_collection_token::IsAlternateFor, ___T>,
9935
9936 responder: ::fidl_next::Responder<buffer_collection_token::IsAlternateFor, ___T>,
9937 ) {
9938 ___H::is_alternate_for(&mut self.0, request, responder).await
9939 }
9940
9941 async fn get_buffer_collection_id(
9942 &mut self,
9943
9944 responder: ::fidl_next::Responder<buffer_collection_token::GetBufferCollectionId, ___T>,
9945 ) {
9946 ___H::get_buffer_collection_id(&mut self.0, responder).await
9947 }
9948
9949 async fn set_weak(&mut self) {
9950 ___H::set_weak(&mut self.0).await
9951 }
9952
9953 async fn set_weak_ok(
9954 &mut self,
9955
9956 request: ::fidl_next::Request<buffer_collection_token::SetWeakOk, ___T>,
9957 ) {
9958 ___H::set_weak_ok(&mut self.0, request).await
9959 }
9960
9961 async fn attach_node_tracking(
9962 &mut self,
9963
9964 request: ::fidl_next::Request<buffer_collection_token::AttachNodeTracking, ___T>,
9965 ) {
9966 ___H::attach_node_tracking(&mut self.0, request).await
9967 }
9968
9969 async fn duplicate_sync(
9970 &mut self,
9971
9972 request: ::fidl_next::Request<buffer_collection_token::DuplicateSync, ___T>,
9973
9974 responder: ::fidl_next::Responder<buffer_collection_token::DuplicateSync, ___T>,
9975 ) {
9976 ___H::duplicate_sync(&mut self.0, request, responder).await
9977 }
9978
9979 async fn duplicate(
9980 &mut self,
9981
9982 request: ::fidl_next::Request<buffer_collection_token::Duplicate, ___T>,
9983 ) {
9984 ___H::duplicate(&mut self.0, request).await
9985 }
9986
9987 async fn set_dispensable(&mut self) {
9988 ___H::set_dispensable(&mut self.0).await
9989 }
9990
9991 async fn create_buffer_collection_token_group(
9992 &mut self,
9993
9994 request: ::fidl_next::Request<
9995 buffer_collection_token::CreateBufferCollectionTokenGroup,
9996 ___T,
9997 >,
9998 ) {
9999 ___H::create_buffer_collection_token_group(&mut self.0, request).await
10000 }
10001
10002 async fn on_unknown_interaction(&mut self, ordinal: u64) {
10003 ___H::on_unknown_interaction(&mut self.0, ordinal).await
10004 }
10005}
10006
10007#[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"]
10009#[derive(PartialEq, Debug)]
10010pub struct BufferCollectionTokenGroup;
10011
10012#[cfg(target_os = "fuchsia")]
10013impl ::fidl_next::HasTransport for BufferCollectionTokenGroup {
10014 type Transport = ::fidl_next::fuchsia::zx::Channel;
10015}
10016
10017pub mod buffer_collection_token_group {
10018 pub mod prelude {
10019 pub use crate::{
10020 BufferCollectionTokenGroup, BufferCollectionTokenGroupClientHandler,
10021 BufferCollectionTokenGroupLocalClientHandler,
10022 BufferCollectionTokenGroupLocalServerHandler, BufferCollectionTokenGroupServerHandler,
10023 buffer_collection_token_group,
10024 };
10025
10026 pub use crate::natural::BufferCollectionTokenGroupCreateChildRequest;
10027
10028 pub use crate::natural::BufferCollectionTokenGroupCreateChildrenSyncRequest;
10029
10030 pub use crate::natural::BufferCollectionTokenGroupCreateChildrenSyncResponse;
10031
10032 pub use crate::natural::Error;
10033
10034 pub use crate::natural::NodeAttachNodeTrackingRequest;
10035
10036 pub use crate::natural::NodeIsAlternateForRequest;
10037
10038 pub use crate::natural::NodeSetDebugClientInfoRequest;
10039
10040 pub use crate::natural::NodeSetDebugTimeoutLogDeadlineRequest;
10041
10042 pub use crate::natural::NodeSetNameRequest;
10043
10044 pub use crate::natural::NodeSetWeakOkRequest;
10045
10046 pub use crate::natural::NodeGetBufferCollectionIdResponse;
10047
10048 pub use crate::natural::NodeGetNodeRefResponse;
10049
10050 pub use crate::natural::NodeIsAlternateForResponse;
10051
10052 pub use crate::natural::NodeSyncResponse;
10053 }
10054
10055 pub struct Sync;
10056
10057 impl ::fidl_next::Method for Sync {
10058 const ORDINAL: u64 = 1273433845120064340;
10059 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10060 ::fidl_next::protocol::Flexibility::Flexible;
10061
10062 type Protocol = crate::BufferCollectionTokenGroup;
10063
10064 type Request = ::fidl_next::wire::EmptyMessageBody;
10065 }
10066
10067 impl ::fidl_next::TwoWayMethod for Sync {
10068 type Response = ::fidl_next::wire::Flexible<'static, crate::wire::NodeSyncResponse>;
10069 }
10070
10071 impl<___R> ::fidl_next::Respond<___R> for Sync {
10072 type Output = ::fidl_next::Flexible<___R>;
10073
10074 fn respond(response: ___R) -> Self::Output {
10075 ::fidl_next::Flexible::Ok(response)
10076 }
10077 }
10078
10079 pub struct Release;
10080
10081 impl ::fidl_next::Method for Release {
10082 const ORDINAL: u64 = 7664192519607813318;
10083 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10084 ::fidl_next::protocol::Flexibility::Flexible;
10085
10086 type Protocol = crate::BufferCollectionTokenGroup;
10087
10088 type Request = ::fidl_next::wire::EmptyMessageBody;
10089 }
10090
10091 pub struct SetName;
10092
10093 impl ::fidl_next::Method for SetName {
10094 const ORDINAL: u64 = 811194812442657257;
10095 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10096 ::fidl_next::protocol::Flexibility::Flexible;
10097
10098 type Protocol = crate::BufferCollectionTokenGroup;
10099
10100 type Request = crate::wire::NodeSetNameRequest<'static>;
10101 }
10102
10103 pub struct SetDebugClientInfo;
10104
10105 impl ::fidl_next::Method for SetDebugClientInfo {
10106 const ORDINAL: u64 = 6691936816931379633;
10107 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10108 ::fidl_next::protocol::Flexibility::Flexible;
10109
10110 type Protocol = crate::BufferCollectionTokenGroup;
10111
10112 type Request = crate::wire::NodeSetDebugClientInfoRequest<'static>;
10113 }
10114
10115 pub struct SetDebugTimeoutLogDeadline;
10116
10117 impl ::fidl_next::Method for SetDebugTimeoutLogDeadline {
10118 const ORDINAL: u64 = 8172637980026734598;
10119 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10120 ::fidl_next::protocol::Flexibility::Flexible;
10121
10122 type Protocol = crate::BufferCollectionTokenGroup;
10123
10124 type Request = crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>;
10125 }
10126
10127 pub struct SetVerboseLogging;
10128
10129 impl ::fidl_next::Method for SetVerboseLogging {
10130 const ORDINAL: u64 = 5911475287294795693;
10131 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10132 ::fidl_next::protocol::Flexibility::Flexible;
10133
10134 type Protocol = crate::BufferCollectionTokenGroup;
10135
10136 type Request = ::fidl_next::wire::EmptyMessageBody;
10137 }
10138
10139 pub struct GetNodeRef;
10140
10141 impl ::fidl_next::Method for GetNodeRef {
10142 const ORDINAL: u64 = 6574426773718429779;
10143 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10144 ::fidl_next::protocol::Flexibility::Flexible;
10145
10146 type Protocol = crate::BufferCollectionTokenGroup;
10147
10148 type Request = ::fidl_next::wire::EmptyMessageBody;
10149 }
10150
10151 impl ::fidl_next::TwoWayMethod for GetNodeRef {
10152 type Response =
10153 ::fidl_next::wire::Flexible<'static, crate::wire::NodeGetNodeRefResponse<'static>>;
10154 }
10155
10156 impl<___R> ::fidl_next::Respond<___R> for GetNodeRef {
10157 type Output = ::fidl_next::Flexible<___R>;
10158
10159 fn respond(response: ___R) -> Self::Output {
10160 ::fidl_next::Flexible::Ok(response)
10161 }
10162 }
10163
10164 pub struct IsAlternateFor;
10165
10166 impl ::fidl_next::Method for IsAlternateFor {
10167 const ORDINAL: u64 = 262772284282767397;
10168 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10169 ::fidl_next::protocol::Flexibility::Flexible;
10170
10171 type Protocol = crate::BufferCollectionTokenGroup;
10172
10173 type Request = crate::wire::NodeIsAlternateForRequest<'static>;
10174 }
10175
10176 impl ::fidl_next::TwoWayMethod for IsAlternateFor {
10177 type Response = ::fidl_next::wire::FlexibleResult<
10178 'static,
10179 crate::wire::NodeIsAlternateForResponse<'static>,
10180 crate::wire::Error,
10181 >;
10182 }
10183
10184 impl<___R> ::fidl_next::Respond<___R> for IsAlternateFor {
10185 type Output = ::fidl_next::FlexibleResult<___R, ::fidl_next::util::Never>;
10186
10187 fn respond(response: ___R) -> Self::Output {
10188 ::fidl_next::FlexibleResult::Ok(response)
10189 }
10190 }
10191
10192 impl<___R> ::fidl_next::RespondErr<___R> for IsAlternateFor {
10193 type Output = ::fidl_next::FlexibleResult<::fidl_next::util::Never, ___R>;
10194
10195 fn respond_err(response: ___R) -> Self::Output {
10196 ::fidl_next::FlexibleResult::Err(response)
10197 }
10198 }
10199
10200 pub struct GetBufferCollectionId;
10201
10202 impl ::fidl_next::Method for GetBufferCollectionId {
10203 const ORDINAL: u64 = 8633851600235444876;
10204 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10205 ::fidl_next::protocol::Flexibility::Flexible;
10206
10207 type Protocol = crate::BufferCollectionTokenGroup;
10208
10209 type Request = ::fidl_next::wire::EmptyMessageBody;
10210 }
10211
10212 impl ::fidl_next::TwoWayMethod for GetBufferCollectionId {
10213 type Response = ::fidl_next::wire::Flexible<
10214 'static,
10215 crate::wire::NodeGetBufferCollectionIdResponse<'static>,
10216 >;
10217 }
10218
10219 impl<___R> ::fidl_next::Respond<___R> for GetBufferCollectionId {
10220 type Output = ::fidl_next::Flexible<___R>;
10221
10222 fn respond(response: ___R) -> Self::Output {
10223 ::fidl_next::Flexible::Ok(response)
10224 }
10225 }
10226
10227 pub struct SetWeak;
10228
10229 impl ::fidl_next::Method for SetWeak {
10230 const ORDINAL: u64 = 2512233045884338145;
10231 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10232 ::fidl_next::protocol::Flexibility::Flexible;
10233
10234 type Protocol = crate::BufferCollectionTokenGroup;
10235
10236 type Request = ::fidl_next::wire::EmptyMessageBody;
10237 }
10238
10239 pub struct SetWeakOk;
10240
10241 impl ::fidl_next::Method for SetWeakOk {
10242 const ORDINAL: u64 = 4081474869151288297;
10243 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10244 ::fidl_next::protocol::Flexibility::Flexible;
10245
10246 type Protocol = crate::BufferCollectionTokenGroup;
10247
10248 type Request = crate::wire::NodeSetWeakOkRequest<'static>;
10249 }
10250
10251 pub struct AttachNodeTracking;
10252
10253 impl ::fidl_next::Method for AttachNodeTracking {
10254 const ORDINAL: u64 = 4549465353676377516;
10255 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10256 ::fidl_next::protocol::Flexibility::Flexible;
10257
10258 type Protocol = crate::BufferCollectionTokenGroup;
10259
10260 type Request = crate::wire::NodeAttachNodeTrackingRequest<'static>;
10261 }
10262
10263 pub struct CreateChild;
10264
10265 impl ::fidl_next::Method for CreateChild {
10266 const ORDINAL: u64 = 4728787705853325509;
10267 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10268 ::fidl_next::protocol::Flexibility::Flexible;
10269
10270 type Protocol = crate::BufferCollectionTokenGroup;
10271
10272 type Request = crate::wire::BufferCollectionTokenGroupCreateChildRequest<'static>;
10273 }
10274
10275 pub struct CreateChildrenSync;
10276
10277 impl ::fidl_next::Method for CreateChildrenSync {
10278 const ORDINAL: u64 = 1575877552079505162;
10279 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10280 ::fidl_next::protocol::Flexibility::Flexible;
10281
10282 type Protocol = crate::BufferCollectionTokenGroup;
10283
10284 type Request = crate::wire::BufferCollectionTokenGroupCreateChildrenSyncRequest<'static>;
10285 }
10286
10287 impl ::fidl_next::TwoWayMethod for CreateChildrenSync {
10288 type Response = ::fidl_next::wire::Flexible<
10289 'static,
10290 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncResponse<'static>,
10291 >;
10292 }
10293
10294 impl<___R> ::fidl_next::Respond<___R> for CreateChildrenSync {
10295 type Output = ::fidl_next::Flexible<___R>;
10296
10297 fn respond(response: ___R) -> Self::Output {
10298 ::fidl_next::Flexible::Ok(response)
10299 }
10300 }
10301
10302 pub struct AllChildrenPresent;
10303
10304 impl ::fidl_next::Method for AllChildrenPresent {
10305 const ORDINAL: u64 = 6643511257208525586;
10306 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
10307 ::fidl_next::protocol::Flexibility::Flexible;
10308
10309 type Protocol = crate::BufferCollectionTokenGroup;
10310
10311 type Request = ::fidl_next::wire::EmptyMessageBody;
10312 }
10313
10314 mod ___detail {
10315 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::BufferCollectionTokenGroup
10316 where
10317 ___T: ::fidl_next::Transport,
10318 {
10319 type Client = BufferCollectionTokenGroupClient<___T>;
10320 type Server = BufferCollectionTokenGroupServer<___T>;
10321 }
10322
10323 #[repr(transparent)]
10325 pub struct BufferCollectionTokenGroupClient<___T: ::fidl_next::Transport> {
10326 #[allow(dead_code)]
10327 client: ::fidl_next::protocol::Client<___T>,
10328 }
10329
10330 impl<___T> BufferCollectionTokenGroupClient<___T>
10331 where
10332 ___T: ::fidl_next::Transport,
10333 {
10334 #[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"]
10335 pub fn sync(&self) -> ::fidl_next::TwoWayFuture<'_, super::Sync, ___T> {
10336 ::fidl_next::TwoWayFuture::from_untyped(
10337 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
10338 1273433845120064340,
10339 <super::Sync as ::fidl_next::Method>::FLEXIBILITY,
10340 (),
10341 ),
10342 )
10343 }
10344
10345 #[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"]
10346 pub fn release(&self) -> ::fidl_next::SendFuture<'_, ___T> {
10347 ::fidl_next::SendFuture::from_untyped(
10348 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
10349 7664192519607813318,
10350 <super::Release as ::fidl_next::Method>::FLEXIBILITY,
10351 (),
10352 ),
10353 )
10354 }
10355
10356 #[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"]
10357 pub fn set_name_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
10358 where
10359 ___R: ::fidl_next::Encode<
10360 crate::wire::NodeSetNameRequest<'static>,
10361 <___T as ::fidl_next::Transport>::SendBuffer,
10362 >,
10363 {
10364 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
10365 811194812442657257,
10366 <super::SetName as ::fidl_next::Method>::FLEXIBILITY,
10367 request,
10368 ))
10369 }
10370
10371 #[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"]
10372 pub fn set_debug_client_info_with<___R>(
10373 &self,
10374 request: ___R,
10375 ) -> ::fidl_next::SendFuture<'_, ___T>
10376 where
10377 ___R: ::fidl_next::Encode<
10378 crate::wire::NodeSetDebugClientInfoRequest<'static>,
10379 <___T as ::fidl_next::Transport>::SendBuffer,
10380 >,
10381 {
10382 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
10383 6691936816931379633,
10384 <super::SetDebugClientInfo as ::fidl_next::Method>::FLEXIBILITY,
10385 request,
10386 ))
10387 }
10388
10389 #[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"]
10390 pub fn set_debug_timeout_log_deadline_with<___R>(
10391 &self,
10392 request: ___R,
10393 ) -> ::fidl_next::SendFuture<'_, ___T>
10394 where
10395 ___R: ::fidl_next::Encode<
10396 crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'static>,
10397 <___T as ::fidl_next::Transport>::SendBuffer,
10398 >,
10399 {
10400 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
10401 8172637980026734598,
10402 <super::SetDebugTimeoutLogDeadline as ::fidl_next::Method>::FLEXIBILITY,
10403 request,
10404 ))
10405 }
10406
10407 #[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"]
10408 pub fn set_verbose_logging(&self) -> ::fidl_next::SendFuture<'_, ___T> {
10409 ::fidl_next::SendFuture::from_untyped(
10410 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
10411 5911475287294795693,
10412 <super::SetVerboseLogging as ::fidl_next::Method>::FLEXIBILITY,
10413 (),
10414 ),
10415 )
10416 }
10417
10418 #[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"]
10419 pub fn get_node_ref(&self) -> ::fidl_next::TwoWayFuture<'_, super::GetNodeRef, ___T> {
10420 ::fidl_next::TwoWayFuture::from_untyped(
10421 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
10422 6574426773718429779,
10423 <super::GetNodeRef as ::fidl_next::Method>::FLEXIBILITY,
10424 (),
10425 ),
10426 )
10427 }
10428
10429 #[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"]
10430 pub fn is_alternate_for_with<___R>(
10431 &self,
10432 request: ___R,
10433 ) -> ::fidl_next::TwoWayFuture<'_, super::IsAlternateFor, ___T>
10434 where
10435 ___R: ::fidl_next::Encode<
10436 crate::wire::NodeIsAlternateForRequest<'static>,
10437 <___T as ::fidl_next::Transport>::SendBuffer,
10438 >,
10439 {
10440 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
10441 262772284282767397,
10442 <super::IsAlternateFor as ::fidl_next::Method>::FLEXIBILITY,
10443 request,
10444 ))
10445 }
10446
10447 #[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"]
10448 pub fn get_buffer_collection_id(
10449 &self,
10450 ) -> ::fidl_next::TwoWayFuture<'_, super::GetBufferCollectionId, ___T> {
10451 ::fidl_next::TwoWayFuture::from_untyped(
10452 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
10453 8633851600235444876,
10454 <super::GetBufferCollectionId as ::fidl_next::Method>::FLEXIBILITY,
10455 (),
10456 ),
10457 )
10458 }
10459
10460 #[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"]
10461 pub fn set_weak(&self) -> ::fidl_next::SendFuture<'_, ___T> {
10462 ::fidl_next::SendFuture::from_untyped(
10463 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
10464 2512233045884338145,
10465 <super::SetWeak as ::fidl_next::Method>::FLEXIBILITY,
10466 (),
10467 ),
10468 )
10469 }
10470
10471 #[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"]
10472 pub fn set_weak_ok_with<___R>(&self, request: ___R) -> ::fidl_next::SendFuture<'_, ___T>
10473 where
10474 ___R: ::fidl_next::Encode<
10475 crate::wire::NodeSetWeakOkRequest<'static>,
10476 <___T as ::fidl_next::Transport>::SendBuffer,
10477 >,
10478 {
10479 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
10480 4081474869151288297,
10481 <super::SetWeakOk as ::fidl_next::Method>::FLEXIBILITY,
10482 request,
10483 ))
10484 }
10485
10486 #[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"]
10487 pub fn attach_node_tracking_with<___R>(
10488 &self,
10489 request: ___R,
10490 ) -> ::fidl_next::SendFuture<'_, ___T>
10491 where
10492 ___R: ::fidl_next::Encode<
10493 crate::wire::NodeAttachNodeTrackingRequest<'static>,
10494 <___T as ::fidl_next::Transport>::SendBuffer,
10495 >,
10496 {
10497 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
10498 4549465353676377516,
10499 <super::AttachNodeTracking as ::fidl_next::Method>::FLEXIBILITY,
10500 request,
10501 ))
10502 }
10503
10504 #[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"]
10505 pub fn create_child_with<___R>(
10506 &self,
10507 request: ___R,
10508 ) -> ::fidl_next::SendFuture<'_, ___T>
10509 where
10510 ___R: ::fidl_next::Encode<
10511 crate::wire::BufferCollectionTokenGroupCreateChildRequest<'static>,
10512 <___T as ::fidl_next::Transport>::SendBuffer,
10513 >,
10514 {
10515 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
10516 4728787705853325509,
10517 <super::CreateChild as ::fidl_next::Method>::FLEXIBILITY,
10518 request,
10519 ))
10520 }
10521
10522 #[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"]
10523 pub fn create_children_sync_with<___R>(
10524 &self,
10525 request: ___R,
10526 ) -> ::fidl_next::TwoWayFuture<'_, super::CreateChildrenSync, ___T>
10527 where
10528 ___R: ::fidl_next::Encode<
10529 crate::wire::BufferCollectionTokenGroupCreateChildrenSyncRequest<'static>,
10530 <___T as ::fidl_next::Transport>::SendBuffer,
10531 >,
10532 {
10533 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
10534 1575877552079505162,
10535 <super::CreateChildrenSync as ::fidl_next::Method>::FLEXIBILITY,
10536 request,
10537 ))
10538 }
10539
10540 #[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"]
10541 pub fn all_children_present(&self) -> ::fidl_next::SendFuture<'_, ___T> {
10542 ::fidl_next::SendFuture::from_untyped(
10543 self.client.send_one_way::<::fidl_next::wire::EmptyMessageBody>(
10544 6643511257208525586,
10545 <super::AllChildrenPresent as ::fidl_next::Method>::FLEXIBILITY,
10546 (),
10547 ),
10548 )
10549 }
10550 }
10551
10552 #[repr(transparent)]
10554 pub struct BufferCollectionTokenGroupServer<___T: ::fidl_next::Transport> {
10555 server: ::fidl_next::protocol::Server<___T>,
10556 }
10557
10558 impl<___T> BufferCollectionTokenGroupServer<___T> where ___T: ::fidl_next::Transport {}
10559 }
10560}
10561
10562#[diagnostic::on_unimplemented(
10563 note = "If {Self} implements the non-local BufferCollectionTokenGroupClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
10564)]
10565
10566pub trait BufferCollectionTokenGroupLocalClientHandler<
10570 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
10571 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
10572>
10573{
10574 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
10575 ::core::future::ready(())
10576 }
10577}
10578
10579impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for BufferCollectionTokenGroup
10580where
10581 ___H: BufferCollectionTokenGroupLocalClientHandler<___T>,
10582 ___T: ::fidl_next::Transport,
10583{
10584 async fn on_event(
10585 handler: &mut ___H,
10586 ordinal: u64,
10587 flexibility: ::fidl_next::protocol::Flexibility,
10588 body: ::fidl_next::Body<___T>,
10589 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
10590 match ordinal {
10591 ordinal => {
10592 handler.on_unknown_interaction(ordinal).await;
10593 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
10594 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
10595 } else {
10596 Ok(())
10597 }
10598 }
10599 }
10600 }
10601}
10602
10603#[diagnostic::on_unimplemented(
10604 note = "If {Self} implements the non-local BufferCollectionTokenGroupServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
10605)]
10606
10607pub trait BufferCollectionTokenGroupLocalServerHandler<
10611 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
10612 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
10613>
10614{
10615 #[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"]
10616 fn sync(
10617 &mut self,
10618
10619 responder: ::fidl_next::Responder<buffer_collection_token_group::Sync, ___T>,
10620 ) -> impl ::core::future::Future<Output = ()>;
10621
10622 #[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"]
10623 fn release(&mut self) -> impl ::core::future::Future<Output = ()>;
10624
10625 #[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"]
10626 fn set_name(
10627 &mut self,
10628
10629 request: ::fidl_next::Request<buffer_collection_token_group::SetName, ___T>,
10630 ) -> impl ::core::future::Future<Output = ()>;
10631
10632 #[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"]
10633 fn set_debug_client_info(
10634 &mut self,
10635
10636 request: ::fidl_next::Request<buffer_collection_token_group::SetDebugClientInfo, ___T>,
10637 ) -> impl ::core::future::Future<Output = ()>;
10638
10639 #[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"]
10640 fn set_debug_timeout_log_deadline(
10641 &mut self,
10642
10643 request: ::fidl_next::Request<
10644 buffer_collection_token_group::SetDebugTimeoutLogDeadline,
10645 ___T,
10646 >,
10647 ) -> impl ::core::future::Future<Output = ()>;
10648
10649 #[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"]
10650 fn set_verbose_logging(&mut self) -> impl ::core::future::Future<Output = ()>;
10651
10652 #[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"]
10653 fn get_node_ref(
10654 &mut self,
10655
10656 responder: ::fidl_next::Responder<buffer_collection_token_group::GetNodeRef, ___T>,
10657 ) -> impl ::core::future::Future<Output = ()>;
10658
10659 #[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"]
10660 fn is_alternate_for(
10661 &mut self,
10662
10663 request: ::fidl_next::Request<buffer_collection_token_group::IsAlternateFor, ___T>,
10664
10665 responder: ::fidl_next::Responder<buffer_collection_token_group::IsAlternateFor, ___T>,
10666 ) -> impl ::core::future::Future<Output = ()>;
10667
10668 #[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"]
10669 fn get_buffer_collection_id(
10670 &mut self,
10671
10672 responder: ::fidl_next::Responder<
10673 buffer_collection_token_group::GetBufferCollectionId,
10674 ___T,
10675 >,
10676 ) -> impl ::core::future::Future<Output = ()>;
10677
10678 #[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"]
10679 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()>;
10680
10681 #[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"]
10682 fn set_weak_ok(
10683 &mut self,
10684
10685 request: ::fidl_next::Request<buffer_collection_token_group::SetWeakOk, ___T>,
10686 ) -> impl ::core::future::Future<Output = ()>;
10687
10688 #[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"]
10689 fn attach_node_tracking(
10690 &mut self,
10691
10692 request: ::fidl_next::Request<buffer_collection_token_group::AttachNodeTracking, ___T>,
10693 ) -> impl ::core::future::Future<Output = ()>;
10694
10695 #[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"]
10696 fn create_child(
10697 &mut self,
10698
10699 request: ::fidl_next::Request<buffer_collection_token_group::CreateChild, ___T>,
10700 ) -> impl ::core::future::Future<Output = ()>;
10701
10702 #[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"]
10703 fn create_children_sync(
10704 &mut self,
10705
10706 request: ::fidl_next::Request<buffer_collection_token_group::CreateChildrenSync, ___T>,
10707
10708 responder: ::fidl_next::Responder<buffer_collection_token_group::CreateChildrenSync, ___T>,
10709 ) -> impl ::core::future::Future<Output = ()>;
10710
10711 #[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"]
10712 fn all_children_present(&mut self) -> impl ::core::future::Future<Output = ()>;
10713
10714 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
10715 ::core::future::ready(())
10716 }
10717}
10718
10719impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for BufferCollectionTokenGroup
10720where
10721 ___H: BufferCollectionTokenGroupLocalServerHandler<___T> ,
10722 ___T: ::fidl_next::Transport,
10723
10724
10725
10726
10727
10728
10729 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
10730 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10731 Constraint = (),
10732 >,
10733
10734
10735
10736 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
10737 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10738 Constraint = (),
10739 >,
10740
10741
10742
10743 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
10744 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10745 Constraint = (),
10746 >,
10747
10748
10749
10750
10751
10752
10753
10754 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
10755 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10756 Constraint = (),
10757 >,
10758
10759
10760
10761
10762
10763
10764
10765 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
10766 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10767 Constraint = (),
10768 >,
10769
10770
10771
10772 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
10773 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10774 Constraint = (),
10775 >,
10776
10777
10778
10779 for<'de> crate::wire::BufferCollectionTokenGroupCreateChildRequest<'de>: ::fidl_next::Decode<
10780 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10781 Constraint = (),
10782 >,
10783
10784
10785
10786 for<'de> crate::wire::BufferCollectionTokenGroupCreateChildrenSyncRequest<'de>: ::fidl_next::Decode<
10787 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
10788 Constraint = (),
10789 >,
10790
10791
10792
10793
10794{
10795 async fn on_one_way(
10796 handler: &mut ___H,
10797 ordinal: u64,
10798 flexibility: ::fidl_next::protocol::Flexibility,
10799 body: ::fidl_next::Body<___T>,
10800 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
10801 match ordinal {
10802
10803
10804
10805
10806
10807
10808 7664192519607813318 => {
10809
10810 handler.release().await;
10811 Ok(())
10812
10813 }
10814
10815
10816
10817
10818 811194812442657257 => {
10819
10820 match ::fidl_next::AsDecoderExt::into_decoded(body) {
10821 Ok(decoded) => {
10822 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
10823 Ok(())
10824 }
10825 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10826 ordinal: 811194812442657257,
10827 error,
10828 }),
10829 }
10830
10831 }
10832
10833
10834
10835
10836 6691936816931379633 => {
10837
10838 match ::fidl_next::AsDecoderExt::into_decoded(body) {
10839 Ok(decoded) => {
10840 handler.set_debug_client_info(::fidl_next::Request::from_decoded(decoded)).await;
10841 Ok(())
10842 }
10843 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10844 ordinal: 6691936816931379633,
10845 error,
10846 }),
10847 }
10848
10849 }
10850
10851
10852
10853
10854 8172637980026734598 => {
10855
10856 match ::fidl_next::AsDecoderExt::into_decoded(body) {
10857 Ok(decoded) => {
10858 handler.set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded)).await;
10859 Ok(())
10860 }
10861 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10862 ordinal: 8172637980026734598,
10863 error,
10864 }),
10865 }
10866
10867 }
10868
10869
10870
10871
10872 5911475287294795693 => {
10873
10874 handler.set_verbose_logging().await;
10875 Ok(())
10876
10877 }
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891 2512233045884338145 => {
10892
10893 handler.set_weak().await;
10894 Ok(())
10895
10896 }
10897
10898
10899
10900
10901 4081474869151288297 => {
10902
10903 match ::fidl_next::AsDecoderExt::into_decoded(body) {
10904 Ok(decoded) => {
10905 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
10906 Ok(())
10907 }
10908 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10909 ordinal: 4081474869151288297,
10910 error,
10911 }),
10912 }
10913
10914 }
10915
10916
10917
10918
10919 4549465353676377516 => {
10920
10921 match ::fidl_next::AsDecoderExt::into_decoded(body) {
10922 Ok(decoded) => {
10923 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
10924 Ok(())
10925 }
10926 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10927 ordinal: 4549465353676377516,
10928 error,
10929 }),
10930 }
10931
10932 }
10933
10934
10935
10936
10937 4728787705853325509 => {
10938
10939 match ::fidl_next::AsDecoderExt::into_decoded(body) {
10940 Ok(decoded) => {
10941 handler.create_child(::fidl_next::Request::from_decoded(decoded)).await;
10942 Ok(())
10943 }
10944 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
10945 ordinal: 4728787705853325509,
10946 error,
10947 }),
10948 }
10949
10950 }
10951
10952
10953
10954
10955
10956
10957
10958 6643511257208525586 => {
10959
10960 handler.all_children_present().await;
10961 Ok(())
10962
10963 }
10964
10965
10966 ordinal => {
10967
10968 handler.on_unknown_interaction(ordinal).await;
10969 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
10970 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
10971 } else {
10972 Ok(())
10973 }
10974
10975 }
10976 }
10977 }
10978
10979 async fn on_two_way(
10980 handler: &mut ___H,
10981 ordinal: u64,
10982 flexibility: ::fidl_next::protocol::Flexibility,
10983 body: ::fidl_next::Body<___T>,
10984 responder: ::fidl_next::protocol::Responder<___T>,
10985 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
10986 match ordinal {
10987
10988
10989
10990 1273433845120064340 => {
10991 let responder = ::fidl_next::Responder::from_untyped(responder);
10992
10993 handler.sync(responder).await;
10994 Ok(())
10995
10996 }
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016 6574426773718429779 => {
11017 let responder = ::fidl_next::Responder::from_untyped(responder);
11018
11019 handler.get_node_ref(responder).await;
11020 Ok(())
11021
11022 }
11023
11024
11025
11026
11027 262772284282767397 => {
11028 let responder = ::fidl_next::Responder::from_untyped(responder);
11029
11030 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11031 Ok(decoded) => {
11032 handler.is_alternate_for(::fidl_next::Request::from_decoded(decoded), responder).await;
11033 Ok(())
11034 }
11035 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11036 ordinal: 262772284282767397,
11037 error,
11038 }),
11039 }
11040
11041 }
11042
11043
11044
11045
11046 8633851600235444876 => {
11047 let responder = ::fidl_next::Responder::from_untyped(responder);
11048
11049 handler.get_buffer_collection_id(responder).await;
11050 Ok(())
11051
11052 }
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069 1575877552079505162 => {
11070 let responder = ::fidl_next::Responder::from_untyped(responder);
11071
11072 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11073 Ok(decoded) => {
11074 handler.create_children_sync(::fidl_next::Request::from_decoded(decoded), responder).await;
11075 Ok(())
11076 }
11077 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11078 ordinal: 1575877552079505162,
11079 error,
11080 }),
11081 }
11082
11083 }
11084
11085
11086
11087
11088
11089 ordinal => {
11090
11091 handler.on_unknown_interaction(ordinal).await;
11092 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
11093 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
11094 } else {
11095 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
11096 ordinal,
11097 flexibility,
11098 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
11099 )
11100 .expect("encoding a framework error should never fail")
11101 .await?;
11102 Ok(())
11103 }
11104
11105 }
11106 }
11107 }
11108}
11109
11110pub trait BufferCollectionTokenGroupClientHandler<
11114 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
11115 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
11116>
11117{
11118 fn on_unknown_interaction(
11119 &mut self,
11120 ordinal: u64,
11121 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
11122 ::core::future::ready(())
11123 }
11124}
11125
11126impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for BufferCollectionTokenGroup
11127where
11128 ___H: BufferCollectionTokenGroupClientHandler<___T> + ::core::marker::Send,
11129 ___T: ::fidl_next::Transport,
11130{
11131 async fn on_event(
11132 handler: &mut ___H,
11133 ordinal: u64,
11134 flexibility: ::fidl_next::protocol::Flexibility,
11135 body: ::fidl_next::Body<___T>,
11136 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
11137 match ordinal {
11138 ordinal => {
11139 handler.on_unknown_interaction(ordinal).await;
11140 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
11141 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
11142 } else {
11143 Ok(())
11144 }
11145 }
11146 }
11147 }
11148}
11149
11150pub trait BufferCollectionTokenGroupServerHandler<
11154 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
11155 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
11156>
11157{
11158 #[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"]
11159 fn sync(
11160 &mut self,
11161
11162 responder: ::fidl_next::Responder<buffer_collection_token_group::Sync, ___T>,
11163 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11164
11165 #[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"]
11166 fn release(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11167
11168 #[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"]
11169 fn set_name(
11170 &mut self,
11171
11172 request: ::fidl_next::Request<buffer_collection_token_group::SetName, ___T>,
11173 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11174
11175 #[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"]
11176 fn set_debug_client_info(
11177 &mut self,
11178
11179 request: ::fidl_next::Request<buffer_collection_token_group::SetDebugClientInfo, ___T>,
11180 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11181
11182 #[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"]
11183 fn set_debug_timeout_log_deadline(
11184 &mut self,
11185
11186 request: ::fidl_next::Request<
11187 buffer_collection_token_group::SetDebugTimeoutLogDeadline,
11188 ___T,
11189 >,
11190 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11191
11192 #[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"]
11193 fn set_verbose_logging(
11194 &mut self,
11195 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11196
11197 #[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"]
11198 fn get_node_ref(
11199 &mut self,
11200
11201 responder: ::fidl_next::Responder<buffer_collection_token_group::GetNodeRef, ___T>,
11202 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11203
11204 #[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"]
11205 fn is_alternate_for(
11206 &mut self,
11207
11208 request: ::fidl_next::Request<buffer_collection_token_group::IsAlternateFor, ___T>,
11209
11210 responder: ::fidl_next::Responder<buffer_collection_token_group::IsAlternateFor, ___T>,
11211 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11212
11213 #[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"]
11214 fn get_buffer_collection_id(
11215 &mut self,
11216
11217 responder: ::fidl_next::Responder<
11218 buffer_collection_token_group::GetBufferCollectionId,
11219 ___T,
11220 >,
11221 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11222
11223 #[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"]
11224 fn set_weak(&mut self) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11225
11226 #[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"]
11227 fn set_weak_ok(
11228 &mut self,
11229
11230 request: ::fidl_next::Request<buffer_collection_token_group::SetWeakOk, ___T>,
11231 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11232
11233 #[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"]
11234 fn attach_node_tracking(
11235 &mut self,
11236
11237 request: ::fidl_next::Request<buffer_collection_token_group::AttachNodeTracking, ___T>,
11238 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11239
11240 #[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"]
11241 fn create_child(
11242 &mut self,
11243
11244 request: ::fidl_next::Request<buffer_collection_token_group::CreateChild, ___T>,
11245 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11246
11247 #[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"]
11248 fn create_children_sync(
11249 &mut self,
11250
11251 request: ::fidl_next::Request<buffer_collection_token_group::CreateChildrenSync, ___T>,
11252
11253 responder: ::fidl_next::Responder<buffer_collection_token_group::CreateChildrenSync, ___T>,
11254 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11255
11256 #[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"]
11257 fn all_children_present(
11258 &mut self,
11259 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
11260
11261 fn on_unknown_interaction(
11262 &mut self,
11263 ordinal: u64,
11264 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
11265 ::core::future::ready(())
11266 }
11267}
11268
11269impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for BufferCollectionTokenGroup
11270where
11271 ___H: BufferCollectionTokenGroupServerHandler<___T> + ::core::marker::Send,
11272 ___T: ::fidl_next::Transport,
11273
11274
11275
11276
11277
11278
11279 for<'de> crate::wire::NodeSetNameRequest<'de>: ::fidl_next::Decode<
11280 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11281 Constraint = (),
11282 >,
11283
11284
11285
11286 for<'de> crate::wire::NodeSetDebugClientInfoRequest<'de>: ::fidl_next::Decode<
11287 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11288 Constraint = (),
11289 >,
11290
11291
11292
11293 for<'de> crate::wire::NodeSetDebugTimeoutLogDeadlineRequest<'de>: ::fidl_next::Decode<
11294 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11295 Constraint = (),
11296 >,
11297
11298
11299
11300
11301
11302
11303
11304 for<'de> crate::wire::NodeIsAlternateForRequest<'de>: ::fidl_next::Decode<
11305 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11306 Constraint = (),
11307 >,
11308
11309
11310
11311
11312
11313
11314
11315 for<'de> crate::wire::NodeSetWeakOkRequest<'de>: ::fidl_next::Decode<
11316 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11317 Constraint = (),
11318 >,
11319
11320
11321
11322 for<'de> crate::wire::NodeAttachNodeTrackingRequest<'de>: ::fidl_next::Decode<
11323 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11324 Constraint = (),
11325 >,
11326
11327
11328
11329 for<'de> crate::wire::BufferCollectionTokenGroupCreateChildRequest<'de>: ::fidl_next::Decode<
11330 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11331 Constraint = (),
11332 >,
11333
11334
11335
11336 for<'de> crate::wire::BufferCollectionTokenGroupCreateChildrenSyncRequest<'de>: ::fidl_next::Decode<
11337 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
11338 Constraint = (),
11339 >,
11340
11341
11342
11343
11344{
11345 async fn on_one_way(
11346 handler: &mut ___H,
11347 ordinal: u64,
11348 flexibility: ::fidl_next::protocol::Flexibility,
11349 body: ::fidl_next::Body<___T>,
11350 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
11351 match ordinal {
11352
11353
11354
11355
11356
11357
11358 7664192519607813318 => {
11359
11360 handler.release().await;
11361 Ok(())
11362
11363 }
11364
11365
11366
11367
11368 811194812442657257 => {
11369
11370 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11371 Ok(decoded) => {
11372 handler.set_name(::fidl_next::Request::from_decoded(decoded)).await;
11373 Ok(())
11374 }
11375 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11376 ordinal: 811194812442657257,
11377 error,
11378 }),
11379 }
11380
11381 }
11382
11383
11384
11385
11386 6691936816931379633 => {
11387
11388 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11389 Ok(decoded) => {
11390 handler.set_debug_client_info(::fidl_next::Request::from_decoded(decoded)).await;
11391 Ok(())
11392 }
11393 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11394 ordinal: 6691936816931379633,
11395 error,
11396 }),
11397 }
11398
11399 }
11400
11401
11402
11403
11404 8172637980026734598 => {
11405
11406 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11407 Ok(decoded) => {
11408 handler.set_debug_timeout_log_deadline(::fidl_next::Request::from_decoded(decoded)).await;
11409 Ok(())
11410 }
11411 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11412 ordinal: 8172637980026734598,
11413 error,
11414 }),
11415 }
11416
11417 }
11418
11419
11420
11421
11422 5911475287294795693 => {
11423
11424 handler.set_verbose_logging().await;
11425 Ok(())
11426
11427 }
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441 2512233045884338145 => {
11442
11443 handler.set_weak().await;
11444 Ok(())
11445
11446 }
11447
11448
11449
11450
11451 4081474869151288297 => {
11452
11453 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11454 Ok(decoded) => {
11455 handler.set_weak_ok(::fidl_next::Request::from_decoded(decoded)).await;
11456 Ok(())
11457 }
11458 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11459 ordinal: 4081474869151288297,
11460 error,
11461 }),
11462 }
11463
11464 }
11465
11466
11467
11468
11469 4549465353676377516 => {
11470
11471 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11472 Ok(decoded) => {
11473 handler.attach_node_tracking(::fidl_next::Request::from_decoded(decoded)).await;
11474 Ok(())
11475 }
11476 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11477 ordinal: 4549465353676377516,
11478 error,
11479 }),
11480 }
11481
11482 }
11483
11484
11485
11486
11487 4728787705853325509 => {
11488
11489 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11490 Ok(decoded) => {
11491 handler.create_child(::fidl_next::Request::from_decoded(decoded)).await;
11492 Ok(())
11493 }
11494 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11495 ordinal: 4728787705853325509,
11496 error,
11497 }),
11498 }
11499
11500 }
11501
11502
11503
11504
11505
11506
11507
11508 6643511257208525586 => {
11509
11510 handler.all_children_present().await;
11511 Ok(())
11512
11513 }
11514
11515
11516 ordinal => {
11517
11518 handler.on_unknown_interaction(ordinal).await;
11519 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
11520 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
11521 } else {
11522 Ok(())
11523 }
11524
11525 }
11526 }
11527 }
11528
11529 async fn on_two_way(
11530 handler: &mut ___H,
11531 ordinal: u64,
11532 flexibility: ::fidl_next::protocol::Flexibility,
11533 body: ::fidl_next::Body<___T>,
11534 responder: ::fidl_next::protocol::Responder<___T>,
11535 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>> {
11536 match ordinal {
11537
11538
11539
11540 1273433845120064340 => {
11541 let responder = ::fidl_next::Responder::from_untyped(responder);
11542
11543 handler.sync(responder).await;
11544 Ok(())
11545
11546 }
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566 6574426773718429779 => {
11567 let responder = ::fidl_next::Responder::from_untyped(responder);
11568
11569 handler.get_node_ref(responder).await;
11570 Ok(())
11571
11572 }
11573
11574
11575
11576
11577 262772284282767397 => {
11578 let responder = ::fidl_next::Responder::from_untyped(responder);
11579
11580 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11581 Ok(decoded) => {
11582 handler.is_alternate_for(::fidl_next::Request::from_decoded(decoded), responder).await;
11583 Ok(())
11584 }
11585 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11586 ordinal: 262772284282767397,
11587 error,
11588 }),
11589 }
11590
11591 }
11592
11593
11594
11595
11596 8633851600235444876 => {
11597 let responder = ::fidl_next::Responder::from_untyped(responder);
11598
11599 handler.get_buffer_collection_id(responder).await;
11600 Ok(())
11601
11602 }
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619 1575877552079505162 => {
11620 let responder = ::fidl_next::Responder::from_untyped(responder);
11621
11622 match ::fidl_next::AsDecoderExt::into_decoded(body) {
11623 Ok(decoded) => {
11624 handler.create_children_sync(::fidl_next::Request::from_decoded(decoded), responder).await;
11625 Ok(())
11626 }
11627 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
11628 ordinal: 1575877552079505162,
11629 error,
11630 }),
11631 }
11632
11633 }
11634
11635
11636
11637
11638
11639 ordinal => {
11640
11641 handler.on_unknown_interaction(ordinal).await;
11642 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
11643 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
11644 } else {
11645 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
11646 ordinal,
11647 flexibility,
11648 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
11649 )
11650 .expect("encoding a framework error should never fail")
11651 .await?;
11652 Ok(())
11653 }
11654
11655 }
11656 }
11657 }
11658}
11659
11660impl<___T> BufferCollectionTokenGroupClientHandler<___T> for ::fidl_next::IgnoreEvents
11661where
11662 ___T: ::fidl_next::Transport,
11663{
11664 async fn on_unknown_interaction(&mut self, _: u64) {}
11665}
11666
11667impl<___H, ___T> BufferCollectionTokenGroupLocalClientHandler<___T> for ::fidl_next::Local<___H>
11668where
11669 ___H: BufferCollectionTokenGroupClientHandler<___T>,
11670 ___T: ::fidl_next::Transport,
11671{
11672 async fn on_unknown_interaction(&mut self, ordinal: u64) {
11673 ___H::on_unknown_interaction(&mut self.0, ordinal).await
11674 }
11675}
11676
11677impl<___H, ___T> BufferCollectionTokenGroupLocalServerHandler<___T> for ::fidl_next::Local<___H>
11678where
11679 ___H: BufferCollectionTokenGroupServerHandler<___T>,
11680 ___T: ::fidl_next::Transport,
11681{
11682 async fn sync(
11683 &mut self,
11684
11685 responder: ::fidl_next::Responder<buffer_collection_token_group::Sync, ___T>,
11686 ) {
11687 ___H::sync(&mut self.0, responder).await
11688 }
11689
11690 async fn release(&mut self) {
11691 ___H::release(&mut self.0).await
11692 }
11693
11694 async fn set_name(
11695 &mut self,
11696
11697 request: ::fidl_next::Request<buffer_collection_token_group::SetName, ___T>,
11698 ) {
11699 ___H::set_name(&mut self.0, request).await
11700 }
11701
11702 async fn set_debug_client_info(
11703 &mut self,
11704
11705 request: ::fidl_next::Request<buffer_collection_token_group::SetDebugClientInfo, ___T>,
11706 ) {
11707 ___H::set_debug_client_info(&mut self.0, request).await
11708 }
11709
11710 async fn set_debug_timeout_log_deadline(
11711 &mut self,
11712
11713 request: ::fidl_next::Request<
11714 buffer_collection_token_group::SetDebugTimeoutLogDeadline,
11715 ___T,
11716 >,
11717 ) {
11718 ___H::set_debug_timeout_log_deadline(&mut self.0, request).await
11719 }
11720
11721 async fn set_verbose_logging(&mut self) {
11722 ___H::set_verbose_logging(&mut self.0).await
11723 }
11724
11725 async fn get_node_ref(
11726 &mut self,
11727
11728 responder: ::fidl_next::Responder<buffer_collection_token_group::GetNodeRef, ___T>,
11729 ) {
11730 ___H::get_node_ref(&mut self.0, responder).await
11731 }
11732
11733 async fn is_alternate_for(
11734 &mut self,
11735
11736 request: ::fidl_next::Request<buffer_collection_token_group::IsAlternateFor, ___T>,
11737
11738 responder: ::fidl_next::Responder<buffer_collection_token_group::IsAlternateFor, ___T>,
11739 ) {
11740 ___H::is_alternate_for(&mut self.0, request, responder).await
11741 }
11742
11743 async fn get_buffer_collection_id(
11744 &mut self,
11745
11746 responder: ::fidl_next::Responder<
11747 buffer_collection_token_group::GetBufferCollectionId,
11748 ___T,
11749 >,
11750 ) {
11751 ___H::get_buffer_collection_id(&mut self.0, responder).await
11752 }
11753
11754 async fn set_weak(&mut self) {
11755 ___H::set_weak(&mut self.0).await
11756 }
11757
11758 async fn set_weak_ok(
11759 &mut self,
11760
11761 request: ::fidl_next::Request<buffer_collection_token_group::SetWeakOk, ___T>,
11762 ) {
11763 ___H::set_weak_ok(&mut self.0, request).await
11764 }
11765
11766 async fn attach_node_tracking(
11767 &mut self,
11768
11769 request: ::fidl_next::Request<buffer_collection_token_group::AttachNodeTracking, ___T>,
11770 ) {
11771 ___H::attach_node_tracking(&mut self.0, request).await
11772 }
11773
11774 async fn create_child(
11775 &mut self,
11776
11777 request: ::fidl_next::Request<buffer_collection_token_group::CreateChild, ___T>,
11778 ) {
11779 ___H::create_child(&mut self.0, request).await
11780 }
11781
11782 async fn create_children_sync(
11783 &mut self,
11784
11785 request: ::fidl_next::Request<buffer_collection_token_group::CreateChildrenSync, ___T>,
11786
11787 responder: ::fidl_next::Responder<buffer_collection_token_group::CreateChildrenSync, ___T>,
11788 ) {
11789 ___H::create_children_sync(&mut self.0, request, responder).await
11790 }
11791
11792 async fn all_children_present(&mut self) {
11793 ___H::all_children_present(&mut self.0).await
11794 }
11795
11796 async fn on_unknown_interaction(&mut self, ordinal: u64) {
11797 ___H::on_unknown_interaction(&mut self.0, ordinal).await
11798 }
11799}
11800
11801pub use fidl_next_common_fuchsia_sysmem2::*;