-
Notifications
You must be signed in to change notification settings - Fork 132
Closed
Description
To make a non-panicking collect, with the actual code I have to do something like
async fn query<T: FromRow, E: From<FromRowError> + From<Error>>(conn: &mut Conn, query: &str) -> Result<Vec<T>, E> {
conn.query_iter(query).await?
.try_collect::<T>().await?
.into_iter().collect::<Result<Vec<T>, E>>()
}
(this is only for example purposes, could contains errors)
This means allocating the entire resultset even if every single row is an error, or having to implement a wrapper to use next() as a Stream...
Wouldn't be possible, for example, to add an impl of futures_core::Stream that is the same used by tokio-stream and it seems to be a standard de-facto?
If you prefer, under a feature, so it wouldn't be default for everyone.
I can do the PR if you want
Metadata
Metadata
Assignees
Labels
No labels