pub struct FileHandle { /* private fields */ }Expand description
Record for a file somewhere on the file system, along with channels for reading file data and sending read requests to the MBFS kernel.
Implementations§
Source§impl FileHandle
impl FileHandle
Sourcepub fn read(&mut self) -> Result<Vec<u8>>
pub fn read(&mut self) -> Result<Vec<u8>>
Sends a read request to the file reader.
§Returns
Ok(Vec<u8>)- A chunk of file data.Err(Error)- Error when reading file.
§Examples
let file_reader = Arc::new(Mutex::new(MessageBasedFileSystem::new()));
/* Spawn thread to run mbfs */
let file = file_reader.lock().unwrap().open("/test/file.txt".to_owned());
let vec = file.read()?;Auto Trait Implementations§
impl Freeze for FileHandle
impl RefUnwindSafe for FileHandle
impl Send for FileHandle
impl Sync for FileHandle
impl Unpin for FileHandle
impl UnwindSafe for FileHandle
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