New to the Rust language. My first crack at this is to write a program to read an EXT4 inode. Found this crate, ext4 crate, but I don't know how to import it with "use" exactly. "use ext4;" doesn't work as do "use io::ext4", "use std::ext4", etc. I installed the crate successfully with "cargo install ext4".
This is a basic question of understanding how Cargo nests its crates.
My code block that fails:
use ext4;
fn main() {
let mut superblock = SuperBlock::new(&mut part_reader).unwrap();
let target_inode_number = superblock.resolve_path("/etc/passwd").unwrap().inode;
let inode = superblock.load_inode(target_inode_number).unwrap();
let passwd_reader = superblock.open(&nice_node).unwrap();
}
Compilation output:
rwalk@walkubu2:~/git/rust_inode$ rustc rust_inode.rs
error[E0432]: unresolved import `ext4`
--> rust_inode.rs:2:5
|
2 | use ext4;
| ^^^^ no `ext4` in the root
error[E0433]: failed to resolve: use of undeclared type `SuperBlock`
--> rust_inode.rs:5:26
|
5 | let mut superblock = SuperBlock::new(&mut part_reader).unwrap();
| ^^^^^^^^^^ use of undeclared type `SuperBlock`
error[E0425]: cannot find value `part_reader` in this scope
--> rust_inode.rs:5:47
|
5 | let mut superblock = SuperBlock::new(&mut part_reader).unwrap();
| ^^^^^^^^^^^ not found in this scope
error[E0425]: cannot find value `nice_node` in this scope
--> rust_inode.rs:8:42
|
8 | let passwd_reader = superblock.open(&nice_node).unwrap();
| ^^^^^^^^^ not found in this scope
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0425, E0432, E0433.
For more information about an error, try `rustc --explain E0425`.
(venv_watiba) rwalk@walkubu2:~/git/rust_inode$