fidl_fuchsia_pkg_ext

Function serve_fidl_iterator_from_slice

Source
pub async fn serve_fidl_iterator_from_slice<I>(
    fidl_iterator: I,
    items: impl AsMut<[<I::Responder as FidlIteratorNextResponder>::Item]>,
) -> Result<()>
where I: FidlIteratorRequestStream,
Expand description

Serves fidl iterators like:

protocol PayloadIterator { Next() -> (vector:MAX payloads); };

from: fidl_iterator: effectively a stream of PayloadIterator::Next requests items: a slice of Payloads.

Fills each response to Next() with as many entries as will fit in a fidl message. The returned future completes after Next() yields an empty response or the iterator is interrupted (client closes the channel or the task encounters a FIDL layer error).

To use with a new protocol (e.g. PayloadIterator), in this crate:

  1. implement FidlIteratorRequestStream for PayloadIteratorRequestStream
  2. implement FidlIteratorNextResponder for PayloadIteratorNextResponder
  3. implement Measurable for Payload using functions generated by //tools/fidl/measure-tape