I don't believe there was any way for you know in this case, other than looking at the source code and knowing that std::os::unix cannot be used on Windows. It's something the crate maintainer should've (in my opinion at least) documented clearly.
As for the second question, that's something I was interested in as well, so I went ahead and tried rodio.
fn main() {
let device = rodio::default_output_device().unwrap();
let sink = rodio::Sink::new(&device);
sink.set_volume(0.1); // the default is pretty loud...
let source = rodio::source::SineWave::new(256);
sink.append(source); //beep!
// the audio is played (forever, in this case) on a background thread, so we need to sleep to not end main too early
std::thread::sleep(std::time::Duration::from_secs(1));
}
If you want to try running this, I recommend doing a release build, as I sometimes got crackling at the start in debug builds. You can also construct the data being played yourself, but unfortunately I'm clueless when it comes to audio and don't know how to get meaningful audio out that way.