Skip to content

Conversation

@theelderbeever
Copy link

@theelderbeever theelderbeever commented Apr 1, 2024

Adds a simple function ClientConfig.set_if that wraps ClientConfig.set to allow for passing values that are options. This is helpful for configuring clients dynamically via config files that may or may not have values set.

// Such a value could be read from a config file if the user wanted to set it otherwise, it would read in as `None`.
let sasl_mechanism = Some("PLAINTEXT");

let config = ClientConfig::new()
    .set_if(
        "sasl.mechanism", sasl_mechanism,
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant