Is there a configuration file method of specifying +beta?

I'm writing a book with Rust examples. All example code will have to be written for Rust 2024, since that is what the reader will be using.

There are no differences to the language that I need to worry about for the next 20 days. However, I need to provide screenshots and downloadable code as I write the book. The cargo.toml files need to specify Rust 2024. I can do that by using the beta branch,

However, then I need to build the project using cargo +beta. That is visible in the screenshots.

Is there any way to put the +beta flag in a configuration file (preferably) or an environment variable?

I've looked in the cargo book and I can't see anything there. But it has a huge number of configuration options and I could easily have missed the right one if the wording wasn't obvious.

If I can't do this, then obviously I can muddle through for the next three weeks, modifying files to look right and then changing them back to build, but I'd rather not.

you can use a toolchain file:

https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file

Perfect. Thanks.