adamchalmers / adamchalmers/axum-reqwest

Extract

Offen
#1 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
6
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello Adam, thank you for your great blog, it has been really useful.
As a follow-up, how do you think i can now extract from the MultipartStream

- file_name
- content_type

when i start extracting content before the stream macro i get an error of

`cannot return value referencing local data self.0 `

```
impl MultipartStream {
pub async fn into_stream(
mut self,
) -> impl Stream> {
let field = self.0.next_field().await.unwrap().unwrap();
let file_name = field.file_name().unwrap().to_string();
let content_type = field.content_type().unwrap().to_string();
async_stream::stream! {
for await value in field {
yield value;
}
}
}
}
```

the idea was to return those values as a struct or tuple.

What i can see is that the file_name needs to be retrieved outside of the async_stream::stream! as those attribute are needed before actually streaming.

Thank you!!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.