No `traits` in `num`

I'm working seriously with generics for the first time, numerical generics to be precise.
I'm trying to import std::num::traits as the documentation instructs, but when I simply add a use statement for it in a default cargo project's main.rs i get this error:

error[E0432]: unresolved import `std::num::traits`
 --> src/main.rs:1:5
  |
1 | use std::num::traits;
  |     ^^^^^^^^^^^^^^^^ no `traits` in `num`

For more information about this error, try `rustc --explain E0432`.

What could be causing this problem?
Thanks for the attention

Which documentation, since there indeed is no std::num::traits (check here)?
On the other hand, there is a num_traits crate with all the numeric traits you want.

3 Likes

Since docs.rs is currently offline, I accidentally treated this page as part of the official docs. Thanks for spotting the error

This is a documentation for the num crate (and it's not clear for which version, exactly), not for the standard library.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.