Skip to main content

rust_crate

Function rust_crate 

Source
pub fn rust_crate(root: &Path, name: &str, version: &str) -> Result<()>
Expand description

Convenience: build a minimal Rust crate layout under root.

Creates Cargo.toml and src/lib.rs. Returns the relative paths of the files written.

ยงExample

use dev_fixtures::tree::rust_crate;
let dir = tempfile::tempdir().unwrap();
rust_crate(dir.path(), "sample", "0.1.0").unwrap();
assert!(dir.path().join("Cargo.toml").exists());
assert!(dir.path().join("src/lib.rs").exists());