Skip to content

impl encode & decode for HashSet<E> where you can encode [E] #787

Open
@Twister915

Description

@Twister915

Desired behavior:

fn do_something(
    pool: PgPool,
    except: HashSet<String>,
) -> impl TryStream<Ok = sqlx::postgres::PgRow, Error = sqlx::Error> {
    sqlx::query(
        "SELECT c0.target_id AS id FROM connections c0 \
        WHERE NOT c0.target_id = ANY($1)",
    )
    .bind(except)
    .fetch(&pool)
}

Problem:

The Decode, Encode, and Type trait is not implemented for the HashSet collection, even though [E] in this case (String) could be encoded or decoded.

It should be possible to implement these interfaces for all iterable types, so perhaps that should be done instead (wherever impl IntoIter)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions