pub struct OpenFile { /* private fields */ }Expand description
Represents a POSIX file description, or a Linux struct file.
An OpenFile wraps a reference to a File. Once there are no more OpenFile objects for a
given File, the File will be closed. Typically this means that holding an OpenFile will
ensure that the file remains open (the file’s status will not become FileState::CLOSED), but
the underlying file may close itself in extenuating circumstances (for example if the file has
an internal error).
Warning: If an OpenFile for a specific file already exists, it is an error to create a new
OpenFile for that file. You must clone the existing OpenFile object. A new OpenFile object
should probably only ever be created for a newly created file object. Otherwise for existing
file objects, it won’t be clear if there are already-existing OpenFile objects for that file.
There must also not be any existing mutable borrows of the file when an OpenFile is created.
Implementations§
Source§impl OpenFile
 
impl OpenFile
pub fn new(file: File) -> Self
pub fn inner_file(&self) -> &File
Sourcepub fn close(
    self,
    cb_queue: &mut CallbackQueue,
) -> Option<Result<(), SyscallError>>
 
pub fn close( self, cb_queue: &mut CallbackQueue, ) -> Option<Result<(), SyscallError>>
Will close the inner File object if this is the last OpenFile for that File. This
behaviour is the same as simply dropping this OpenFile object, but allows you to pass an
event queue and get the return value of the close operation.
Trait Implementations§
impl IsSend for OpenFile
impl IsSync for OpenFile
Auto Trait Implementations§
impl Freeze for OpenFile
impl !RefUnwindSafe for OpenFile
impl Send for OpenFile
impl Sync for OpenFile
impl Unpin for OpenFile
impl !UnwindSafe for OpenFile
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more