pull/334/head
k-nasa 5 years ago
parent f8b8c9debe
commit eeb44c86e9

@ -1,4 +1,4 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use std::io::Write as StdWrite;
use std::pin::Pin;
use std::sync::Mutex;
@ -120,9 +120,7 @@ impl Stderr {
/// # Ok(()) }) }
/// ```
pub async fn lock(&self) -> StderrLock<'static> {
lazy_static! {
static ref STDERR: std::io::Stderr = std::io::stderr();
}
static STDERR: Lazy<std::io::Stderr> = Lazy::new(|| std::io::stderr());
blocking::spawn(move || StderrLock(STDERR.lock())).await
}

@ -1,4 +1,4 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use std::pin::Pin;
use std::sync::Mutex;
@ -176,9 +176,7 @@ impl Stdin {
/// # Ok(()) }) }
/// ```
pub async fn lock(&self) -> StdinLock<'static> {
lazy_static! {
static ref STDIN: std::io::Stdin = std::io::stdin();
}
static STDIN: Lazy<std::io::Stdin> = Lazy::new(|| std::io::stdin());
blocking::spawn(move || StdinLock(STDIN.lock())).await
}

@ -1,4 +1,4 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use std::io::Write as StdWrite;
use std::pin::Pin;
use std::sync::Mutex;
@ -120,9 +120,7 @@ impl Stdout {
/// # Ok(()) }) }
/// ```
pub async fn lock(&self) -> StdoutLock<'static> {
lazy_static! {
static ref STDOUT: std::io::Stdout = std::io::stdout();
}
static STDOUT: Lazy<std::io::Stdout> = Lazy::new(|| std::io::stdout());
blocking::spawn(move || StdoutLock(STDOUT.lock())).await
}

@ -1,5 +1,5 @@
use std::cmp::{Ord, Ordering};
use std::marker::PhantomData;
use std::cmp::{Ordering, Ord};
use std::pin::Pin;
use pin_project_lite::pin_project;

Loading…
Cancel
Save