Skip to content

Feature request: .tuples() #971

@WhyNotHugo

Description

@WhyNotHugo

I see tuples() listed in Probably applicable but did not yet open issues

I'd find this very useful. I'm re-encoding images from LE-XRBG to BE-RGB:

    let mmap: memmap2::Mmap = ...
    let mut image_data = vec![0u8; mmap.len() * 3 / 4];
    mmap.iter()
        .tuples()
        .zip(image_data.iter_mut().tuples())
        .for_each(|((b, g, r, _), (r2, g2, b2))| (*r2, *g2, *b2) = (*r, *g, *b));

This can clearly be parallelised quite a bit, but I don't see any obvious way of writing it without tuples().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions