Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require that config builders return values be used. #75

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wtransport/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ impl ServerConfig {
/// .with_bind_default(4433)
/// .with_certificate(Certificate::load("cert.pem", "key.pem").unwrap());
/// ```
#[must_use]
pub struct ServerConfigBuilder<State>(State);

impl ServerConfigBuilder<WantsBindAddress> {
Expand Down Expand Up @@ -293,6 +294,7 @@ impl ServerConfigBuilder<WantsCertificate> {

impl ServerConfigBuilder<WantsTransportConfigServer> {
/// Completes configuration process.
#[must_use]
pub fn build(self) -> ServerConfig {
let mut quic_config = QuicServerConfig::with_crypto(Arc::new(self.0.tls_config));
quic_config.transport_config(Arc::new(self.0.transport_config));
Expand Down Expand Up @@ -479,6 +481,7 @@ impl Default for ClientConfig {
/// # use wtransport::ClientConfig;
/// let config = ClientConfig::builder().with_bind_default();
/// ```
#[must_use]
pub struct ClientConfigBuilder<State>(State);

impl ClientConfigBuilder<WantsBindAddress> {
Expand Down Expand Up @@ -598,6 +601,7 @@ impl ClientConfigBuilder<WantsRootStore> {

impl ClientConfigBuilder<WantsTransportConfigClient> {
/// Completes configuration process.
#[must_use]
pub fn build(self) -> ClientConfig {
let mut quic_config = QuicClientConfig::new(Arc::new(self.0.tls_config));
quic_config.transport_config(Arc::new(self.0.transport_config));
Expand Down
Loading