cloudflare / cloudflare/quiche

Why is `DefaultBufFactory` private? (prevents generic use of `quiche::Connection<F>`)

Open
#2,323 0 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

I have a question about the visibility of `DefaultBufFactory` and whether this is an intentional design choice.

I would like to create a generic data structure around `quiche::Connection` so that it can work with either a custom `BufFactory` or the default one. For example:

struct ConnectionMap(HashMap>);

This works fine with a custom implementation:

ConnectionMap::::new();

However, because `DefaultBufFactory` is private, I can’t instantiate the same structure using the default buffer factory:

ConnectionMap::::new(); // not possible

As a workaround, I can define two separate types:

struct ConnectionMapWithBufFactory(HashMap>);
struct ConnectionMapWithoutBufFactory(HashMap);

But this quickly propagates to other structs and forces duplication or additional abstraction such as:

trait ConnectionMapWithOrWithoutBufFactory {}
impl ConnectionMapWithOrWithoutBufFactory for ConnectionMapWithBufFactory {}
impl ConnectionMapWithOrWithoutBufFactory for ConnectionMapWithoutBufFactory {}

struct Endpoint { ... }

Should `DefaultBufFactory` be public?

Contributor guide

Open the contributing guide

Research direction

Start by locating the definition and visibility of `DefaultBufFactory`, then inspect how `quiche::Connection` exposes its buffer-factory type. Compare the public API implications of exposing the default type with the custom `BufFactory` usage described in the issue. Done means reaching and documenting a maintainer-approved decision about whether the default factory should be public.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.