Merge branch 'master' into 'master'
Added AsRawFd impl for RawTerminal See merge request redox-os/termion!170
This commit is contained in:
commit
189222555e
16
src/raw.rs
16
src/raw.rs
|
@ -25,8 +25,8 @@
|
|||
use std::io::{self, Write};
|
||||
use std::ops;
|
||||
|
||||
use sys::Termios;
|
||||
use sys::attr::{get_terminal_attr, raw_terminal_attr, set_terminal_attr};
|
||||
use sys::Termios;
|
||||
|
||||
/// The timeout of an escape code control sequence, in milliseconds.
|
||||
pub const CONTROL_SEQUENCE_TIMEOUT: u64 = 100;
|
||||
|
@ -70,6 +70,18 @@ impl<W: Write> Write for RawTerminal<W> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
mod unix_impl {
|
||||
use super::*;
|
||||
use std::os::unix::io::{AsRawFd, RawFd};
|
||||
|
||||
impl<W: Write + AsRawFd> AsRawFd for RawTerminal<W> {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
self.output.as_raw_fd()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Types which can be converted into "raw mode".
|
||||
///
|
||||
/// # Why is this type defined on writers and not readers?
|
||||
|
@ -120,7 +132,7 @@ impl<W: Write> RawTerminal<W> {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use std::io::{Write, stdout};
|
||||
use std::io::{stdout, Write};
|
||||
|
||||
#[test]
|
||||
fn test_into_raw_mode() {
|
||||
|
|
Loading…
Reference in New Issue