pub struct TimerFd(_);
Expand description
Represents a timerfd.
See also timerfd_create(2)
.
Implementations§
source§impl TimerFd
impl TimerFd
sourcepub fn new_custom(
clock: ClockId,
nonblocking: bool,
cloexec: bool
) -> IoResult<TimerFd>
pub fn new_custom( clock: ClockId, nonblocking: bool, cloexec: bool ) -> IoResult<TimerFd>
Creates a new TimerFd
.
By default, it uses the monotonic clock, is blocking and does not close on exec. The parameters allow you to change that.
Errors
On Linux 2.6.26 and earlier, nonblocking and cloexec are not supported and setting them
will return an error of kind ErrorKind::InvalidInput
.
This can also fail in various cases of resource exhaustion. Please check
timerfd_create(2)
for details.
sourcepub fn new() -> IoResult<TimerFd>
pub fn new() -> IoResult<TimerFd>
Creates a new TimerFd
with default settings.
Use new_custom
to specify custom settings.
sourcepub fn set_state(
&mut self,
state: TimerState,
sflags: SetTimeFlags
) -> TimerState
pub fn set_state( &mut self, state: TimerState, sflags: SetTimeFlags ) -> TimerState
Sets this timerfd to a given TimerState
and returns the old state.
sourcepub fn get_state(&self) -> TimerState
pub fn get_state(&self) -> TimerState
Returns the current TimerState
.
Trait Implementations§
source§impl AsFd for TimerFd
impl AsFd for TimerFd
source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
Borrows the file descriptor. Read more
Auto Trait Implementations§
impl RefUnwindSafe for TimerFd
impl Send for TimerFd
impl Sync for TimerFd
impl Unpin for TimerFd
impl UnwindSafe for TimerFd
Blanket Implementations§
§impl<T> AsFilelike for Twhere
T: AsFd,
impl<T> AsFilelike for Twhere T: AsFd,
§fn as_filelike(&self) -> BorrowedFd<'_>
fn as_filelike(&self) -> BorrowedFd<'_>
Borrows the reference. Read more
§fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where
Target: FilelikeViewType,
fn as_filelike_view<Target>(&self) -> FilelikeView<'_, Target>where Target: FilelikeViewType,
Return a borrowing view of a resource which dereferences to a
&Target
. Read more§impl<T> AsRawFilelike for Twhere
T: AsRawFd,
impl<T> AsRawFilelike for Twhere T: AsRawFd,
§fn as_raw_filelike(&self) -> i32
fn as_raw_filelike(&self) -> i32
Returns the raw value.
§impl<T> AsRawSocketlike for Twhere
T: AsRawFd,
impl<T> AsRawSocketlike for Twhere T: AsRawFd,
§fn as_raw_socketlike(&self) -> i32
fn as_raw_socketlike(&self) -> i32
Returns the raw value.
§impl<T> AsSocketlike for Twhere
T: AsFd,
impl<T> AsSocketlike for Twhere T: AsFd,
§fn as_socketlike(&self) -> BorrowedFd<'_>
fn as_socketlike(&self) -> BorrowedFd<'_>
Borrows the reference.
§fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where
Target: SocketlikeViewType,
fn as_socketlike_view<Target>(&self) -> SocketlikeView<'_, Target>where Target: SocketlikeViewType,
Return a borrowing view of a resource which dereferences to a
&Target
. Read moresource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FromRawFilelike for Twhere
T: FromRawFd,
impl<T> FromRawFilelike for Twhere T: FromRawFd,
§unsafe fn from_raw_filelike(raw: i32) -> T
unsafe fn from_raw_filelike(raw: i32) -> T
Constructs
Self
from the raw value. Read more§impl<T> FromRawSocketlike for Twhere
T: FromRawFd,
impl<T> FromRawSocketlike for Twhere T: FromRawFd,
§unsafe fn from_raw_socketlike(raw: i32) -> T
unsafe fn from_raw_socketlike(raw: i32) -> T
Constructs
Self
from the raw value. Read more§impl<T> IntoFilelike for Twhere
T: Into<OwnedFd>,
impl<T> IntoFilelike for Twhere T: Into<OwnedFd>,
§fn into_filelike(self) -> OwnedFd
fn into_filelike(self) -> OwnedFd
Consumes this object, returning the underlying filelike object. Read more
§impl<T> IntoSocketlike for Twhere
T: Into<OwnedFd>,
impl<T> IntoSocketlike for Twhere T: Into<OwnedFd>,
§fn into_socketlike(self) -> OwnedFd
fn into_socketlike(self) -> OwnedFd
Consumes this object, returning the underlying socketlike object.