Commit 18922255 authored by Jeremy Soller's avatar Jeremy Soller

Merge branch 'master' into 'master'

Added AsRawFd impl for RawTerminal

See merge request !170
parents a448f510 c471ab68
Pipeline #7834 failed with stages
in 2 minutes and 30 seconds
......@@ -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() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment