Struct cros_async::sys::linux::poll_source::PollSource    
source · pub struct PollSource<F> {
    registered_source: RegisteredSource<F>,
}Expand description
Async wrapper for an IO source that uses the FD executor to drive async operations.
Fields§
§registered_source: RegisteredSource<F>Implementations§
source§impl<F: AsRawDescriptor> PollSource<F>
 
impl<F: AsRawDescriptor> PollSource<F>
sourcepub fn new(f: F, ex: &Arc<RawExecutor<EpollReactor>>) -> Result<Self>
 
pub fn new(f: F, ex: &Arc<RawExecutor<EpollReactor>>) -> Result<Self>
Create a new PollSource from the given IO source.
source§impl<F: AsRawDescriptor> PollSource<F>
 
impl<F: AsRawDescriptor> PollSource<F>
sourcepub async fn read_to_vec(
    &self,
    file_offset: Option<u64>,
    vec: Vec<u8>,
) -> AsyncResult<(usize, Vec<u8>)>
 
pub async fn read_to_vec( &self, file_offset: Option<u64>, vec: Vec<u8>, ) -> AsyncResult<(usize, Vec<u8>)>
Reads from the iosource at file_offset and fill the given vec.
sourcepub async fn read_to_mem(
    &self,
    file_offset: Option<u64>,
    mem: Arc<dyn BackingMemory + Send + Sync>,
    mem_offsets: impl IntoIterator<Item = MemRegion>,
) -> AsyncResult<usize>
 
pub async fn read_to_mem( &self, file_offset: Option<u64>, mem: Arc<dyn BackingMemory + Send + Sync>, mem_offsets: impl IntoIterator<Item = MemRegion>, ) -> AsyncResult<usize>
Reads to the given mem at the given offsets from the file starting at file_offset.
sourcepub async fn wait_readable(&self) -> AsyncResult<()>
 
pub async fn wait_readable(&self) -> AsyncResult<()>
Wait for the FD of self to be readable.
sourcepub async fn write_from_vec(
    &self,
    file_offset: Option<u64>,
    vec: Vec<u8>,
) -> AsyncResult<(usize, Vec<u8>)>
 
pub async fn write_from_vec( &self, file_offset: Option<u64>, vec: Vec<u8>, ) -> AsyncResult<(usize, Vec<u8>)>
Writes from the given vec to the file starting at file_offset.
sourcepub async fn write_from_mem(
    &self,
    file_offset: Option<u64>,
    mem: Arc<dyn BackingMemory + Send + Sync>,
    mem_offsets: impl IntoIterator<Item = MemRegion>,
) -> AsyncResult<usize>
 
pub async fn write_from_mem( &self, file_offset: Option<u64>, mem: Arc<dyn BackingMemory + Send + Sync>, mem_offsets: impl IntoIterator<Item = MemRegion>, ) -> AsyncResult<usize>
Writes from the given mem from the given offsets to the file starting at file_offset.
sourcepub async fn fsync(&self) -> AsyncResult<()>
 
pub async fn fsync(&self) -> AsyncResult<()>
§Safety
Sync all completed write operations to the backing storage.
sourcepub async fn punch_hole(&self, file_offset: u64, len: u64) -> AsyncResult<()>
 
pub async fn punch_hole(&self, file_offset: u64, len: u64) -> AsyncResult<()>
punch_hole
sourcepub async fn write_zeroes_at(
    &self,
    file_offset: u64,
    len: u64,
) -> AsyncResult<()>
 
pub async fn write_zeroes_at( &self, file_offset: u64, len: u64, ) -> AsyncResult<()>
write_zeroes_at
sourcepub async fn fdatasync(&self) -> AsyncResult<()>
 
pub async fn fdatasync(&self) -> AsyncResult<()>
Sync all data of completed write operations to the backing storage, avoiding updating extra metadata.
sourcepub fn into_source(self) -> F
 
pub fn into_source(self) -> F
Yields the underlying IO source.
sourcepub fn as_source_mut(&mut self) -> &mut F
 
pub fn as_source_mut(&mut self) -> &mut F
Provides a mutable ref to the underlying IO source.
Auto Trait Implementations§
impl<F> Freeze for PollSource<F>where
    F: Freeze,
impl<F> RefUnwindSafe for PollSource<F>where
    F: RefUnwindSafe,
impl<F> Send for PollSource<F>where
    F: Send,
impl<F> Sync for PollSource<F>where
    F: Sync,
impl<F> Unpin for PollSource<F>where
    F: Unpin,
impl<F> UnwindSafe for PollSource<F>where
    F: UnwindSafe,
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