proconio/lib.rs
1//! `proconio` crate
2//!
3//! ## Setup
4//!
5//! ```zsh
6//! % cargo add -F derive proconio
7//! ```
8//!
9//! ```toml
10//! # Cargo.toml
11//! proconio = { version = "=0.4.5", features = ["derive"] }
12//! ```
13//!
14//! ## `impl Readable`
15//!
16//! ```ignore
17//! use std::io::BufRead;
18//!
19//! use proconio::{
20//! fastout, input,
21//! marker::Usize1,
22//! source::{Readable, Source},
23//! };
24//!
25//! #[derive(Copy, Clone, Debug, Eq, PartialEq)]
26//! enum Query {
27//! Q1(usize, char),
28//! Q2(usize, usize),
29//! }
30//! use Query::{Q1, Q2};
31//!
32//! impl Readable for Query {
33//! type Output = Query;
34//! fn read<R: BufRead, S: Source<R>>(source: &mut S) -> Self::Output {
35//! match u32::read(source) {
36//! 1 => {
37//! input! {
38//! from source,
39//! x: Usize1,
40//! c: char,
41//! }
42//! Q1(x, c)
43//! }
44//! 2 => {
45//! input! {
46//! from source,
47//! l: Usize1,
48//! r: usize,
49//! }
50//! Q2(l, r)
51//! }
52//! _ => unreachable!(),
53//! }
54//! }
55//! }
56//!
57//! #[fastout]
58//! fn main() {
59//! input! {
60//!
61//! }
62//!
63//! unimplemented!()
64//! }
65//! ```