Struct conch_runtime::env::ThreadPoolAsyncIoEnv [−][src]
pub struct ThreadPoolAsyncIoEnv { /* fields omitted */ }An AsyncIoEnvironment implementation that uses a threadpool for doing
reads and writes on synchronous/blocking FileDesc handles.
This is a pretty costly implementation which may be required on systems that do not support asynchronous read/write operations (easily or at all). If running on a system that supports more efficient async operations, it is strongly encouraged to use an alternative implementation.
Note: Caller should ensure that any
FileDeschandles passed into this environment are not configured for asynchronous operations, otherwise operations will fail with aWouldBlockerror. This is done to avoid burning CPU cycles while spinning on read/write operations.
Methods
impl ThreadPoolAsyncIoEnv[src]
impl ThreadPoolAsyncIoEnvpub fn new(size: usize) -> Self[src]
pub fn new(size: usize) -> SelfCreates a new thread pool with size worker threads associated with it.
pub fn new_num_cpus() -> Self[src]
pub fn new_num_cpus() -> SelfCreates a new thread pool with a number of workers equal to the number of CPUs on the host.
Trait Implementations
impl Clone for ThreadPoolAsyncIoEnv[src]
impl Clone for ThreadPoolAsyncIoEnvfn clone(&self) -> ThreadPoolAsyncIoEnv[src]
fn clone(&self) -> ThreadPoolAsyncIoEnvReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl SubEnvironment for ThreadPoolAsyncIoEnv[src]
impl SubEnvironment for ThreadPoolAsyncIoEnvfn sub_env(&self) -> Self[src]
fn sub_env(&self) -> SelfCreate a new sub-environment, which starts out idential to its parent, but any changes on the new environment will not be reflected on the parent. Read more
impl Debug for ThreadPoolAsyncIoEnv[src]
impl Debug for ThreadPoolAsyncIoEnvfn fmt(&self, fmt: &mut Formatter) -> Result[src]
fn fmt(&self, fmt: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl AsyncIoEnvironment for ThreadPoolAsyncIoEnv[src]
impl AsyncIoEnvironment for ThreadPoolAsyncIoEnvtype Read = ReadAsync
An async/futures-aware Read adapter around a FileDesc.
type WriteAll = CpuFuture<(), IoError>
An future that represents writing data into a FileDesc.
fn read_async(&mut self, fd: FileDesc) -> Self::Read[src]
fn read_async(&mut self, fd: FileDesc) -> Self::ReadCreates a futures-aware adapter to read data from a FileDesc asynchronously.
fn write_all(&mut self, fd: FileDesc, data: Vec<u8>) -> Self::WriteAll[src]
fn write_all(&mut self, fd: FileDesc, data: Vec<u8>) -> Self::WriteAllCreates a future for writing data into a FileDesc.
fn write_all_best_effort(&mut self, fd: FileDesc, data: Vec<u8>)[src]
fn write_all_best_effort(&mut self, fd: FileDesc, data: Vec<u8>)Asynchronously write the contents of data to a FileDesc in the background on a best effort basis (e.g. the implementation can give up due to any (appropriately) unforceen errors like broken pipes). Read more
Auto Trait Implementations
impl Send for ThreadPoolAsyncIoEnv
impl Send for ThreadPoolAsyncIoEnvimpl Sync for ThreadPoolAsyncIoEnv
impl Sync for ThreadPoolAsyncIoEnv