summaryrefslogtreecommitdiff
path: root/src/sys/timerfd.rs
diff options
context:
space:
mode:
authorAlex Saveau <saveau.alexandre@gmail.com>2022-11-06 11:27:08 -0800
committerAlex Saveau <saveau.alexandre@gmail.com>2022-11-06 11:39:09 -0800
commit17833268cb3269d83766bcdb4d9cbe0e25ebd38e (patch)
treeb86885991e1d8b6f9c610747c2e8c3a3370960cd /src/sys/timerfd.rs
parent20df092bd067908fba23e49120eed7ad62f29108 (diff)
downloadnix-17833268cb3269d83766bcdb4d9cbe0e25ebd38e.zip
Reformat everything
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Diffstat (limited to 'src/sys/timerfd.rs')
-rw-r--r--src/sys/timerfd.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/sys/timerfd.rs b/src/sys/timerfd.rs
index b57d33c3..a35fc927 100644
--- a/src/sys/timerfd.rs
+++ b/src/sys/timerfd.rs
@@ -94,8 +94,10 @@ impl TimerFd {
/// NONBLOCK). The underlying fd will be closed on drop.
#[doc(alias("timerfd_create"))]
pub fn new(clockid: ClockId, flags: TimerFlags) -> Result<Self> {
- Errno::result(unsafe { libc::timerfd_create(clockid as i32, flags.bits()) })
- .map(|fd| Self { fd })
+ Errno::result(unsafe {
+ libc::timerfd_create(clockid as i32, flags.bits())
+ })
+ .map(|fd| Self { fd })
}
/// Sets a new alarm on the timer.
@@ -135,7 +137,11 @@ impl TimerFd {
/// Note: Setting a one shot alarm with a 0s TimeSpec disables the alarm
/// altogether.
#[doc(alias("timerfd_settime"))]
- pub fn set(&self, expiration: Expiration, flags: TimerSetTimeFlags) -> Result<()> {
+ pub fn set(
+ &self,
+ expiration: Expiration,
+ flags: TimerSetTimeFlags,
+ ) -> Result<()> {
let timerspec: TimerSpec = expiration.into();
Errno::result(unsafe {
libc::timerfd_settime(
@@ -152,7 +158,10 @@ impl TimerFd {
#[doc(alias("timerfd_gettime"))]
pub fn get(&self) -> Result<Option<Expiration>> {
let mut timerspec = TimerSpec::none();
- Errno::result(unsafe { libc::timerfd_gettime(self.fd, timerspec.as_mut()) }).map(|_| {
+ Errno::result(unsafe {
+ libc::timerfd_gettime(self.fd, timerspec.as_mut())
+ })
+ .map(|_| {
if timerspec.as_ref().it_interval.tv_sec == 0
&& timerspec.as_ref().it_interval.tv_nsec == 0
&& timerspec.as_ref().it_value.tv_sec == 0