cloudflare / cloudflare/quiche

tokio_quiche: Unable to use a custom `BufFactory`

Open
#2,236 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
11.8k
Forks
1.1k
Avg merge
21h 9m
Merged PRs (30d)
6

Description

Hey folks, I'm building a async friendly API using [Bytes](https://docs.rs/bytes/latest/bytes/struct.Bytes.html). I implemented `quiche::BufFactory` for it via a wrapper. A `bytes` feature would be nice to avoid this wrapper, but that's a separate request.

However, I don't think it's possible to use because [ApplicationOverQuic](https://docs.rs/tokio-quiche/latest/tokio_quiche/trait.ApplicationOverQuic.html) is not generic over `F: BufFactory`. The `quinn::Connection` passed to the trait (aliased as `tokio_quiche::QuinnConnection`) uses the default `DefaultBufFactory`. Or `tokio_quiche::buf_factory::BufFactory` with the `zero-copy` feature.

I'd like to use [stream_send_zc](https://docs.rs/quiche/latest/quiche/struct.Connection.html#method.stream_send_zc) with `Bytes` to avoid the copy. I imagine the `zero-copy` feature exists for a reason and there's probably some weird Rust quirk preventing generic zero-copy support, but I just wanted to ask anyway.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.