[][src]Struct rttrust::timer::Timer

pub struct Timer { /* fields omitted */ }

All methods use immutable self since the safety is guaranteed by rt-thread internal

TODO: timer control

Implementations

impl Timer[src]

pub fn new(timer: &mut rt_timer) -> &Timer[src]

pub fn create<P>(
    name: &str,
    entry: TimerEntry<P>,
    parameter: CallbackParameter,
    time: u32,
    flag: TimerFlags
) -> Result<Timer> where
    P: Into<CallbackParameter>, 
[src]

This function will create a timer

@param name the name of timer @param timeout the timeout function @param parameter the parameter of timeout function @param time the tick of timer @param flag the flag of timer

@return the created timer object

pub fn create_closure<F>(
    name: &str,
    entry: F,
    time: u32,
    flag: TimerFlags
) -> Result<Timer> where
    F: FnOnce(),
    F: Send + 'static, 
[src]

pub fn start(&self) -> Result<()>[src]

This function will start the timer

@return the operation status, RT_EOK on OK, -RT_ERROR on error

pub fn delete(self) -> Result<()>[src]

This function will delete a timer and release timer memory

@return the operation status, RT_EOK on OK; RT_ERROR on error

Wanring:

Rust timer has no cleanup function and is not able to unwind. Directly stopping a Rust timer may lead to resoucre leak.

pub fn stop(&self) -> Result<()>[src]

This function will stop the timer

@return the operation status, RT_EOK on OK, -RT_ERROR on error

Wanring:

Rust timer has no cleanup function and is not able to unwind. Directly stopping a Rust timer may lead to resoucre leak.

Trait Implementations

impl Clone for Timer[src]

impl Copy for Timer[src]

impl Object for Timer[src]

impl Send for Timer[src]

Auto Trait Implementations

impl !Sync for Timer

impl Unpin for Timer

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.