pub struct FileDescriptorTable { /* private fields */ }Expand description
File descriptor table for managing open file descriptors
Implementations§
Source§impl FileDescriptorTable
impl FileDescriptorTable
Sourcepub fn open_fd(
&mut self,
fd_num: i32,
path: &str,
read: bool,
write: bool,
append: bool,
truncate: bool,
create_new: bool,
) -> Result<(), String>
pub fn open_fd( &mut self, fd_num: i32, path: &str, read: bool, write: bool, append: bool, truncate: bool, create_new: bool, ) -> Result<(), String>
Open a file and assign it to a file descriptor number
§Arguments
fd_num- The file descriptor number (0-9)path- Path to the file to openread- Whether to open for readingwrite- Whether to open for writingappend- Whether to open in append modetruncate- Whether to truncate the file
§Returns
Ok(())on successErr(String)with error message on failure
Sourcepub fn deep_clone(&self) -> Result<Self, String>
pub fn deep_clone(&self) -> Result<Self, String>
Create a deep copy of the file descriptor table This duplicates all open file descriptors so they are independent of the original table
Sourcepub fn save_all_fds(&mut self) -> Result<(), String>
pub fn save_all_fds(&mut self) -> Result<(), String>
Save all currently open file descriptors
§Returns
Ok(())on successErr(String)with error message on failure
Sourcepub fn restore_all_fds(&mut self) -> Result<(), String>
pub fn restore_all_fds(&mut self) -> Result<(), String>
Restore all previously saved file descriptors
§Returns
Ok(())on successErr(String)with error message on failure
Sourcepub fn get_raw_fd(&self, fd_num: i32) -> Option<RawFd>
pub fn get_raw_fd(&self, fd_num: i32) -> Option<RawFd>
Trait Implementations§
Source§impl Debug for FileDescriptorTable
impl Debug for FileDescriptorTable
Auto Trait Implementations§
impl Freeze for FileDescriptorTable
impl RefUnwindSafe for FileDescriptorTable
impl Send for FileDescriptorTable
impl Sync for FileDescriptorTable
impl Unpin for FileDescriptorTable
impl UnwindSafe for FileDescriptorTable
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