Clarify configuration

This commit is contained in:
Lee Bousfield 2021-02-03 21:51:54 -06:00
parent a34b2f621b
commit 4172b9e9da
2 changed files with 11 additions and 2 deletions

View File

@ -36,3 +36,12 @@ For more examples, see
[the src/tests directory](https://github.com/PlasmaPower/brute-force/tree/master/src/tests).
For documentation on the config or adaptors, see
[the docs](https://docs.rs/brute-force).
## Configuration
You can change the number of threads used with the environment variable
`BRUTE_FORCE_THREADS`.
Inside the program, via the Config struct, you can manually override the thread
count or change how often this library checks if a thread should stop. You can
also set a timeout via the `brute_force_with_timeout` function.

View File

@ -22,8 +22,8 @@ pub use traits::{Advance, Start};
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub struct Config {
/// Number of threads to use.
/// Falls back on `BRUTE_FORCE_THREADS`, or if that doesn't exist, the
/// number of logical CPU cores.
/// Falls back on the `BRUTE_FORCE_THREADS` environment variable, or if
/// that doesn't exist, the number of logical CPU cores.
pub threads: Option<usize>,
/// The number of iterations to perform between checking if the computation
/// is done (or timed out). Defaults to 512.