Rust devcontainer definition for VS Code Remote - Containers extension to easily develop locally in the same environment used by the CodeRunner.
If you're not familiar with devcontainers, see Developing inside a Container.
Open this project in a devcontainer with VS Code Remote - Containers extension.
Put your solution and tests in src/lib.rs
:
fn add(a: i32, b: i32) -> i32 {
a + b
}
// -------------------- 8< --------------------
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_example() {
assert_eq!(add(1, 1), 2);
}
}
Then run cargo test
. If the kata uses preloaded code, create lib/preloaded.rs
.
Only rust-analyzer
and Better TOML
are installed.
To install more extensions in the devcontainer, configure default extensions in your VS Code settings:
"remote.containers.defaultExtensions": [
"usernamehw.errorlens",
],