/// handles is **not** available to raw handles returned from this function.
///
/// The returned handle has no external synchronization or buffering.
-fn stdin_raw() -> io::Result<StdinRaw> {
- stdio::Stdin::new().map(StdinRaw)
+fn stdin_raw() -> StdinRaw {
+ StdinRaw(stdio::Stdin::new())
}
/// Constructs a new raw handle to the standard output stream of this process.
///
/// The returned handle has no external synchronization or buffering layered on
/// top.
-fn stdout_raw() -> io::Result<StdoutRaw> {
- stdio::Stdout::new().map(StdoutRaw)
+fn stdout_raw() -> StdoutRaw {
+ StdoutRaw(stdio::Stdout::new())
}
/// Constructs a new raw handle to the standard error stream of this process.
///
/// The returned handle has no external synchronization or buffering layered on
/// top.
-fn stderr_raw() -> io::Result<StderrRaw> {
- stdio::Stderr::new().map(StderrRaw)
+fn stderr_raw() -> StderrRaw {
+ StderrRaw(stdio::Stderr::new())
}
impl Read for StdinRaw {
fn stdin_init() -> Arc<Mutex<BufReader<Maybe<StdinRaw>>>> {
// This must not reentrantly access `INSTANCE`
- let stdin = match stdin_raw() {
- Ok(stdin) => Maybe::Real(stdin),
- _ => Maybe::Fake,
- };
-
+ let stdin = Maybe::Real(stdin_raw());
Arc::new(Mutex::new(BufReader::with_capacity(stdio::STDIN_BUF_SIZE, stdin)))
}
}
fn stdout_init() -> Arc<ReentrantMutex<RefCell<LineWriter<Maybe<StdoutRaw>>>>> {
// This must not reentrantly access `INSTANCE`
- let stdout = match stdout_raw() {
- Ok(stdout) => Maybe::Real(stdout),
- _ => Maybe::Fake,
- };
+ let stdout = Maybe::Real(stdout_raw());
unsafe {
let ret = Arc::new(ReentrantMutex::new(RefCell::new(LineWriter::new(stdout))));
ret.init();
static INIT: Once = Once::new();
INIT.call_once(|| unsafe {
INSTANCE.init();
- if let Ok(stderr) = stderr_raw() {
- *INSTANCE.lock().borrow_mut() = Maybe::Real(stderr);
- }
+ let stderr = stderr_raw();
+ *INSTANCE.lock().borrow_mut() = Maybe::Real(stderr);
});
Stderr { inner: &INSTANCE }
}
pub struct Stderr(());
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin(()))
+ pub fn new() -> Stdin {
+ Stdin(())
}
}
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout(()))
+ pub fn new() -> Stdout {
+ Stdout(())
}
}
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr(()))
+ pub fn new() -> Stderr {
+ Stderr(())
}
}
pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
pub fn panic_output() -> Option<impl io::Write> {
- Stderr::new().ok()
+ Some(Stderr::new())
}
pub struct Stderr;
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin)
+ pub fn new() -> Stdin {
+ Stdin
}
}
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout)
+ pub fn new() -> Stdout {
+ Stdout
}
}
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr)
+ pub fn new() -> Stderr {
+ Stderr
}
}
}
pub fn panic_output() -> Option<impl io::Write> {
- Stderr::new().ok()
+ Some(Stderr::new())
}
}
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin(()))
+ pub fn new() -> Stdin {
+ Stdin(())
}
}
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout(()))
+ pub fn new() -> Stdout {
+ Stdout(())
}
}
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr(()))
+ pub fn new() -> Stderr {
+ Stderr(())
}
}
pub struct Stderr(());
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin(()))
+ pub fn new() -> Stdin {
+ Stdin(())
}
}
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout(()))
+ pub fn new() -> Stdout {
+ Stdout(())
}
}
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr(()))
+ pub fn new() -> Stderr {
+ Stderr(())
}
}
pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
pub fn panic_output() -> Option<impl io::Write> {
- Stderr::new().ok()
+ Some(Stderr::new())
}
pub struct Stderr;
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin)
+ pub fn new() -> Stdin {
+ Stdin
}
}
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout)
+ pub fn new() -> Stdout {
+ Stdout
}
}
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr)
+ pub fn new() -> Stderr {
+ Stderr
}
}
pub struct Stderr(());
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin(()))
+ pub fn new() -> Stdin {
+ Stdin(())
}
}
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout(()))
+ pub fn new() -> Stdout {
+ Stdout(())
}
}
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr(()))
+ pub fn new() -> Stderr {
+ Stderr(())
}
}
pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
pub fn panic_output() -> Option<impl io::Write> {
- Stderr::new().ok()
+ Some(Stderr::new())
}
pub struct Stderr;
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin)
+ pub fn new() -> Stdin {
+ Stdin
}
#[inline]
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout)
+ pub fn new() -> Stdout {
+ Stdout
}
#[inline]
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr)
+ pub fn new() -> Stderr {
+ Stderr
}
#[inline]
}
pub fn panic_output() -> Option<impl io::Write> {
- Stderr::new().ok()
+ Some(Stderr::new())
}
}
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin { surrogate: 0 })
+ pub fn new() -> Stdin {
+ Stdin { surrogate: 0 }
}
}
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout)
+ pub fn new() -> Stdout {
+ Stdout
}
}
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr)
+ pub fn new() -> Stderr {
+ Stderr
}
}
}
pub fn panic_output() -> Option<impl io::Write> {
- Stderr::new().ok()
+ Some(Stderr::new())
}
}
impl Stdin {
- pub fn new() -> io::Result<Stdin> {
- Ok(Stdin {})
+ pub fn new() -> Stdin {
+ Stdin {}
}
}
}
impl Stdout {
- pub fn new() -> io::Result<Stdout> {
- Ok(Stdout)
+ pub fn new() -> Stdout {
+ Stdout
}
}
}
impl Stderr {
- pub fn new() -> io::Result<Stderr> {
- Ok(Stderr)
+ pub fn new() -> Stderr {
+ Stderr
}
}
}
pub fn panic_output() -> Option<impl io::Write> {
- Stderr::new().ok()
+ Some(Stderr::new())
}