Crate layered_io

Source
Expand description

I/O traits extending std::io::Read and std::io::Write.

Structs§

LayeredDuplexer
Adapts an Read + Write to implement HalfDuplexLayered.
LayeredReader
Adapts an Read to implement ReadLayered.
LayeredWriter
Adapts a std::io::Write to implement WriteLayered.
SliceReader
Adapts an &[u8] to implement ReadLayered.

Enums§

Activity
For interactivity, it’s desirable to avoid buffering data which is complete enough to be actionable. Activity allows writers to notify the API at points when the data provided is actionable and buffers should be flushed to the reader.
Status
What is known about a stream in the future.

Traits§

Bufferable
A trait to help with buffering on top of ReadLayered and WriteLayered.
HalfDuplexLayered
A trait which simply combines ReadLayered, WriteLayered, and HalfDuplex.
ReadLayered
An extension of Read, with read_with_status and read_vectored_with_status which return status information and zero is not special-cased. It also allows streams to specify a minimum_buffer_size.
WriteLayered
An extension of std::io::Write, but adds a close function to allow the stream to be closed and any outstanding errors to be reported, without requiring a sync_all.

Functions§

default_is_read_vectored
Default implementation of Read::is_read_vectored accompanying [default_read_vectored_with_status].
default_is_write_vectored
Default implementation of Write::is_write_vectored accompanying default_write_vectored.
default_read
Default implementation of Read::read in terms of ReadLayered::read_with_status.
default_read_exact_using_status
Default implementation of ReadLayered::read_exact_using_status in terms of ReadLayered::read_with_status.
default_read_to_end
Default implementation of Read::read_to_end in terms of ReadLayered::read_with_status.
default_read_to_string
Default implementation of Read::read_to_string in terms of Read::read_to_end.
default_read_vectored
Default implementation of Read::read_vectored in terms of ReadLayered::read_vectored_with_status.
default_suggested_buffer_size
Default implementation of Bufferable::abandon, which does nothing.
default_write_all
Default implementation of Write::write_all, in terms of Write::write.
default_write_all_vectored
Default implementation of Write::write_all_vectored, in terms of Write::write_vectored.
default_write_vectored
Default implementation of Write::write_vectored, in terms of Write::write.
to_std_io_read_result
Translate from read_with_status’s return value with independent size and status to a std::io::Read::read return value where 0 is special-cased to mean end-of-stream, an io::ErrorKind::Interrupted error is used to indicate a zero-length read, and pushes are not reported.