schveiguy / iopipe

D language library for modular io
Boost Software License 1.0
77 stars 6 forks source link

Draft: RangeOfSlices Devices #41

Closed Inkrementator closed 1 year ago

Inkrementator commented 1 year ago

A device constructed from a range of slices. It is compatible with request's streaming api.

For me, easy use with network streaming was a killer feauture of jsoniopipe, afaik all other dlang json libraries either only support line seperated json for streaming or have some other quirks. std_data_json in particular requires the input data to be a forward range, which would be a hassle to implement.

If you are interested in including this, I'll clean the code up and template the element type. I also have unittests but they would need to be adapted to be used with the default unittest runner.

schveiguy commented 1 year ago

Oh nice! I've been meaning to provide a range adapter for iopipe.

I'm thinking this can be even more generic. Any range of any type will do. You can use std.algorithm.copy and then if you have a range of slices, you can use joiner to provide a compatible interface.

Give me a few days, I think I can make something similar that has more genericity.

schveiguy commented 1 year ago

@Inkrementator can you take a look at #42 and see if this works for your case?

schveiguy commented 1 year ago

Superseded by #42