Checking if a program exists in $PATH

Hello. I want to check whether a program exists in the $PATH without actually executing it, or printing its output in the console. Currently I'm using

pub fn inxi_exists() -> bool {

This prints the output of inxi to stdout which is not desirable.

This stackoverflow answer seems to be what you're looking for.
There is also the which crate.