seanmonstar / num_cpus

Get the number of CPUs in Rust
Apache License 2.0
582 stars 91 forks source link

Returning `NonZeroUsize` #105

Closed daxpedda closed 3 years ago

daxpedda commented 3 years ago

Glancing over the code I noticed that get and get_physical always returns at least 1, this isn't documented anywhere as far as I looked. My proposition would be returning NonZeroUsize instead of usize.

But I believe at least this should be documented.

seanmonstar commented 3 years ago

Changing the return type is a breaking change, and probably low value (see #43 for another example). Documenting seems fine, though!

daxpedda commented 3 years ago

Understandable. So what is the policy on this, do we keep this issue open for re-evaluation on v2 or close it?

In any case, #106 is ready.

seanmonstar commented 3 years ago

I'd probably close. I think that a v2 of num_cpus isn't the end of the world and could be done, but I'd probably hope to see a researched proposal of the changes to make and why for each.