You can't make it an actual library (Cargo will only build one library crate per package), but you could import it as a module into each binary. In both consumer/main.rs and producer/main.rs, add this:
#[path = "../common/lib.rs"]
mod common;
The main downside compared to a "real" library is that the code in common will be compiled twice (once for each binary).