Trait linux_object::fs::FileLike
source · [−]pub trait FileLike: KernelObject {
fn flags(&self) -> OpenFlags;
fn set_flags(&self, f: OpenFlags) -> LxResult;
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
buf: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = LxResult<usize>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn write(&self, buf: &[u8]) -> LxResult<usize>;
fn read_at<'life0, 'life1, 'async_trait>(
&'life0 self,
offset: u64,
buf: &'life1 mut [u8]
) -> Pin<Box<dyn Future<Output = LxResult<usize>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn poll(&self, events: PollEvents) -> LxResult<PollStatus>;
fn async_poll<'life0, 'async_trait>(
&'life0 self,
events: PollEvents
) -> Pin<Box<dyn Future<Output = LxResult<PollStatus>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn dup(&self) -> Arc<dyn FileLike> { ... }
fn write_at(&self, _offset: u64, _buf: &[u8]) -> LxResult<usize> { ... }
fn ioctl(
&self,
_request: usize,
_arg1: usize,
_arg2: usize,
_arg3: usize
) -> LxResult<usize> { ... }
fn get_vmo(&self, _offset: usize, _len: usize) -> LxResult<Arc<VmObject>> { ... }
fn as_socket(&self) -> LxResult<&dyn Socket> { ... }
}
Expand description
Generic file interface
- Normal file, Directory
- Socket
- Epoll instance
Required Methods
read to buffer
read to buffer at given offset
fn poll(&self, events: PollEvents) -> LxResult<PollStatus>
fn poll(&self, events: PollEvents) -> LxResult<PollStatus>
wait for some event on a file descriptor
fn async_poll<'life0, 'async_trait>(
&'life0 self,
events: PollEvents
) -> Pin<Box<dyn Future<Output = LxResult<PollStatus>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn async_poll<'life0, 'async_trait>(
&'life0 self,
events: PollEvents
) -> Pin<Box<dyn Future<Output = LxResult<PollStatus>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
wait for some event on a file descriptor use async
Provided Methods
write from buffer at given offset
manipulates the underlying device parameters of special files
Returns the VmObject
representing the file with given offset
and len
.
Implementations
sourceimpl dyn FileLike
impl dyn FileLike
sourcepub fn is<__T: FileLike>(&self) -> bool
pub fn is<__T: FileLike>(&self) -> bool
Returns true if the trait object wraps an object of type __T
.
sourcepub fn downcast<__T: FileLike>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
pub fn downcast<__T: FileLike>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>
Returns a boxed object from a boxed trait object if the underlying object is of type
__T
. Returns the original boxed trait if it isn’t.
sourcepub fn downcast_rc<__T: FileLike>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
pub fn downcast_rc<__T: FileLike>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>
Returns an Rc
-ed object from an Rc
-ed trait object if the underlying object is of
type __T
. Returns the original Rc
-ed trait if it isn’t.
sourcepub fn downcast_ref<__T: FileLike>(&self) -> Option<&__T>
pub fn downcast_ref<__T: FileLike>(&self) -> Option<&__T>
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
sourcepub fn downcast_mut<__T: FileLike>(&mut self) -> Option<&mut __T>
pub fn downcast_mut<__T: FileLike>(&mut self) -> Option<&mut __T>
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.