Struct xpcom::interfaces::nsITimer
[−]
[src]
#[repr(C)]pub struct nsITimer { /* fields omitted */ }
interface nsITimer : nsISupports
/**
* The callback interface for timers.
*/
Methods
impl nsITimer
[src]
pub fn coerce<T: nsITimerCoerce>(&self) -> &T
[src]
Cast this nsITimer
to one of its base interfaces.
impl nsITimer
[src]
pub const TYPE_ONE_SHOT: i64
TYPE_ONE_SHOT: i64 = 0
/**
* nsITimer instances must be initialized by calling one of the "init" methods
* documented below. You may also re-initialize (using one of the init()
* methods) an existing instance to avoid the overhead of destroying and
* creating a timer. It is not necessary to cancel the timer in that case.
*
* By default a timer will fire on the thread that created it. Set the .target
* attribute to fire on a different thread. Once you have set a timer's .target
* and called one of its init functions, any further interactions with the timer
* (calling cancel(), changing member fields, etc) should only be done by the
* target thread, or races may occur with bad results like timers firing after
* they've been canceled, and/or not firing after re-initiatization.
*/
/**
* Type of a timer that fires once only.
*/
pub const TYPE_REPEATING_SLACK: i64
TYPE_REPEATING_SLACK: i64 = 1
/**
* After firing, a TYPE_REPEATING_SLACK timer is stopped and not restarted
* until its callback completes. Specified timer period will be at least
* the time between when processing for last firing the callback completes
* and when the next firing occurs.
*
* This is the preferable repeating type for most situations.
*/
pub const TYPE_REPEATING_PRECISE: i64
TYPE_REPEATING_PRECISE: i64 = 2
/**
* TYPE_REPEATING_PRECISE is just a synonym for
* TYPE_REPEATING_PRECISE_CAN_SKIP. They used to be distinct, but the old
* TYPE_REPEATING_PRECISE kind was similar to TYPE_REPEATING_PRECISE_CAN_SKIP
* while also being less useful. So the distinction was removed.
*/
pub const TYPE_REPEATING_PRECISE_CAN_SKIP: i64
TYPE_REPEATING_PRECISE_CAN_SKIP: i64 = 3
/**
* A TYPE_REPEATING_PRECISE_CAN_SKIP repeating timer aims to have constant
* period between firings. The processing time for each timer callback
* should not influence the timer period. However this timer type
* guarantees that it will not queue up new events to fire the callback
* until the previous callback event finishes firing. If the callback
* takes a long time, then the next callback will be scheduled immediately
* afterward, but only once. This is the only non-slack timer available.
*/
pub const TYPE_REPEATING_SLACK_LOW_PRIORITY: i64
TYPE_REPEATING_SLACK_LOW_PRIORITY: i64 = 4
/**
* Same as TYPE_REPEATING_SLACK with the exception that idle events
* won't yield to timers with this type. Use this when you want an
* idle callback to be scheduled to run even though this timer is
* about to fire.
*/
pub const TYPE_ONE_SHOT_LOW_PRIORITY: i64
TYPE_ONE_SHOT_LOW_PRIORITY: i64 = 5
/**
* Same as TYPE_ONE_SHOT with the exception that idle events won't
* yield to timers with this type. Use this when you want an idle
* callback to be scheduled to run even though this timer is about
* to fire.
*/
pub unsafe fn Init(
&self,
aObserver: *const nsIObserver,
aDelay: uint32_t,
aType: uint32_t
) -> nsresult
[src]
&self,
aObserver: *const nsIObserver,
aDelay: uint32_t,
aType: uint32_t
) -> nsresult
/**
* Initialize a timer that will fire after the said delay.
* A user must keep a reference to this timer till it is
* is no longer needed or has been cancelled.
*
* @param aObserver the callback object that observes the
* ``timer-callback'' topic with the subject being
* the timer itself when the timer fires:
*
* observe(nsISupports aSubject, => nsITimer
* string aTopic, => ``timer-callback''
* wstring data => null
*
* @param aDelay delay in milliseconds for timer to fire
* @param aType timer type per TYPE* consts defined above
*/
void init (in nsIObserver aObserver, in unsigned long aDelay, in unsigned long aType);
pub unsafe fn InitWithCallback(
&self,
aCallback: *const nsITimerCallback,
aDelay: uint32_t,
aType: uint32_t
) -> nsresult
[src]
&self,
aCallback: *const nsITimerCallback,
aDelay: uint32_t,
aType: uint32_t
) -> nsresult
/**
* Initialize a timer to fire after the given millisecond interval.
* This version takes a callback object.
*
* @param aFunc nsITimerCallback interface to call when timer expires
* @param aDelay The millisecond interval
* @param aType Timer type per TYPE* consts defined above
*/
void initWithCallback (in nsITimerCallback aCallback, in unsigned long aDelay, in unsigned long aType);
pub unsafe fn Cancel(&self) -> nsresult
[src]
/**
* Cancel the timer. This method works on all types, not just on repeating
* timers -- you might want to cancel a TYPE_ONE_SHOT timer, and even reuse
* it by re-initializing it (to avoid object destruction and creation costs
* by conserving one timer instance).
*/
void cancel ();
pub unsafe fn GetDelay(&self, aDelay: *mut uint32_t) -> nsresult
[src]
/**
* The millisecond delay of the timeout.
*
* NOTE: Re-setting the delay on a one-shot timer that has already fired
* doesn't restart the timer. Call one of the init() methods to restart
* a one-shot timer.
*/
attribute unsigned long delay;
pub unsafe fn SetDelay(&self, aDelay: uint32_t) -> nsresult
[src]
/**
* The millisecond delay of the timeout.
*
* NOTE: Re-setting the delay on a one-shot timer that has already fired
* doesn't restart the timer. Call one of the init() methods to restart
* a one-shot timer.
*/
attribute unsigned long delay;
pub unsafe fn GetType(&self, aType: *mut uint32_t) -> nsresult
[src]
/**
* The timer type - one of the above TYPE_* constants.
*/
attribute unsigned long type;
pub unsafe fn SetType(&self, aType: uint32_t) -> nsresult
[src]
/**
* The timer type - one of the above TYPE_* constants.
*/
attribute unsigned long type;
pub unsafe fn GetClosure(&self, aClosure: *mut *mut c_void) -> nsresult
[src]
/**
* The opaque pointer pass to initWithFuncCallback.
*/
[noscript] readonly attribute voidPtr closure;
pub unsafe fn GetCallback(
&self,
aCallback: *mut *const nsITimerCallback
) -> nsresult
[src]
&self,
aCallback: *mut *const nsITimerCallback
) -> nsresult
/**
* The nsITimerCallback object passed to initWithCallback.
*/
readonly attribute nsITimerCallback callback;
pub unsafe fn GetTarget(&self, aTarget: *mut *const nsIEventTarget) -> nsresult
[src]
/**
* The nsIEventTarget where the callback will be dispatched. Note that this
* target may only be set before the call to one of the init methods above.
*
* By default the target is the thread that created the timer.
*/
attribute nsIEventTarget target;
pub unsafe fn SetTarget(&self, aTarget: *const nsIEventTarget) -> nsresult
[src]
/**
* The nsIEventTarget where the callback will be dispatched. Note that this
* target may only be set before the call to one of the init methods above.
*
* By default the target is the thread that created the timer.
*/
attribute nsIEventTarget target;
pub unsafe fn GetAllowedEarlyFiringMicroseconds(
&self,
aAllowedEarlyFiringMicroseconds: *mut uint32_t
) -> nsresult
[src]
&self,
aAllowedEarlyFiringMicroseconds: *mut uint32_t
) -> nsresult
/**
* The number of microseconds this nsITimer implementation can possibly
* fire early.
*/
[noscript] readonly attribute unsigned long allowedEarlyFiringMicroseconds;
Methods from Deref<Target = nsISupports>
pub fn coerce<T: nsISupportsCoerce>(&self) -> &T
[src]
Cast this nsISupports
to one of its base interfaces.
pub unsafe fn QueryInterface(
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
[src]
&self,
uuid: &nsIID,
result: *mut *mut c_void
) -> nsresult
void QueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result);
pub unsafe fn AddRef(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt AddRef ();
pub unsafe fn Release(&self) -> nsrefcnt
[src]
[noscript,notxpcom] nsrefcnt Release ();
Trait Implementations
impl XpCom for nsITimer
[src]
const IID: nsIID
IID: nsIID = nsID(1038397701, 13884, 18476, [164, 9, 186, 172, 131, 160, 27, 252])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[src]
Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more
impl RefCounted for nsITimer
[src]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for nsITimer
[src]
type Target = nsISupports
The resulting type after dereferencing.
fn deref(&self) -> &nsISupports
[src]
Dereferences the value.