worm-blossom / ufotofu

Abstractions for lazily consuming and producing sequences in Rust.
Apache License 2.0
3 stars 1 forks source link

Add async traits, implementations and fuzzers #9

Closed mycognosist closed 5 months ago

mycognosist commented 5 months ago
AljoschaMeyer commented 5 months ago

You can simply write a wrapper around a sync::Consumer that implements local_nb::Consumer. And then implement most consumers by wrapping the sync versions in that wrapper. Much fewer lines of code, and a nice utility for all users of the crate as well.

Analogous for producers as well, of course.

SyncToLocalNbConsumer and SyncToLocalNbProducer are not the greatest names, but not the worst either.

AljoschaMeyer commented 5 months ago

(There's little else for me to review, those wrappers would get around all that copypasted code that I'm now skipping over.)

AljoschaMeyer commented 5 months ago

The pipe functions don't need separate error types for sync, nb, and local, nb. Those should all use the same type, unless I'm missing something.

AljoschaMeyer commented 5 months ago

All looking good so far.

mycognosist commented 5 months ago

@AljoschaMeyer Any changes or additions you'd like to see here before merging?

I can do the consume_all() helpers in a separate PR.

AljoschaMeyer commented 5 months ago

Looks good.