Expand description
Std-like I/O macros and types for use in pros.
Implements println!
, eprintln!
and dbg!
on top of the pros_sys
crate without requiring
the use of an allocator. (Modified version of libc_print
crate)
Allows you to use these macros in a #![no_std] context, or in a situation where the traditional Rust streams might not be available (ie: at process shutdown time).
§Usage
Exactly as you’d use println!
, eprintln!
and dbg!
.
// Use the default ``-prefixed macros:
println!("Hello {}!", "stdout");
eprintln!("Hello {}!", "stderr");
let a = 2;
let b = dbg!(a * 2) + 1;
assert_eq!(b, 5);
Or you can import aliases to std
names:
use pros::io::{println, eprintln, dbg};
println!("Hello {}!", "stdout");
eprintln!("Hello {}!", "stderr");
let a = 2;
let b = dbg!(a * 2) + 1;
assert_eq!(b, 5);
Macros§
- Prints and returns the value of a given expression for quick and dirty debugging.
- Macro for printing to the standard error.
- Macro for printing to the standard error, with a newline.
- Macro for printing to the standard output.
- Macro for printing to the standard output, with a newline.
Structs§
- An iterator over
u8
values of a reader. - Adaptor to chain together two readers.
- A
Cursor
wraps an in-memory buffer and provides it with aSeek
implementation. - Reader adaptor which limits the bytes read from an underlying reader.
Enums§
- A list specifying general categories of I/O error.
- Enumeration of possible methods to seek within an I/O object.
Traits§
- A
BufRead
is a type ofRead
er which has an internal buffer, allowing it to perform extra ways of reading. - The
Read
trait allows for reading bytes from a source. - The
Seek
trait provides a cursor which can be moved within a stream of bytes. - A trait for objects which are byte-oriented sinks.
Type Aliases§
- A specialized
Result
type for I/O operations.