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::io::Write as StdWrite;
use std::pin::Pin; use std::pin::Pin;
use std::sync::Mutex; use std::sync::Mutex;
@ -120,9 +120,7 @@ impl Stderr {
/// # Ok(()) }) } /// # Ok(()) }) }
/// ``` /// ```
pub async fn lock(&self) -> StderrLock<'static> { pub async fn lock(&self) -> StderrLock<'static> {
lazy_static! { static STDERR: Lazy<std::io::Stderr> = Lazy::new(|| std::io::stderr());
static ref STDERR: std::io::Stderr = std::io::stderr();
}
blocking::spawn(move || StderrLock(STDERR.lock())).await 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::pin::Pin;
use std::sync::Mutex; use std::sync::Mutex;
@ -176,9 +176,7 @@ impl Stdin {
/// # Ok(()) }) } /// # Ok(()) }) }
/// ``` /// ```
pub async fn lock(&self) -> StdinLock<'static> { pub async fn lock(&self) -> StdinLock<'static> {
lazy_static! { static STDIN: Lazy<std::io::Stdin> = Lazy::new(|| std::io::stdin());
static ref STDIN: std::io::Stdin = std::io::stdin();
}
blocking::spawn(move || StdinLock(STDIN.lock())).await 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::io::Write as StdWrite;
use std::pin::Pin; use std::pin::Pin;
use std::sync::Mutex; use std::sync::Mutex;
@ -120,9 +120,7 @@ impl Stdout {
/// # Ok(()) }) } /// # Ok(()) }) }
/// ``` /// ```
pub async fn lock(&self) -> StdoutLock<'static> { pub async fn lock(&self) -> StdoutLock<'static> {
lazy_static! { static STDOUT: Lazy<std::io::Stdout> = Lazy::new(|| std::io::stdout());
static ref STDOUT: std::io::Stdout = std::io::stdout();
}
blocking::spawn(move || StdoutLock(STDOUT.lock())).await blocking::spawn(move || StdoutLock(STDOUT.lock())).await
} }

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

Loading…
Cancel
Save