Struct iup::timer::Timer
[−]
[src]
pub struct Timer(_);
A timer which periodically invokes a callback when the time is up.
Ownership
The timer must be manually destroyed, thus for the user safety it returns a guarded object
on the new
constructor.
Please refer to the crate level documentation of IUP-Rust (the main doc page) for details on ownership of elements.
Methods
impl Timer
fn new() -> Guard<Timer>
Constructs a timer.
fn time(&self) -> Option<u32>
Gets the set time interval in milliseconds or None
if not set.
fn set_time(&mut self, time: u32) -> Self
Sets the time interval in milliseconds.
In Windows the minimum value is 10ms.
fn run(&mut self) -> Self
Starts the timer.
Does nothing if the TIME attribute is not set i.e. set_time
.
If you have multiple threads start the timer in the main thread.
fn stop(&mut self) -> Self
Stops the timer.
fn is_running(&self) -> bool
Returns the current timer state.
Trait Implementations
impl Element for Timer
fn raw(&self) -> *mut Ihandle
unsafe fn from_raw_unchecked(ih: *mut Ihandle) -> Self
unsafe fn target_classname() -> &'static str
fn from_handle(handle: Handle) -> Result<Self, Handle>
fn from_name<S: Into<String>>(name: S) -> Option<Handle>
fn from_raw(ih: *mut Ihandle) -> Self
unsafe fn classname(&self) -> &CStr
fn destroy(self)
fn does_attrib_exist(&self, cname: &CString) -> bool
fn attribs(&self) -> Vec<String>
fn set_attrib<S1, S2>(&mut self, name: S1, value: S2) -> Self where S1: Into<String>, S2: Into<String>
fn attrib<S: Into<String>>(&self, name: S) -> Option<String>
fn set_attrib_data<S1>(&mut self, name: S1, data: *const c_void) -> Self where S1: Into<String>
fn attrib_data<S1>(&mut self, name: S1) -> *mut c_void where S1: Into<String>
fn set_attrib_handle<S1, E>(&mut self, name: S1, elem: E) -> Self where S1: Into<String>, E: Element
fn attrib_handle<S1>(&mut self, name: S1) -> Option<Handle> where S1: Into<String>
fn clear_attrib<S: Into<String>>(&mut self, name: S) -> Self
fn reset_attrib<S: Into<String>>(&mut self, name: S) -> Self
fn handle_name(&self) -> Option<String>
fn add_handle_name<S: Into<String>>(&self, name: S) -> Option<Handle>
fn clear_handle_name<S: Into<String>>(name: S) -> Option<Handle>
impl Debug for Timer
impl Copy for Timer
impl Clone for Timer
fn clone(&self) -> Timer
fn clone_from(&mut self, source: &Self)
impl DestroyCb for Timer
fn set_destroy_cb<F>(&mut self, cb: F) -> Self where F: Callback<(Self,)>
fn remove_destroy_cb(&mut self) -> Option<Box<Callback<(Self,)>>>
impl ActionCb for Timer
Called every time the defined time interval is reached.
To stop the callback from being called simply stop de timer with RUN=NO or Timer::stop
.
CallbackReturn::Close
will be processed.