Public
Authored by Thomas Citharel

Rust lifetime issue

I'm trying to send chuncks of files through WebDAV using https://github.com/voider1/hyperdav and https://github.com/remram44/cdchunking-rs#from-a-file-object-streaming-chunks-with-zero-allocation. Files can be quite huge that's why I'm using a direct stream method here.

However, the chunk_iterator variable on line 6 does not live long enough because of the call to client.put(), which has the following signature:

pub fn put<R>(&self, body: R, path: impl AsRef<Path>) -> Result<()>
    where
        R: Read + Send + 'static,

chunk_path is computed through a function that returns a String.

Cargo.toml :

...
[dependencies]
hyperdav = { git = "https://github.com/voider1/hyperdav" }
cdchunking = "0.2.1"

Username, Password and Endpoint are fetched from another Config module (either through clap or a config file).

Any help would be quite appreciated. :)

Edited
variable_lifetime.rs 1.16 KB
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment