Crate zila

Source
Expand description

A library for calling function on certain events.

Zila is a fast and reliable library for performing tasks on certian events. It propvides both syncronuos and asyncronuos functions to make writing Rust code esier.

§A Tour of Zila

Zila consists of a number of functions that provide essential for implementing event based applications in Rust. In this section, we will take a brief tour of zila, summarizing the major APIs and their uses.

The easiest way to get started is to enable all features. Do this by enabling the full feature flag:

zila = { version = "0.1.8", features = ["full"] }

§Authoring applications

Zila is great for writing applications and most users in this case shouldn’t worry too much about what features they should pick. If you’re unsure, we suggest going with full to ensure that you don’t run into any road blocks while you’re building your application.

§Example

A basic logger with zila.

Make sure you activated the second featureof the zill crate on Cargo.toml

zila = { version = "0.1.8", features = ["second"] }

on your main.rs:

use zila::call_every_second;

fn main() {
    call_every_second(|| {
        println!("Hi");
    });
}

More examples can be found here

Functions§

call_every_day
calls the given function every day
call_every_day_async
calls the given async function every day
call_every_day_async_mut
calls the given async function every day, takes a FnMut as the argument
call_every_day_mut
calls the given function every day, takes a FnMut as the argument
call_every_hour
calls the given function every hour
call_every_hour_async
calls the given async function every hour
call_every_hour_async_mut
calls the given async function every hour, takes a FnMut as the argument
call_every_hour_mut
calls the given function every hour, takes a FnMut as the argument
call_every_minute
calls the given function every minute
call_every_minute_async
calls the given async function every minute
call_every_minute_async_mut
calls the given async function every minute, takes a FnMut as the argument
call_every_minute_mut
calls the given function every minute, takes a FnMut as the argument
call_every_second
calls the given function every second
call_every_second_async
calls the given async function every second
call_every_second_async_mut
calls the given async function every second, takes a FnMut as the argument
call_every_second_mut
calls the given function every second, takes a FnMut as the argument
duration_to_next_day
Returns the duration to next day (00:00:00.000.000.000)
duration_to_next_hour
Returns the duration to next hour (__:00:00.000.000.000)
duration_to_next_minute
Returns the duration to next minute (__:__:00.000.000.000)
duration_to_next_second
Returns the duration to next second (__:__:__.000.000.000)
set_interval
calls the function in the specified intervals
set_interval_async
calls the async function in the specified intervals
set_interval_async_mut
calls the async function in the specified intervals, takes FnMut as the first argument
set_interval_mut
calls the function in the specified intervals, takes FnMut as the first argument
set_timeout
calls the function after the specified duration
set_timeout_async
calls the async function after the specified duration
set_timeout_async_mut
calls the async function after the specified duration, takes FnMut as the first argument
set_timeout_mut
calls the function after the specified duration, takes FnMut as the first argument