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