rust: fix input; add constructor

pull/1097/head
joseLuís 4 years ago
parent 2f3d99e4e7
commit e8ff092f50

@ -15,7 +15,7 @@ use nc::types::Input;
/// comparison for equality (excepting seqnum).
///
/// Returns true if the two are data-equivalent.
pub fn ncinput_equal_p(input1: Input, input2: Input) -> bool {
pub fn ncinput_equal_p(n1: Input, n2: Input) -> bool {
if n1.id != n2.id {
return false;
}
@ -25,3 +25,31 @@ pub fn ncinput_equal_p(input1: Input, input2: Input) -> bool {
// do not check seqnum
true
}
impl Input {
pub fn new() -> Input {
Input {
id: 0,
y: 0,
x: 0,
alt: false,
shift: false,
ctrl: false,
seqnum: 0,
}
}
}
/*
#[cfg(test)]
mod test {
use super::nc;
use serial_test::serial;
#[test]
#[serial]
fn ncinput_equal_p() {
assert!();
}
}
*/

@ -18,25 +18,27 @@ mod macros;
mod cells;
mod channel;
mod direct;
mod input;
mod key;
mod keycodes;
mod nc;
mod palette;
mod pixel;
mod plane;
mod visual;
mod types;
mod visual;
pub use cells::*;
pub use channel::*;
pub use direct::*;
pub use input::*;
pub use key::*;
pub use keycodes::*;
pub use nc::*;
pub use palette::*;
pub use pixel::*;
pub use plane::*;
pub use visual::*;
pub use types::*;
pub use visual::*;
// TODO: move tests out
#[cfg(test)]

Loading…
Cancel
Save