pub trait StrPathExt {
// Required methods
fn expand_tilde(&self) -> PathBuf;
fn is_safe_path(&self) -> bool;
fn validate_safety(&self) -> Result<()>;
fn file_name_str(&self) -> String;
}Expand description
Extension trait that adds path-related methods to str.
Provides ergonomic access to tilde expansion and path safety checks:
use vtcode_commons::paths::StrPathExt;
let expanded = "~/projects/vtcode".expand_tilde();
assert!(StrPathExt::is_safe_path("src/main.rs"));Required Methods§
Sourcefn expand_tilde(&self) -> PathBuf
fn expand_tilde(&self) -> PathBuf
Expand a leading ~ or ~/ to the user’s home directory.
Sourcefn is_safe_path(&self) -> bool
fn is_safe_path(&self) -> bool
Check if this path string is a safe relative path (no traversal, no absolute).
Sourcefn validate_safety(&self) -> Result<()>
fn validate_safety(&self) -> Result<()>
Validate that this path is safe to use (no traversal, no dangerous characters).
Sourcefn file_name_str(&self) -> String
fn file_name_str(&self) -> String
Extract the filename from this path string.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".