Skip to content

Commit

Permalink
Require that config builders return values be used.
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored and BiagioFesta committed Oct 7, 2023
1 parent 2f9054a commit 668e928
Showing 1 changed file with 4 additions and 0 deletions.
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

0 comments on commit 668e928

Please sign in to comment.