Skip to content

Commit

Permalink
Merge pull request #1 from conradkleinespel/master
Browse files Browse the repository at this point in the history
Add support for `==` operator on Termios
  • Loading branch information
dcuddeback committed Feb 9, 2015
2 parents 284b09b + 545043c commit 8d7be11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
15 changes: 4 additions & 11 deletions src/ffi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[allow(unstable)]
extern crate libc;
use self::libc::{c_void,c_int};

Expand All @@ -23,10 +22,7 @@ extern "C" {

#[cfg(target_os = "linux")]
mod os {
#[allow(unstable)]
extern crate libc;

use self::libc::{c_int,c_uint,c_uchar};
use super::libc::{c_int,c_uint,c_uchar};

#[allow(non_camel_case_types)]
pub type cc_t = c_uchar;
Expand All @@ -37,7 +33,7 @@ mod os {
#[allow(non_camel_case_types)]
pub type tcflag_t = c_uint;

#[derive(Show,Copy)]
#[derive(Debug,Copy,Eq,PartialEq)]
#[repr(C)]
pub struct Termios {
pub c_iflag: tcflag_t,
Expand Down Expand Up @@ -212,10 +208,7 @@ mod os {

#[cfg(target_os = "macos")]
mod os {
#[allow(unstable)]
extern crate libc;

use self::libc::{c_int,c_uchar,c_ulong};
use super::libc::{c_int,c_uchar,c_ulong};

#[allow(non_camel_case_types)]
pub type tcflag_t = c_ulong;
Expand All @@ -226,7 +219,7 @@ mod os {
#[allow(non_camel_case_types)]
pub type speed_t = c_ulong;

#[derive(Show,Copy)]
#[derive(Show,Copy,Eq,PartialEq)]
#[repr(C)]
pub struct Termios {
pub c_iflag: tcflag_t,
Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#[allow(unstable)]
extern crate libc;

use self::libc::{c_int};
use std::io::{IoError,IoResult};
use std::old_io::{IoError,IoResult};
use std::mem;
use std::default::Default;

Expand Down Expand Up @@ -93,7 +92,6 @@ pub fn cfsetspeed(termios: &mut Termios, speed: speed_t) -> IoResult<()> {


#[inline]
#[allow(unstable)]
fn io_result(result: c_int) -> IoResult<()> {
match result {
0 => Ok(()),
Expand Down

0 comments on commit 8d7be11

Please sign in to comment.