pub struct VirtualFileSystem { /* private fields */ }Expand description
Virtual filesystem manager for lessons
Implementations§
Source§impl VirtualFileSystem
impl VirtualFileSystem
Sourcepub fn new(lesson_id: &str, session_id: &str) -> Result<Self>
pub fn new(lesson_id: &str, session_id: &str) -> Result<Self>
Create a new virtual filesystem for a lesson
Sourcepub fn resolve_path(&self, virtual_path: &str) -> PathBuf
pub fn resolve_path(&self, virtual_path: &str) -> PathBuf
Get the real filesystem path for a virtual path
Sourcepub fn get_current_dir(&self) -> &Path
pub fn get_current_dir(&self) -> &Path
Get current directory (virtual path)
Sourcepub fn get_current_dir_real(&self) -> PathBuf
pub fn get_current_dir_real(&self) -> PathBuf
Get current directory (real filesystem path)
Sourcepub fn change_directory(&mut self, path: &str) -> Result<String>
pub fn change_directory(&mut self, path: &str) -> Result<String>
Change directory (returns new virtual path)
Sourcepub fn list_directory(&self, path: Option<&str>) -> Result<Vec<DirEntry>>
pub fn list_directory(&self, path: Option<&str>) -> Result<Vec<DirEntry>>
List directory contents
Sourcepub fn create_directory(&self, path: &str, parents: bool) -> Result<()>
pub fn create_directory(&self, path: &str, parents: bool) -> Result<()>
Create directory (mkdir command)
Sourcepub fn touch_file(&self, path: &str) -> Result<()>
pub fn touch_file(&self, path: &str) -> Result<()>
Create or update file (touch command)
Sourcepub fn remove(&self, path: &str, recursive: bool, force: bool) -> Result<()>
pub fn remove(&self, path: &str, recursive: bool, force: bool) -> Result<()>
Remove file or directory (rm command)
Sourcepub fn move_item(&self, source: &str, destination: &str) -> Result<()>
pub fn move_item(&self, source: &str, destination: &str) -> Result<()>
Move or rename file/directory (mv command)
Sourcepub fn copy(
&self,
source: &str,
destination: &str,
recursive: bool,
) -> Result<()>
pub fn copy( &self, source: &str, destination: &str, recursive: bool, ) -> Result<()>
Copy file or directory (cp command)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VirtualFileSystem
impl RefUnwindSafe for VirtualFileSystem
impl Send for VirtualFileSystem
impl Sync for VirtualFileSystem
impl Unpin for VirtualFileSystem
impl UnwindSafe for VirtualFileSystem
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