Are you looking to do this conditional at runtime (i.e. change the flow of execution based on something's value) or compile time (change execution based on things when you compiled the code)?
For the former, you are probably looking for the Control Flow chapter from The Rust Programming Language (sometimes just called The Book).
The latter is more advanced and typically used to make things cross-platform (i.e. you may change a method based on whether it's Linux/Windows or x86-64/arm). The Forms of conditional compilation chapter from The Rust Reference does a pretty good job of explaining how it can be used.