pub struct Path { /* private fields */ }Expand description
Concrete path - includes filesystem operations
Implementations§
Source§impl Path
impl Path
Sourcepub fn cwd() -> Result<Path, PyException>
pub fn cwd() -> Result<Path, PyException>
Current working directory
Sourcepub fn home() -> Result<Path, PyException>
pub fn home() -> Result<Path, PyException>
Home directory
Sourcepub fn absolute(&self) -> Result<Path, PyException>
pub fn absolute(&self) -> Result<Path, PyException>
Get absolute path
Sourcepub fn resolve(&self) -> Result<Path, PyException>
pub fn resolve(&self) -> Result<Path, PyException>
Resolve path (follow symlinks)
Sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Check if path is symlink
Sourcepub fn stat(&self) -> Result<FileStats, PyException>
pub fn stat(&self) -> Result<FileStats, PyException>
Get file statistics
Sourcepub fn rmdir(&self) -> Result<(), PyException>
pub fn rmdir(&self) -> Result<(), PyException>
Remove directory
Sourcepub fn write_text<S: AsRef<str>>(&self, data: S) -> Result<(), PyException>
pub fn write_text<S: AsRef<str>>(&self, data: S) -> Result<(), PyException>
Write text file
Sourcepub fn read_bytes(&self) -> Result<Vec<u8>, PyException>
pub fn read_bytes(&self) -> Result<Vec<u8>, PyException>
Read bytes
Sourcepub fn write_bytes(&self, data: &[u8]) -> Result<(), PyException>
pub fn write_bytes(&self, data: &[u8]) -> Result<(), PyException>
Write bytes
Methods from Deref<Target = PurePath>§
Sourcepub fn match_pattern(&self, pattern: &str) -> bool
pub fn match_pattern(&self, pattern: &str) -> bool
Check if path matches pattern
Sourcepub fn relative_to(&self, other: &PurePath) -> Result<PurePath, PyException>
pub fn relative_to(&self, other: &PurePath) -> Result<PurePath, PyException>
Get relative path to other
Sourcepub fn is_absolute(&self) -> bool
pub fn is_absolute(&self) -> bool
Check if path is absolute
Sourcepub fn is_relative(&self) -> bool
pub fn is_relative(&self) -> bool
Check if path is relative
Sourcepub fn with_suffix<S: AsRef<str>>(&self, suffix: S) -> PurePath
pub fn with_suffix<S: AsRef<str>>(&self, suffix: S) -> PurePath
Replace suffix
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more