mirror of https://github.com/fafhrd91/actix-net
assert
This commit is contained in:
parent
3702fe3c05
commit
c937619a81
|
@ -74,10 +74,8 @@ impl ServerBuilder {
|
||||||
/// By default server uses number of available logical cpu as workers
|
/// By default server uses number of available logical cpu as workers
|
||||||
/// count. Explicitly setting 0 will also default.
|
/// count. Explicitly setting 0 will also default.
|
||||||
pub fn workers(mut self, num: usize) -> Self {
|
pub fn workers(mut self, num: usize) -> Self {
|
||||||
self.threads = match num {
|
assert_ne!(num 0, "workers must be greater than 0");
|
||||||
0 => num_cpus::get(),
|
self.threads = num;
|
||||||
_ => num,
|
|
||||||
};
|
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue