Skip to main content

Host

Trait Host 

Source
pub trait Host: Send {
    // Required method
    fn read_via_stream(
        &mut self,
    ) -> impl Future<Output = Result<(StreamReader<u8>, FutureReader<Result<(), ErrorCode>>)>> + Send;
}

Required Methods§

Source

fn read_via_stream( &mut self, ) -> impl Future<Output = Result<(StreamReader<u8>, FutureReader<Result<(), ErrorCode>>)>> + Send

Return a stream for reading from stdin.

This function returns a stream which provides data read from stdin, and a future to signal read results.

If the stream’s readable end is dropped the future will resolve to success.

If the stream’s writable end is dropped the future will either resolve to success if stdin was closed by the writer or to an error-code if reading failed for some other reason.

Multiple streams may be active at the same time. The behavior of concurrent reads is implementation-specific.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<_T: Host + ?Sized + Send> Host for &mut _T

Source§

fn read_via_stream( &mut self, ) -> impl Future<Output = Result<(StreamReader<u8>, FutureReader<Result<(), ErrorCode>>)>> + Send

Return a stream for reading from stdin.

This function returns a stream which provides data read from stdin, and a future to signal read results.

If the stream’s readable end is dropped the future will resolve to success.

If the stream’s writable end is dropped the future will either resolve to success if stdin was closed by the writer or to an error-code if reading failed for some other reason.

Multiple streams may be active at the same time. The behavior of concurrent reads is implementation-specific.

Implementors§