-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove 'static lifetime for add() argument #48
Comments
Sorry for the late response. I think this might be a requirement for hyper. See this related issue: ferristseng/rust-multipart-rfc7578#4 |
The |
I believe this lifetime is a restriction of Actix/Hyper (example: https://docs.rs/hyper/0.14.16/hyper/struct.Body.html#method.wrap_stream). What exactly are you trying to do? |
Added an example of how to do this: https://github.com/ferristseng/rust-ipfs-api/blob/35d282f4cfb2cf083abff5efa60c3c916f1d13fa/ipfs-api-examples/examples/add_file_piped_from_command.rs |
Thanks for following up! I'm not sure how you're able to call |
Reviving this: I'm trying to In the optimal case I don't want to read all of this into memory and then re-add it. Best case scenario would be to plumb the output of The slightly-worse-but-probably-works-for-now solution is to read all of it into memory and then add it, something like this: let cat_resp = client
.cat(cid)
.map_ok(|chunk| chunk.to_vec())
.try_concat()
.await
.context("unable to cat file")?;
let sha1_resp = client.add_async_with_options(cat_resp.as_slice(),opts).await?; But that does not work:
Edit: Looking a bit, I don't think the impl<'a> Form<'a> {
pub fn add_async_reader<F, R>(&mut self, name: F, read: R)
where
F: Display,
R: 'a + AsyncRead + Send + Sync + Unpin,
{
// ...
}
// ...
} Edit2: It does work with |
When using
add
, AFAIK the data I pass in has to be moved into the method because the argument requires a 'static lifetime.This makes the following impossible:
What I want to do:
please correct me if I'm wrong, but with a 'static lifetime I think there's no way to do this.
The text was updated successfully, but these errors were encountered: