edgedb-rust icon indicating copy to clipboard operation
edgedb-rust copied to clipboard

Iterator serialization support

Open jprochazk opened this issue 3 years ago • 3 comments

This would offer greater flexibilty for serializing any array-like construct. For example, it would remove the need for intermediate allocations when transforming data before serializing it.

jprochazk avatar Jul 29 '22 17:07 jprochazk

Unfortunately I don't think Rust coherence rules will allow that for QueryArg. But we may implement a derive with a flag, something like this:

#[derive(QueryArgs)]
struct MyArgs<'a> {
  #[query_arg(array_like)]
  queued_items: &'a Queue<String>,
}

tailhook avatar Aug 01 '22 13:08 tailhook

Hello, by the way, do you have an example for

use edgedb_protocol::query_arg::QueryArgs;

#[derive(QueryArgs)]
struct MusicInput {
    pub artist: String
}

cannot find derive macro QueryArgs in this scope Or do I have to implement it myself ? but how do you encode each field?

Thank you!

AdrienPensart avatar Aug 02 '22 03:08 AdrienPensart

Yes, we don't have that derive macro yet. It's in the to do list.

tailhook avatar Aug 04 '22 10:08 tailhook