#[stable(feature = "rust1", since = "1.0.0")]
pub fn stdin() -> Stdin {
static INSTANCE: Lazy>>> = Lazy::new(stdin_init);
return Stdin {
inner: INSTANCE.get().expect("cannot access stdin during shutdown"),
};
fn stdin_init() -> Arc>>> {
let stdin = match stdin_raw() {
Ok(stdin) => Maybe::Real(stdin),
_ => Maybe::Fake
};
Arc::new(Mutex::new(BufReader::with_capacity(stdio::STDIN_BUF_SIZE, stdin)))
}
}
아직 synchronization 쪽은 보지도 못했는데 이 쪽으로 가면 type 이름 점점 산으로 가는 느낌
어제는 Ownership 봤는데, 에서 Cow, ToOwned, Borrow 이런 거 까다롭네요.
(수정) 디시 마크다운 지원해줫으면
코드 내용이 되게 옛날 자료로 공부하는 것 같은??
https://github.com/rust-lang/rust/blob/master/src/libstd/io/stdio.rs#L198
코드 자체는 std::io 코드입니다
그거 Rust 라이브러리 코드가 예전 v1.0.0 부터 유지보수된거라 좀 틀딱적인 부분이 남아있음. 타입 긴거는 ㅇㅈ
어떤 Trait가 요새 안 쓰는 Trait 인가요
저기 쓰인 Trait는 다 필수인 것 같은데