Function inspect::iter_by_index
source · pub fn iter_by_index<I, V>(
iter: impl IntoIterator<IntoIter = I>,
) -> Iterated<Enumerate<I>>
Expand description
Wraps an iterator for inspection, using the index in the enumeration as the field name.
§Example
fn inspect(req: inspect::Request<'_>) {
let v = vec!["foo", "bar", "baz"];
// Responds with { 0: "foo", 1: "bar", 2: "baz" }.
req.respond().field("v", inspect::iter_by_index(&v));
}