set_time_out

Crates.ioset_time_out
lib.rsset_time_out
version0.2.1
sourcesrc
created_at2022-01-15 18:16:40.924188
updated_at2022-01-16 14:53:38.908112
descriptionFunction to delay the execution of a function
homepagehttps://github.com/LucianoRicardo737/set_time_out_rust
repositoryhttps://github.com/LucianoRicardo737/set_time_out_rust
max_upload_size
id514452
size2,462
Luciano (LucianoRicardo737)

documentation

README

Set_time_out by UniCorp and LabLer for Rust

Add to cargo.toml the dependency

set_time_out = "0.2.1"

Easy peasy.

Import the function and used.

use set_time_out::set_time_out;

or

use set_time_out::set_time_out_callback;

and invoque

fn say_hello() {
    println!("Hello");
}

set_time_out(1500);

say_hello();

done!.

But if you need pass one function, here the correct way. It's the same, but more organized.

fn say_hello() {
    println!("Hello");
}

set_time_out_callback(1000, Same(say_hello));

or without callback

fn say_hello() {
    println!("Hello");
}

set_time_out_callback(1000, None);

say_hello();

The time is in milliseconds. Have nice day.

Commit count: 21

cargo fmt