summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Cuddeback <david.cuddeback@gmail.com>2015-04-07 20:34:30 -0700
committerDavid Cuddeback <david.cuddeback@gmail.com>2015-04-07 21:06:26 -0700
commit7cde38285e0e5e83ec91506b84d6895affce5aba (patch)
tree836c53fe343023a92b7b7cb1263f645f86b6bc26
parent696b03c6f2412e320eae436aa76ccd8011b4d3a6 (diff)
downloadtermios-rs-7cde38285e0e5e83ec91506b84d6895affce5aba.zip
converts indentation to four spaces
-rw-r--r--src/ffi.rs24
-rw-r--r--src/lib.rs56
2 files changed, 40 insertions, 40 deletions
diff --git a/src/ffi.rs b/src/ffi.rs
index a689cd2..980cd09 100644
--- a/src/ffi.rs
+++ b/src/ffi.rs
@@ -6,16 +6,16 @@ use super::os::*;
#[link(name = "c")]
extern "C" {
- pub fn tcgetattr(fd: c_int, termios_p: *mut termios) -> c_int;
- pub fn tcsetattr(fd: c_int, optional_actions: c_int, termios_p: *const termios) -> c_int;
- pub fn tcsendbreak(fd: c_int, duration: c_int) -> c_int;
- pub fn tcdrain(fd: c_int) -> c_int;
- pub fn tcflush(fd: c_int, queue_selector: c_int) -> c_int;
- pub fn tcflow(fd: c_int, action: c_int) -> c_int;
- pub fn cfmakeraw(termios_p: *mut termios);
- pub fn cfgetispeed(termios_p: *const termios) -> speed_t;
- pub fn cfgetospeed(termios_p: *const termios) -> speed_t;
- pub fn cfsetispeed(termios_p: *mut termios, speed: speed_t) -> c_int;
- pub fn cfsetospeed(termios_p: *mut termios, speed: speed_t) -> c_int;
- pub fn cfsetspeed(termios_p: *mut termios, speed: speed_t) -> c_int;
+ pub fn tcgetattr(fd: c_int, termios_p: *mut termios) -> c_int;
+ pub fn tcsetattr(fd: c_int, optional_actions: c_int, termios_p: *const termios) -> c_int;
+ pub fn tcsendbreak(fd: c_int, duration: c_int) -> c_int;
+ pub fn tcdrain(fd: c_int) -> c_int;
+ pub fn tcflush(fd: c_int, queue_selector: c_int) -> c_int;
+ pub fn tcflow(fd: c_int, action: c_int) -> c_int;
+ pub fn cfmakeraw(termios_p: *mut termios);
+ pub fn cfgetispeed(termios_p: *const termios) -> speed_t;
+ pub fn cfgetospeed(termios_p: *const termios) -> speed_t;
+ pub fn cfsetispeed(termios_p: *mut termios, speed: speed_t) -> c_int;
+ pub fn cfsetospeed(termios_p: *mut termios, speed: speed_t) -> c_int;
+ pub fn cfsetspeed(termios_p: *mut termios, speed: speed_t) -> c_int;
}
diff --git a/src/lib.rs b/src/lib.rs
index c482560..a20afba 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,80 +23,80 @@ pub mod os;
pub type Termios = os::termios;
impl Termios {
- pub fn zeroed() -> Self {
- unsafe { mem::zeroed() }
- }
+ pub fn zeroed() -> Self {
+ unsafe { mem::zeroed() }
+ }
- pub fn from_fd(fd: c_int) -> io::Result<Termios> {
- let mut termios = Termios::zeroed();
+ pub fn from_fd(fd: c_int) -> io::Result<Termios> {
+ let mut termios = Termios::zeroed();
- match tcgetattr(fd, &mut termios) {
- Ok(_) => Ok(termios),
- Err(err) => Err(err)
+ match tcgetattr(fd, &mut termios) {
+ Ok(_) => Ok(termios),
+ Err(err) => Err(err)
+ }
}
- }
}
impl Default for Termios {
- fn default() -> Self {
- Termios::zeroed()
- }
+ fn default() -> Self {
+ Termios::zeroed()
+ }
}
pub fn tcgetattr(fd: c_int, termios: &mut Termios) -> io::Result<()> {
- io_result(unsafe { ffi::tcgetattr(fd, termios) })
+ io_result(unsafe { ffi::tcgetattr(fd, termios) })
}
pub fn tcsetattr(fd: c_int, action: c_int, termios: &Termios) -> io::Result<()> {
- io_result(unsafe { ffi::tcsetattr(fd, action, termios) })
+ io_result(unsafe { ffi::tcsetattr(fd, action, termios) })
}
pub fn tcsendbreak(fd: c_int, duration: c_int) -> io::Result<()> {
- io_result(unsafe { ffi::tcsendbreak(fd, duration) })
+ io_result(unsafe { ffi::tcsendbreak(fd, duration) })
}
pub fn tcdrain(fd: c_int) -> io::Result<()> {
- io_result(unsafe { ffi::tcdrain(fd) })
+ io_result(unsafe { ffi::tcdrain(fd) })
}
pub fn tcflush(fd: c_int, queue_selector: c_int) -> io::Result<()> {
- io_result(unsafe { ffi::tcflush(fd, queue_selector) })
+ io_result(unsafe { ffi::tcflush(fd, queue_selector) })
}
pub fn tcflow(fd: c_int, action: c_int) -> io::Result<()> {
- io_result(unsafe { ffi::tcflow(fd, action) })
+ io_result(unsafe { ffi::tcflow(fd, action) })
}
pub fn cfmakeraw(termios: &mut Termios) {
- unsafe { ffi::cfmakeraw(termios) };
+ unsafe { ffi::cfmakeraw(termios) };
}
pub fn cfgetispeed(termios: &Termios) -> speed_t {
- unsafe { ffi::cfgetispeed(termios) }
+ unsafe { ffi::cfgetispeed(termios) }
}
pub fn cfgetospeed(termios: &Termios) -> speed_t {
- unsafe { ffi::cfgetospeed(termios) }
+ unsafe { ffi::cfgetospeed(termios) }
}
pub fn cfsetispeed(termios: &mut Termios, speed: speed_t) -> io::Result<()> {
- io_result(unsafe { ffi::cfsetispeed(termios, speed) })
+ io_result(unsafe { ffi::cfsetispeed(termios, speed) })
}
pub fn cfsetospeed(termios: &mut Termios, speed: speed_t) -> io::Result<()> {
- io_result(unsafe { ffi::cfsetospeed(termios, speed) })
+ io_result(unsafe { ffi::cfsetospeed(termios, speed) })
}
pub fn cfsetspeed(termios: &mut Termios, speed: speed_t) -> io::Result<()> {
- io_result(unsafe { ffi::cfsetspeed(termios, speed) })
+ io_result(unsafe { ffi::cfsetspeed(termios, speed) })
}
#[inline]
fn io_result(result: c_int) -> io::Result<()> {
- match result {
- 0 => Ok(()),
- _ => Err(io::Error::last_os_error())
- }
+ match result {
+ 0 => Ok(()),
+ _ => Err(io::Error::last_os_error())
+ }
}