`GenericClient` is not implemented for `T: tokio_postgres::GenericClient`
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
調査の方向性
Find the code that generates the GenericClient trait and its implementations; the issue does not name the file or tests. Compare the generated implementations with the proposed blanket implementation for T: tokio_postgres::GenericClient + Sync, and check whether the trait needs a Send bound. Done means generated code supports generic clients and the shown generic function compiles.
索引モデルが issue の本文から書いたものです。
説明
Migrated from halcyonnouveau/clorinde#117, originally reported by @TimDiekmann on 2025-06-10.
The generated code generates a new trait GenericClient. This is basically a copy of tokio_postgres::GenericClient, however, it's not the same trait.
The trait is implemented on tokio_postgres::Client and tokio_postgres::Transaction, but not on a generic T: tokio_postgres::GenericClient. This means in a generic context
async fn takes_client(client: &impl GenericClient) {
// do something with `clorinde::GenericClient`
}
this will error.
If this code snippet would be generated instead, everything would work as expected:
impl<C: tokio_postgres::GenericClient + Sync> GenericClient for C {
async fn prepare(&self, query: &str) -> Result<Statement, Error> {
tokio_postgres::GenericClient::prepare(self, query).await
}
async fn execute<T>(
&self,
query: &T,
params: &[&(dyn tokio_postgres::types::ToSql + Sync)],
) -> Result<u64, Error>
where
T: ?Sized + tokio_postgres::ToStatement + Sync + Send,
{
tokio_postgres::GenericClient::execute(self, query, params).await
}
async fn query_one<T>(
&self,
statement: &T,
params: &[&(dyn tokio_postgres::types::ToSql + Sync)],
) -> Result<tokio_postgres::Row, Error>
where
T: ?Sized + tokio_postgres::ToStatement + Sync + Send,
{
tokio_postgres::GenericClient::query_one(self, statement, params).await
}
async fn query_opt<T>(
&self,
statement: &T,
params: &[&(dyn tokio_postgres::types::ToSql + Sync)],
) -> Result<Option<tokio_postgres::Row>, Error>
where
T: ?Sized + tokio_postgres::ToStatement + Sync + Send,
{
tokio_postgres::GenericClient::query_opt(self, statement, params).await
}
async fn query<T>(
&self,
query: &T,
params: &[&(dyn tokio_postgres::types::ToSql + Sync)],
) -> Result<Vec<tokio_postgres::Row>, Error>
where
T: ?Sized + tokio_postgres::ToStatement + Sync + Send,
{
tokio_postgres::GenericClient::query(self, query, params).await
}
async fn query_raw<T, I>(&self, statement: &T, params: I) -> Result<RowStream, Error>
where
T: ?Sized + ToStatement + Sync + Send,
I: IntoIterator + Sync + Send,
I::IntoIter: ExactSizeIterator,
I::Item: BorrowToSql,
{
tokio_postgres::GenericClient::query_raw(self, statement, params).await
}
}
Btw, the GenericClient does not need the Send bound:
pub trait GenericClient: Sync {
- 主要言語
- Rust
- スター
- 1.2k
- フォーク
- 77
- 平均マージ
- 5日 12時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cornucopia-rs/cornucopia のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
cornucopia-rs/cornucopia#334 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
cornucopia-rs/cornucopia#333 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
cornucopia-rs/cornucopia#330 · コメント 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
cornucopia-rs/cornucopia#309 · コメント 2 件 ·
-
configuration feature
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
cornucopia-rs/cornucopia#292 ·
cornucopia-rs/cornucopia の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
RustCrypto/utils#1597 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
max-sixty/worktrunk#4727 · コメント 7 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
follow-up
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
carrick-sh/carrick#1859 ·
メンテナーはふだん 1 日以内に返信