The io
module contains basic input and output routines.
A quick summary:
Reader
and Writer
traitsThese traits define the minimal set of methods that anything that can do input and output should implement.
ReaderUtil
and WriterUtil
traitsRicher methods that allow you to do more. Reader
only lets you read a certain
number of bytes into a buffer, while ReaderUtil
allows you to read a whole
line, for example.
Generally, these richer methods are probably the ones you want to actually use in day-to-day Rust.
Furthermore, because there is an implementation of ReaderUtil
for
<T: Reader>
, when your input or output code implements Reader
, you get
all of these methods for free.
print
and println
These very useful functions are defined here. You generally don't need to import them, though, as the prelude already does.
stdin
, stdout
, and stderr
These functions return references to the classic three file descriptors. They
implement Reader
and Writer
, where appropriate.
fsync |
BytesReader | |
BytesWriter | |
FILERes | |
FdRes |
FileFlag | |
SeekStyle | The SeekStyle enum describes the relationship between the position
we'd like to seek to from our current position. It's used as an argument
to the |
WriterType |
Reader | The core Reader trait. All readers must implement this trait. |
ReaderUtil | The |
Writer | The raw underlying writer trait. All writers must implement this. |
WriterUtil | Generic utility functions defined on writers. |
FILE_reader | |
FILE_writer | |
buffered_file_writer | |
fd_writer | |
file_reader | |
file_writer | |
mk_file_writer | |
Prints a string to standard output. |
|
println | Prints a string to standard output, followed by a newline. |
read_whole_file | |
read_whole_file_str | |
seek_in_buf | |
stderr | Gives a |
stdin | Gives a |
stdout | Gives a |
u64_from_be_bytes | |
u64_to_be_bytes | |
u64_to_le_bytes | |
with_bytes_reader | |
with_bytes_writer | |
with_str_reader | |
with_str_writer |
fd_t |
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).