Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azzamsa/islam
Islamic library for Rust
https://github.com/azzamsa/islam
islam
Last synced: 6 days ago
JSON representation
Islamic library for Rust
- Host: GitHub
- URL: https://github.com/azzamsa/islam
- Owner: azzamsa
- License: gpl-3.0
- Created: 2021-11-14T11:32:21.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-09T03:47:53.000Z (5 months ago)
- Last Synced: 2024-11-18T23:59:23.438Z (about 1 month ago)
- Topics: islam
- Language: Rust
- Homepage:
- Size: 126 KB
- Stars: 17
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
---
_islam_ is an Islamic library for Rust.
It is a direct port of [PyIslam](https://github.com/abougouffa/pyIslam) with a slight change in the API part.## Why?
I have always got `panic!` working with [salah](https://github.com/insha/salah).
Previously, I have a good experience with [PyIslam](https://github.com/abougouffa/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!## Features
- Hijri date
- Prayer times## Usage
### Getting Prayer Times
```rust
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](https://docs.rs/islam/latest/islam/pray/method/enum.Method.html#variants).
There are also `madhab` configurations that you [can choose from](https://docs.rs/islam/latest/islam/pray/madhab/enum.Madhab.html#variants).### Getting Hijri Date
```rust
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.
## More Examples
To learn more, see other [examples](examples/).
## Acknowledgement
The calculation part of this library is a direct port of [PyIslam](https://github.com/abougouffa/pyIslam)
with a slight change in the API part. The API took inspiration from [salah](https://github.com/insha/salah)