Rust¶
organizeit2 provides a pure-Rust implementation of the core types and operations,
along with Python bindings via PyO3.
Crate structure¶
Crate path |
Purpose |
|---|---|
|
Pure Rust library ( |
|
PyO3 Python bindings (root |
Core types¶
File¶
Represents a file on the local filesystem.
use organizeit2::{File, PathLike};
let f = File::new("file:///tmp/data.csv");
assert_eq!(f.name(), "data.csv");
assert_eq!(f.suffix(), ".csv");
assert_eq!(f.stem(), "data");
Directory¶
Represents a directory on the local filesystem.
use organizeit2::{Directory, PathLike};
let d = Directory::new("file:///tmp/mydir");
for entry in d.ls() {
println!("{}", entry);
}
// Recursive file listing
let all_files = d.recurse();
Entry¶
An enum over File and Directory, returned by operations
that may yield either type (e.g. ls, resolve).
OrganizeIt¶
Entry-point helper that expands a directory path string.
use organizeit2::OrganizeIt;
let oi = OrganizeIt::new();
let d = oi.expand("/tmp/mydir");
Utility functions¶
Function |
Description |
|---|---|
|
Strip |
|
Add |
|
Python-compatible glob matching |
|
Parse + resolve → |
Python bindings¶
The compiled extension exposes Directory, File, OrganizeIt, and a
Path factory function with the same API as the pure-Python types.
from organizeit2 import Directory, File, OrganizeIt
d = Directory(path="/tmp/mydir")
for entry in d.ls():
print(entry)