Open Elcoid opened 8 months ago
Hi. I don't really think it's a good idea to increase the API surface. Why don't you use OptsBuilder::pool_opts
?
Hello,
Initially I searched for pool_min
and pool_max
in the sources, but the only thing I found was OptsBuilder::from_hash_map
. That's why I thought an extra method would be good. However I just tried your suggestion and it works well (thanks for the idea). So I think my PR can be dismissed.
Here is what I ended up with, in case anyone else has the same problem as me:
let opts = OptsBuilder::new()
/* [...] */
.pool_opts(
PoolOpts::default()
.with_constraints(PoolConstraints::new(my_min, my_max).expect("Min is bigger than max!"))
);
Hello,
I added a method to
OptsBuilder
that setspool_min
andpool_max
directly. This way, they can be set without having to instantiate a hashmap, then pass it tofrom_hash_map
, then parse the strings in the map as integers. The method sets the two at the same time to ensure thatpool_min <= pool_max
(using aPoolConstraints
).