Struct cros_async::sys::unix::poll_source::PollSource
source · pub struct PollSource<F>(RegisteredSource<F>);
Expand description
Async wrapper for an IO source that uses the FD executor to drive async operations.
Tuple Fields§
§0: 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 fallocate(
&self,
file_offset: u64,
len: u64,
mode: AllocateMode
) -> AsyncResult<()>
pub async fn fallocate(
&self,
file_offset: u64,
len: u64,
mode: AllocateMode
) -> AsyncResult<()>
See fallocate(2)
for details.
sourcepub async fn fsync(&self) -> AsyncResult<()>
pub async fn fsync(&self) -> AsyncResult<()>
Sync all completed write operations to the backing storage.
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.