hyper's new async API allows me to send my HTTP response via a futures::Stream<Item = Chunk, Error = hyper::Error>, where Chunk can be anything that satisfies 'static + Send + AsRef<[u8]>. I'd like my Chunk type to be something like ARef<[u8]>.
This would let me (among other things) use mmaped memory without extra copies, trim the beginning and end of a Vec<u8> before passing it along, etc. More motivation here. I talked about owning_ref there, but I think ARef is even better because I don't have to wrap it in an enum.
The problem is that ARef<[u8]> isn't Send. Maybe there should be a parallel type that is?
hyper's new async API allows me to send my HTTP response via a
futures::Stream<Item = Chunk, Error = hyper::Error>
, whereChunk
can be anything that satisfies'static + Send + AsRef<[u8]>
. I'd like myChunk
type to be something likeARef<[u8]>
.This would let me (among other things) use mmaped memory without extra copies, trim the beginning and end of a
Vec<u8>
before passing it along, etc. More motivation here. I talked aboutowning_ref
there, but I thinkARef
is even better because I don't have to wrap it in an enum.The problem is that
ARef<[u8]>
isn'tSend
. Maybe there should be a parallel type that is?