I'm trying to implement a PUT
request that transmits some bits to a web service:
extern crate reqwest;
fn put(buf: &[u8]) {
let v = Vec::from(buf);
let body = ::reqwest::Body::from(v);
// execute the request
}
Is there a way to avoid the memory copy (which, if I understand correctly, occurs when constructing the vector) when constructing the Body
?
I'm potentially sending large buffers and I'd prefer to avoid unnecessary copies (even if they're negligible compared to the network IO)