Skip to content

Warp #39

Answered by SergioBenitez
ronanyeah asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, but it's not clear to me from warp's sparse documentation how to do so efficiently and correctly. The gist is that you need to convert the impl Buf (note that Buf is a trait, not a concrete type) into something that implements Into<Bytes>. Here are some ideas:

  • Map the stream into a stream of Bytes using copy_to_bytes on the impl Buf.
  • Use the bytes filter instead of stream.
  • The use form filter instead of multer.

All of these do much more copying and allocating than one would hope, but it's not clear to be that warp allows anything better.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ronanyeah
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants