1#![allow(non_camel_case_types)]
2
3use std::{
4 fmt::Display,
5 io::stdin,
6 ops::{Shl, Shr},
7 str::FromStr,
8};
9
10pub mod views;
11
12pub struct cout;
22
23impl<T> Shl<T> for cout
24where
25 T: Display,
26{
27 type Output = Self;
28 fn shl(self, rhs: T) -> Self::Output {
29 print!("{rhs}");
30 self
31 }
32}
33
34pub struct endl;
35
36impl Display for endl {
37 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38 writeln!(f)
39 }
40}
41
42pub struct cin;
43
44impl<T> Shr<&mut T> for cin
45where
46 T: FromStr,
47{
48 type Output = Result<(), T::Err>;
49
50 fn shr(self, rhs: &mut T) -> Self::Output {
51 let mut input = String::new();
52 stdin().read_line(&mut input).unwrap();
53 *rhs = input.trim().parse()?;
54 Ok(())
55 }
56}