[−][src]Struct finch::platform::linux::FileSystem
A basic model of the Linux Filesystem
Methods
impl FileSystem
[src]
pub fn new(base_path: Option<PathBuf>) -> Result<FileSystem>
[src]
Create a new model of the Linux Filesystem.
The filedescriptors 0, 1, and 2 are initialized to files named:
/stdin
, /stdout
, and /stderr
respectively.
If given an optional path, then this path will be used to look for files when opening files.
pub fn fd_mut(&mut self, fd: usize) -> Option<&mut FileDescriptor>
[src]
Get a mutable reference to a FileDescriptor
if it exists.
pub fn fd_seek(
&mut self,
fd: usize,
offset: isize,
seek: Whence
) -> Result<usize>
[src]
&mut self,
fd: usize,
offset: isize,
seek: Whence
) -> Result<usize>
Seek a file descriptor, according to the whence and offset.
pub fn fd_valid(&self, fd: usize) -> bool
[src]
Returns true if the file descriptor exists.
pub fn open(&mut self, path: &str) -> Result<Option<usize>>
[src]
Attempt to open a file and read it into the filesystem model. Returns a file descriptor if the file exists, or None.
pub fn create(&mut self, path: &str) -> Result<usize>
[src]
Open a file, or create it if it does not exist. Returns file descriptor.
pub fn exists(&self, path: &str) -> bool
[src]
Return true if a file exists, false otherwise
pub fn zeroize(&mut self, path: &str)
[src]
Zeroize the data in a file
pub fn file_bytes(&self, path: &str) -> Option<&[Expression]>
[src]
Get data from a file
pub fn file_bytes_mut(&mut self, path: &str) -> Option<&mut Vec<Expression>>
[src]
Get a mutable reference to the data for a file
pub fn fd_bytes(&self, fd: usize) -> Option<&[Expression]>
[src]
Get the bytes to a file pointed to by a file descriptor
pub fn close_fd(&mut self, fd: usize) -> bool
[src]
Close a file descriptor. Returns true if file descriptor existed, false otherwise
pub fn read_fd(
&mut self,
fd: usize,
length: usize
) -> Result<Option<Vec<Expression>>>
[src]
&mut self,
fd: usize,
length: usize
) -> Result<Option<Vec<Expression>>>
Read from a file descriptor
pub fn write_fd(&mut self, fd: usize, data: Vec<Expression>) -> Result<()>
[src]
Write to a file descriptor
pub fn size_fd(&self, fd: usize) -> Option<usize>
[src]
Get size of file pointed to by file descriptor
pub fn write(
&mut self,
path: &str,
write_data: Vec<Expression>,
offset: usize
) -> Result<()>
[src]
&mut self,
path: &str,
write_data: Vec<Expression>,
offset: usize
) -> Result<()>
Write data into a file at an offset
Trait Implementations
impl Clone for FileSystem
[src]
fn clone(&self) -> FileSystem
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for FileSystem
[src]
impl<'de> Deserialize<'de> for FileSystem
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for FileSystem
[src]
impl PartialEq<FileSystem> for FileSystem
[src]
fn eq(&self, other: &FileSystem) -> bool
[src]
fn ne(&self, other: &FileSystem) -> bool
[src]
impl Serialize for FileSystem
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for FileSystem
[src]
impl StructuralPartialEq for FileSystem
[src]
Auto Trait Implementations
impl !RefUnwindSafe for FileSystem
impl !Send for FileSystem
impl !Sync for FileSystem
impl Unpin for FileSystem
impl UnwindSafe for FileSystem
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,