I've created a small Github repo that mimics exactly what I'm trying to achieve: streaming file uploads to both file systems and the cloud (S3) using axum
(and reqwest
).
I can change all the code you see. There is no restriction. All signatures were invented by me who are in my early days with the awesome Rust.
If you want I can also eliminate reqwest
, as long as I understand what to use instead!
Can you help me understand how to fix the only error left?
error[E0521]: borrowed data escapes outside of associated function
--> src\adapter_s3.rs:56:19
|
41 | async fn put_file<'a>(
| -- lifetime `'a` defined here
42 | &'a self,
| -------- `self` is a reference that is only valid in the associated function body
...
56 | .body(reqwest::Body::wrap_stream(ReaderStream::new(reader)))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| `self` escapes the associated function body here
| argument requires that `'a` must outlive `'static`
@semicoleon, this is the project of the older question.