Crates.io | islam |
lib.rs | islam |
version | 4.0.2 |
source | src |
created_at | 2021-04-19 06:15:27.340445 |
updated_at | 2024-08-09 03:42:05.906592 |
description | Islamic library for Rust |
homepage | |
repository | https://github.com/azzamsa/islam |
max_upload_size | |
id | 386522 |
size | 106,542 |
islam is an Islamic library for Rust. It is a direct port of PyIslam with a slight change in the API part.
I have always got panic!
working with salah.
Previously, I have a good experience with PyIslam.
In my case, it is very precise and has a simple algorithm. Nowadays, I work a lot with Rust.
So here it is, islam
is born!
use islam::salah::{Config, Location, Madhab, Method, PrayerSchedule};
let central_jakarta = Location::new(6.1, 106.49);
let config = Config::new().with(Method::Singapore, Madhab::Shafi);
let prayer_times = PrayerSchedule::new(central_jakarta)?
.with_config(config)
.calculate()?;
First, you need to specify Location
with latitude
, and longitude
as parameters.
Then choose a calculation method such Singapore
. Other methods are available in the docs.
There are also madhab
configurations that you can choose from.
let date = NaiveDate::from_ymd_opt(2021, 4, 9)
let from_gregorian = HijriDate::from_gregorian(date, 0);
println!(
"From gregorian: {}-{}-{}",
from_gregorian.year, from_gregorian.month, from_gregorian.day,
);
from_gregorian
accepts Date
and correction value
as parameters.
To learn more, see other examples.
The calculation part of this library is a direct port of PyIslam with a slight change in the API part. The API took inspiration from salah