joydev 0.3.1

Rust joydev library.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::result;

use nix::errno::{Errno, ErrnoSentinel};

use crate::Error;

/// Joydev Result type
pub type Result<T> = result::Result<T, Error>;

pub(crate) fn convert_ioctl_result<S: ErrnoSentinel + PartialEq<S>>(value: S) -> Result<S> {
	if value == S::sentinel() {
		Err(Error::Sys(Errno::last()))
	} else {
		Ok(value)
	}
}