[go: up one dir, main page]

Crate timerfd [] [src]

This crate implements the linux timerfd interface.

Example

use timerfd::{TimerFd, TimerState};
use std::time::Duration;

let mut tfd = TimerFd::new().unwrap();
assert_eq!(tfd.get_state().unwrap(), TimerState::Disarmed);
tfd.set_state(TimerState::Oneshot(Duration::new(1, 0))).unwrap();
match tfd.get_state().unwrap() {
    TimerState::Oneshot(d) => println!("Remaining: {:?}", d),
    _ => unreachable!(),
}
tfd.read().unwrap();
assert_eq!(tfd.get_state().unwrap(), TimerState::Disarmed);

Structs

TimerFd

Represents a timerfd.

Enums

TimerState

Holds the state of a TimerFd.