zakat 1.4.0
zakat: ^1.4.0 copied to clipboard
High-performance, Fiqh-compliant Islamic Zakat calculation library powered by Rust. Supports Gold, Silver, Business, Livestock, and more.
Changelog #
1.4.0 - 2026-01-05 #
Major Feature Release: Advanced Fiqh Compliance #
This release introduces 5 Long-Term Fiqh Features, transforming zakatrs into a comprehensive Shariah-compliant wealth management system.
Added #
-
Restricted Funds (Daman Ijtima'i / Pension):
- New
RestrictedFundAssetsstruct andAccessibilityLevelenum inzakat-core/src/maal/restricted.rs. - Handles logic for
FullyAccessible,PenaltyWithdrawal, andLockedUntilRetirementfunds based on Madhab strategies. - Implements precise Zakatable amount calculation considering withdrawal penalties and vesting rules.
- New
-
Joint Ventures (Khultat):
- New
partnershipmodule handlingJointVenturePortfolio. - Implements
Syirkah(Partnership) implications on Nisab threshold aggregation. - Added
Shareholderstruct to properly distribute Zakat liability among partners.
- New
-
Advanced Receivables (Dayn):
- Breaking Change:
BusinessZakatnow usesreceivables_list: Vec<ReceivableItem>instead of a flat decimal. - Introduced
ReceivableQuality(Strong,Weak,BadDebt) to filter zakatable receivables based on likelihood of recovery. - Deprecated single
receivablesfield with warnings for legacy usage.
- Breaking Change:
-
Retrospective Qada Calculator (Missed Zakat):
- New
zakat-ledgermoduleqada_inflation. - Implements Gold Standard Method for adjusting historical missed payments against inflation.
- Uses
InflationIndexProvidertrait to fetch historical gold prices.
- New
-
Zakat Distribution (Haddul Kifayah):
- New
distributionmodule inzakat-core. - Implements
Haddul Kifayah(Sufficiency Limit) calculator usingBasicNeedsandHouseholdProfile. - Determines eligibility status (
Fakir,Miskin,NotEligible) based on sufficiency ratios.
- New
-
WASM Support:
- Added
tsifydependency tozakat-corefor enhanced TypeScript type definitions in WASM builds.
- Added
Changed #
- Config: Added
pension_zakat_on_vestedandsavings_ratetoZakatRulesfor granular Madhab control. - Deps: Added
chronofeatureserdeandtsifyintegration for seamless serialization.
1.3.0 - 2026-01-04 #
Features (QoL & Robustness Sprint) #
-
CLI Improvements:
- Doctor Command: New
zakat doctorcommand to diagnose system health, connectivity, and environment. - Overwrite Protection:
zakat savenow prompts for confirmation before overwriting existing files. - NO_COLOR: strict adherence to the NO_COLOR standard for accessible output.
- Doctor Command: New
-
Language Bindings:
- Python Compatibility:
PyZakatConfignow accepts flexible numeric types (int,float,decimalstring) ensuring a more Pythonic API. - Dart Extensions: Added
toDouble()forFrbDecimaland verifiedtoFrb()extensions for seamless UI integration. - Kotlin Polish: Fixed casing inconsistency in
LivestockAgeenum serialization.
- Python Compatibility:
-
Robustness:
- Network Resilience: Implemented exponential backoff retry logic (up to 3 retries) for all network providers in
zakat-providers. - Explicit Timeouts: Enforced strict timeout configuration for Binance API calls.
- Network Resilience: Implemented exponential backoff retry logic (up to 3 retries) for all network providers in
1.2.1 - 2026-01-04 #
Features (Comprehensive Update) #
-
Fiqh Compliance & Validation:
- Zakat Modes: Added
ZakatMode(Strict vs Permissive) toconfig.rsto control validation strictness. - Purity Refactor: Changed
PreciousMetals.purityfromu32toDecimal(supporting fractional values like 21.6K) and improved validation (1-24K for Gold). - Unified Liabilities: Deprecated
liabilities_due_nowin favor of itemizednamed_liabilities, with runtime warnings for legacy usage.
- Zakat Modes: Added
-
Developer Experience (DX):
- Ledger Insights: Added
explain()method toLedgerZakatResultfor human-readable Hawl status breakdowns. - Hawl Logging: Added
INFOlevel logging when Hawl breaches occur (balance drops below Nisab). - Dart Interop: Added
.toFrb()extension methods for Dartdouble,int, andnumfor easier FFI conversion. - CLI UX: Added
indicatifprogress spinner for live price fetching inzakat-cli.
- Ledger Insights: Added
-
Input Handling:
- Scientific Notation: Enhanced input sanitization to support scientific notation (e.g.,
1.5e6,2E-3).
- Scientific Notation: Enhanced input sanitization to support scientific notation (e.g.,
Fixed #
- Python Publishing: Fixed source distribution (sdist) build failure on PyPI by explicitly including all workspace member crates in
pyproject.toml.
1.2.0 - 2026-01-04 #
Features #
-
WASM Optimization:
- Lightweight Builds: Refectored
zakatcrate to makeledgerandsqliteoptional dependencies. wasm-lightFeature: Added a dedicated feature flag for optimized WASM binaries without heavy database dependencies.- Result: Significantly reduced binary size for web targets.
- Lightweight Builds: Refectored
-
Resilient Price Provider:
- Chain of Responsibility: Implemented
MultiSourcePriceProviderpattern. - Automatic Failover: Providers are chained; if one fails, the next is tried automatically.
- Providers: Added
GoldApiProviderandMetalPriceProvideralongside existing Binance provider.
- Chain of Responsibility: Implemented
-
Offline Support:
- Persistent Price Cache: Implemented
FileSystemPriceCacheinzakat-providers. - Persistence: Caches fetched prices to
~/.zakat/prices.json. - TTL: Respects configurable Time-To-Live (TTL) for cached data.
- Resilience: Silently falls back to network if cache is missing, expired, or corrupted.
- Persistent Price Cache: Implemented
-
Interactive CLI Improvements:
- State Persistence: Added "Save Portfolio" and "Load Portfolio" menu options.
- File Support: Added
--load <path>argument to restore portfolio state on startup. - User Experience: Refactored main loop into a structured interactive menu.
Fixed #
- Testing: Fixed missing
Decimalimport inzakat-providerstest module.
1.1.2 - 2026-01-04 #
Added #
- XTask Improvements:
- Auto-retry for crates.io transient errors (502/503/429) with exponential backoff
- Auto-skip already-published crates during
publish-crates - Auto
npm loginon authentication failure duringpublish-npm - Auto
dart format .inbuild-allfor pub.dev static analysis
Fixed #
- Dart Formatting: Fixed all formatting issues to pass pub.dev static analysis (50/50)
- Library Names: Removed unnecessary
library zakat;declarations
1.1.1 - 2026-01-04 #
Fixed #
- Pub.dev Compliance: Fixed all pub.dev publishing requirements for
zakat_dart:- Added missing
example/main.dartwith Business and Gold/Silver calculation demos - Added version 1.1.1 entry to CHANGELOG to match pubspec.yaml
- Fixed
compliance_test.dartto gracefully skip when fixture files are missing
- Added missing
- Git Tracking: Un-ignored FFI generated files (
lib/src/ffi/) for proper pub.dev verification
Changed #
- XTask: Bumped all workspace crate versions to 1.1.1
1.1.0 - 2026-01-03 #
Quality of Life Release #
This release introduces 5 high-impact "Quality of Life" features focused on developer experience and real-world usability.
Added #
-
Smart Fuzzy Dates (Hawl Tracking):
- New
FuzzyDateenum with Islamic month variants:Ramadan(year),Muharram(year),Shawwal(year),DhulHijjah(year),Unknown - New
AcquisitionDateenum:Exact(NaiveDate)orApproximate(FuzzyDate) HawlTracker::with_fuzzy_acquisition()for approximate date handlingHawlTracker::from_acquisition_date()accepts both exact and fuzzy dates- Uses ICU Calendar for Hijri-to-Gregorian conversion
- Fiqh Safety:
Unknowndates returntrue(Hawl satisfied) to err on side of caution
- New
-
Portfolio Snapshots (Audit Logs):
- New
PortfolioSnapshotstruct for serializable audit trails - Contains:
timestamp,config_snapshot,inputs,result,metadata ZakatPortfolio::snapshot(&config, &result)creates snapshotsPortfolioSnapshot::to_json()andfrom_json()for persistence.with_metadata(key, value)builder for custom audit data
- New
-
Automatic Price Fallbacks:
- New
BestEffortPriceProvider<P>inzakat-providers - Wraps any
PriceProviderwith static fallback prices - Caches last known good prices (
last_known_good: Arc<RwLock<...>>) - Logs warnings when using fallback
- Supports both native (reqwest) and WASM (gloo-net) targets
- New
-
"Almost Payable" State (Sadaqah Recommendation):
- New
ZakatRecommendationenum:Obligatory,Recommended,None - Added
recommendationfield toZakatDetails - Returns
Recommendedwhennet_assets >= 90% of Nisab(encouraging voluntary Sadaqah) - Fiqh Safety: Never marks as
Obligatoryunless strictly payable
- New
-
Interactive CLI Tool (
zakat-cli):- New binary crate:
cargo install zakat-cliorcargo run -p zakat-cli - Interactive prompts via
inquirefor asset entry - Supports: Business, Gold, Silver, Cash, Investments, Agriculture
- Pretty-printed results with
tabledandcolored - Live pricing with
BestEffortPriceProviderfallback - Snapshot saving for audit trails
- CLI flags:
--offline,--gold-price,--silver-price,--verbose
- New binary crate:
Changed #
- XTask: Added
zakat-clito workspace crates list for publishing - Prelude Exports: Added
HawlTracker,AcquisitionDate,FuzzyDate,ZakatRecommendation,PortfolioSnapshot
Technical #
- 78 Tests Passing: All unit tests verified (67 zakat-core + 11 zakat-providers)
- Zero Breaking Changes: All new features are additive
1.0.1 - 2026-01-03 #
Added #
- Automated TypeScript Type Generation: Integrated
typesharefor automatic TypeScript definition generation from Rust types.- Types are now auto-generated to
pkg/types.tsduring build. - All
Decimalfields are serialized asstringfor precision. - JSDoc comments are generated from Rust doc comments (
///).
- Types are now auto-generated to
- Multi-Platform Type Generation: Extended
xtask build-allto generate types for multiple platforms:- TypeScript:
pkg/types.ts(for NPM, JSR, WASM, Deno) - Kotlin:
zakat_android/.../Types.kt(for Android) - Swift:
zakat_ios/.../ZakatTypes.swift(for iOS, optional)
- TypeScript:
- Typeshare Annotations: Added
#[typeshare::typeshare]to core public types:ZakatConfig,NetworkConfig(config.rs)NisabStandard,Madhab,ZakatRules(madhab.rs)ZakatDetails,ZakatExplanation,CalculationStep,CalculationTrace(types.rs)PortfolioItem,CustomAsset(assets.rs)WealthType,PaymentPayload,Operation(types.rs)
Changed #
- NetworkConfig: Changed
binance_api_ipfromIpAddrtoStringfor FFI compatibility. - NetworkConfig: Changed
timeout_secondsfromu64tou32for typeshare compatibility. - JSR Configuration: Replaced manual
definitions.tswith auto-generatedtypes.ts.
Removed #
- Manual Type Definitions: Deleted
jsr-config/definitions.ts(replaced by auto-generatedpkg/types.ts).
1.0.0 - 2026-01-03 #
🎉 First Stable Release #
This is the first stable release of zakatrs, marking the library as production-ready.
Changed #
- Cargo Workspace Architecture: Major refactor from monolithic crate to modular workspace structure.
zakat-core: Core mathematical logic, types, inputs, and Maal calculationszakat-i18n: Fluent localization with embedded locale files (en-US, id-ID, ar-SA)zakat-ledger: Hawl tracking and timeline analysis for wealth historyzakat-providers: Live pricing providers with Binance API integrationzakat-sqlite: SQLite persistence layer for ledger storagezakat: Thin facade crate re-exporting all public APIs (backwards compatible)
Added #
- WASM Providers Support: Live pricing now works on WebAssembly using
gloo-netinstead ofreqwest- Platform-specific implementations:
reqwestfor native,gloo-netfor WASM web-timefor WASM-compatible timing in cache logic#[async_trait(?Send)]for relaxed WASM trait bounds
- Platform-specific implementations:
Fixed #
- UUID WASM Randomness: Added
jsfeature touuidfor proper WASM random generation - Feature Flag Isolation: WASM-specific code now properly gated behind
feature = "wasm"only
Technical #
- Shared Dependencies: All common dependencies managed via
[workspace.dependencies] - Incremental Builds: Changes to one crate only rebuild affected crates
- Parallel Compilation: Independent crates compile in parallel
- 67 Tests Passing: All unit and integration tests verified across all platforms
Platform Support #
| Platform | Status |
|---|---|
| Native (Windows/Linux/macOS) | ✅ |
| WebAssembly (Browser) | ✅ |
| Python (PyO3) | ✅ |
| Dart/Flutter | ✅ |
| Android (UniFFI) | ✅ |
0.20.2 - 2026-01-02 #
Fixed #
- Publish Workflow: Fixed JSR and Dart publish scripts to correctly handle duplicate artifacts.
- Dart Metadata: Added missing
.pubignoreto allow publishing ofREADME.mdandLICENSEdespite being gitignored.
0.20.1 - 2026-01-02 #
Fixed #
- JSR Compliance: Resolved "Slow Types" errors.
- Provider Resilience: Added resilient Binance provider with IP fallback.
0.20.0 - 2026-01-02 #
Added #
- Temporal Ledger: Implemented
Al-Hawl Al-Haqiqi(True Hawl) tracking.- Added
LedgerAssetandLedgerEventfor event-sourced wealth reconstruction. - Added
LedgerStoretrait andJsonFileStorefor async persistence.
- Added
- Fiqh Features:
- Hawl Tracking: Precise day-count logic for Zakat eligibility (354 days).
- Purification (Tathir): Support for purifying mixed-income assets (e.g. stocks) before calculation.
- Pricing Providers:
- Binance Integration: Added
BinancePriceProviderwith DNS over HTTPS (DoH) bypass for censorship resistance. - Live Pricing:
Currencyenum andPriceProvidertrait improvements.
- Binance Integration: Added
- Internationalization:
- ICU4X: Migrated to
ICU4X1.5 for robust, locale-aware currency formatting (e.g., proper symbol placement, numbering systems).
- ICU4X: Migrated to
- Strict Validation:
ZakatConfignow strictly prevents zero-price silent failures for Gold/Silver.- WASM bindings are now panic-safe, returning structured
JsValueerrors.
Changed #
- Error Handling:
- Review: Boxed large
ZakatErrorvariants to optimize stack usage (clippy::result_large_err). - Localization: Refactored
ZakatErrorto fully support i18n with translation keys and arguments.
- Review: Boxed large
- Bindings & Integrations:
- Python: Optimized
to_dictperformance and removed internalserde_jsonoverhead. - Kotlin: Fixed silent failures, added
CalculationErrorvariant, and switched toStringinputs for financial precision. - Dart: Removed
rust_builderduplication and streamlined workspace integration.
- Python: Optimized
- Refactoring:
- DRY Macros: introduced universal
zakat_asset!macro to eliminate boilerplate across all asset modules. - Monetary Logic: Centralized monetary asset calculation logic to
src/maal/calculator.rs. - Deprecation: Removed legacy
add_*methods fromZakatPortfolio.
- DRY Macros: introduced universal
Fixed #
- Build System:
- Fixed WASM build errors by splitting and gating
tokiofeatures. - Fixed Kotlin binding silent errors.
- Fixed WASM build errors by splitting and gating
- Logic: Unified liability logic in
BusinessZakat(removedshort_term_liabilities).
0.19.0 - 2026-01-01 #
Changed #
- Global Translation State Refactor: Significant architectural overhaul to remove global static state.
- Removed: Global
TRANSLATORstatic fromsrc/i18n.rs. - Added:
translatorfield toZakatConfig, making it the owner of translation state. - Updated:
ZakatDetails::explain()and related methods now require&Translatorto be passed explicitly. - API: Added
default_translator()helper andconfig.explain()convenience method.
- Removed: Global
- Zakat Dart Refactor: Major architectural update to
zakat_dartintegration.- Workspace: Moved
zakat_dart/rustto root cargo workspace for better dependency management. - Type Safety: Replaced unsafe
String/f64passing with strictDecimaltypes across the FFI boundary usingFrbDecimal. - Dart Extensions: Implemented
Decimal <-> FrbDecimalconversion extensions for seamless DX.
- Workspace: Moved
0.18.0 - 2026-01-01 #
Added #
- Validation Trait: Exposed
is_valid()andvalidate_input()methods inCalculateZakattrait.- Allows checking for validity (e.g., negative inputs) without strictly running the full calculation.
- Asset Validation: Implemented
validate_input()for all asset types (Business,PreciousMetals,Livestock, etc.).
Fixed #
- Trait Bounds: Added
Serialize/DeserializetoZakatLocale, enabling proper serialization chains. - Config Usage: Fixed internal compilation error in
LivestockAssetsconfig resolution.
0.17.2 - 2026-01-01 #
Fixed #
- NPM/JSR Metadata: Fixed automated build to unconditionally sync
README.mdand metadata topkg/directory, ensuring NPM/JSR pages are up-to-date even if WASM build is cached/skipped.
0.17.1 - 2026-01-01 #
Fixed #
- Pub.dev Metadata: Updated
repositoryURL to correctly point to thezakat_dartsubdirectory, fixing package verification scores.
0.17.0 - 2025-12-31 #
Added #
- Panic-Free Setters (Complete): Extended deferred error handling to
PreciousMetals,InvestmentAssets, andIncomeZakatCalculator.- Setters like
weight(),debt(),income(),value()no longer panic on invalid input. - Errors are deferred and reported via
validate()orcalculate_zakat().
- Setters like
- Validation: Added
validate()method toInvestmentAssetsandIncomeZakatCalculator. - NPM Publication: Published as
@islamic/zakaton NPM with full WebAssembly support.- WASM bindings:
src/wasm.rsexposescalculate_portfolio_wasmandcalculate_single_assetfor JS consumers. - Hybrid Build: Configured for both Node.js and Browser environments via
wasm-pack. - Public Access: Scoped package
@islamicis configured for public access.
- WASM bindings:
Fixed #
- Trace Output: Fixed deserialization of
CalculationStepin tests. - Explain Output: Aligned
explain()output format in tests. - Added:
zakat_dartFlutter package for mobile/desktop apps, usingflutter_rust_bridge. - Added: Official JSR support (
@islam/zakat) with automated build scripts.
0.16.0 - 2025-12-31 #
Added #
- Internationalization (i18n) Support: Added robust i18n support using Project Fluent.
- New Locales: Added support for
en-US(English),id-ID(Indonesian), andar-SA(Arabic). - Localized Output:
ZakatDetailsnow providesexplain_in(locale)andsummary_in(locale)for localized calculation traces. - Currency Formatting: Added
CurrencyFormattertrait for locale-aware currency display (e.g.,Rpfor ID,,vs.separators). - Localized Warnings: Validation warnings are now structured for localization.
Changed #
- CalculationStep API: Refactored
CalculationStepto use translation keys instead of hardcoded English strings. - Inputs Input: Refined
sanitize_numeric_stringfor professional-grade heuristic parsing of international number formats.
0.15.0 - 2025-12-31 #
Added #
- Dynamic Trade Goods Rate:
aggregate_and_summarizenow uses the rate defined inZakatStrategy(e.g., 2.577%) instead of a hardcoded 2.5%. - Config Builder: Added
ZakatConfig::build()for explicit validation at the end of a configuration chain. - Diagnostic Reports: Enhanced
ZakatErrorwithcontext()returning structured JSON and improvedreport()output. - WASM structured Errors: WebAssembly functions now return detailed error objects with codes (
INVALID_INPUT,CONFIG_ERROR) instead of plain strings.
Performance #
- Zero-Copy Sanitization: Rewrote
sanitize_numeric_stringto use single-pass pre-allocation, significantly reducing memory churn during input parsing.
0.14.0 - 2025-12-31 #
Added #
- Security Hardening:
- DoS Prevention: Implemented
MAX_INPUT_LEN(64 chars) check for all numeric inputs to prevent memory exhaustion attacks. - Robust Sanitization: Stripped non-breaking spaces (
\u{00A0}) and invisible control characters from inputs. - Safe Env Loading:
ZakatConfig::from_env()now trims whitespace to prevent parsing errors from accidental padding.
- DoS Prevention: Implemented
- Async Performance:
- Parallel Execution: Refactored
calculate_total_asyncto useFuturesUnordered, allowing concurrent asset calculations (e.g., fetching multiple live prices in parallel).
- Parallel Execution: Refactored
- Observability:
- Tracing Integration: Added
tracinginstrumentation to core portfolio methods (calculate_total,calculate_total_async). - Validation Logs: Validation failures and value clamping (e.g., negative net assets) are now logged as
warn!.
- Tracing Integration: Added
- Developer Ergonomics:
- Config Layering: Added
ZakatConfig::merge(self, other)to support hierarchical configuration (e.g., defaults -> config file -> env vars).
- Config Layering: Added
0.13.0 - 2025-12-31 #
Added #
- Structured Explanation API: New
ZakatExplanationstruct for API consumers (React, Vue, etc.).- Added
to_explanation(&self) -> ZakatExplanationmethod toZakatDetails. - Refactored
explain()to useto_explanation().to_string().
- Added
- Aggregated Validation Errors: New
ZakatError::MultipleErrors(Vec<ZakatError>)variant.validate()now returns all collected errors, not just the first.- Updated
with_source(),with_asset_id(), andreport()to handleMultipleErrors.
- Portfolio Mutability: Added
get_mut(&mut self, id: Uuid) -> Option<&mut PortfolioItem>method.- Allows in-place modification of portfolio assets without remove/re-add.
- Explicit Locale Handling: New
InputLocaleenum andLocalizedInputstruct.- Added
with_locale(val, locale)helper for unambiguous parsing. - Locales:
US(1,000.00),EU(1.000,00),EasternArabic. - Example:
with_locale("€1.234,50", InputLocale::EU)→1234.50.
- Added
Changed #
- Panic-Free Purity Setter:
PreciousMetals::purity()no longer panics on invalid input.- Errors are collected in
_input_errorsand surfaced viavalidate()orcalculate_zakat(). - Added
_input_errors: Vec<ZakatError>field toPreciousMetals.
- Errors are collected in
Fixed #
- Non-Exhaustive Pattern: Fixed
report()method to handleMultipleErrorsvariant.
0.12.0 - 2025-12-31 #
Added #
- Arabic Numeral Support: Input parsing now handles Eastern Arabic numerals (
٠-٩) and Perso-Arabic numerals (۰-۹).- Example:
"١٢٣٤.٥٠"→1234.50
- Example:
- Enhanced Error Context: All
ZakatErrorvariants now include an optionalasset_id: Option<uuid::Uuid>field.- Added
ZakatError::with_asset_id(uuid)method for setting the asset ID. - Updated
ZakatError::report()to display the asset ID when present.
- Added
- Input Validation Method: Added
validate()method to asset structs usingzakat_asset!macro. - Livestock Optimization: Early return when
count == 0skips unnecessary calculations.
Changed #
- Panic-Free Setters: Fluent setters in
BusinessZakat,MiningAssets, and macro-generated structs no longer panic on invalid input.- Errors are collected and deferred until
validate()orcalculate_zakat()is called. - Breaking Change: Users who relied on immediate panics must now check
validate()or handle errors fromcalculate_zakat().
- Errors are collected and deferred until
- Config Partial Loading:
ZakatConfigoptional fields now use#[serde(default)], allowing partial JSON loading without errors on missing keys.- Fields:
rice_price_per_kg,rice_price_per_liter,cash_nisab_standard,nisab_gold_grams,nisab_silver_grams,nisab_agriculture_kg.
- Fields:
0.11.0 - 2025-12-31 #
Added #
- ID Restoration: Added
with_id(uuid::Uuid)method to all asset types for database/serialization restoration. - Gold Purity Validation:
PreciousMetals::purity()now validates that purity is between 1-24 Karat. - European Locale Support: Input parsing now handles European decimal format (e.g.,
€12,50→12.50).
Changed #
- Dynamic Trade Goods Rate: All calculators now use
config.strategy.get_rules().trade_goods_rateinstead of hardcoded2.5%.- Affected modules:
business,investments,income,mining,precious_metals.
- Affected modules:
- Fail-Fast Setters: Fluent setters now panic on invalid input instead of silently ignoring errors.
- Breaking Change: Invalid inputs will cause panics rather than defaulting to zero.
- Maintains DX-friendly fluent API (no
.unwrap()required by users).
Fixed #
- 100x Financial Error: Fixed locale-aware parsing bug where
€12,50was incorrectly parsed as1250. - 400% Asset Inflation: Fixed purity validation allowing
purity(100)which inflated gold value by100/24. - Strategy Pattern Disconnect: Fixed
trade_goods_ratefromZakatStrategybeing ignored.
0.10.0 - 2025-12-31 #
Added #
- Flexible Configuration Arguments:
- The
calculate_zakatmethod now accepts arguments implementingZakatConfigArgument. - Supported inputs:
&ZakatConfig(standard),Option<&ZakatConfig>(uses default if None),()(uses default config). - Example:
asset.calculate_zakat(())?orasset.calculate_zakat(None)?.
- The
- Convenience Method: Added
.calculate()method as a shortcut for.calculate_zakat(()).
Changed #
- Trait Definition: Refactored
CalculateZakattrait to use a generic config argumentC: ZakatConfigArgument.- Breaking Change: Manual implementations of
CalculateZakatmust update their method signature.
- Breaking Change: Manual implementations of
0.9.0 - 2025-12-31 #
Added #
- Robust Input Sanitization:
IntoZakatDecimalfor&strandStringnow automatically sanitizes input.- Removes commas (
,), underscores (_), and currency symbols ($,£,€,¥). - Handles whitespace gracefully (e.g.,
"$1,000.00"->1000.00).
- Structured Warning System:
- Added
warningsfield toZakatDetails. - Non-fatal issues (like negative net assets clamped to zero) are now reported in the
warningsvector. - Updated
explain()output to include a "WARNINGS" section when applicable.
- Added
0.8.0 - 2025-12-31 #
Added #
- Semantic Constructors: Introduced explicit, type-safe constructors for better DX:
BusinessZakat::cash_only(amount)PreciousMetals::gold(weight),PreciousMetals::silver(weight)IncomeZakatCalculator::from_salary(amount)InvestmentAssets::stock(value),InvestmentAssets::crypto(value)
- Configuration Presets: Added
ZakatConfig::hanafi()andZakatConfig::shafi()helper methods. - Unified Error Reporting: Added
ZakatError::report()for standardized diagnostics. - WASM Support: Added
wasmfeature flag andsrc/wasm.rsfacade for WebAssembly compatibility. - Safe Math Wrappers: Implemented checked arithmetic for all Decimal operations to prevent panics.
Changed #
- Direct Numeric Literals: The API now supports direct
f64literals (e.g.,0.025) usingIntoZakatDecimal. - Internal Optimization: Refactored internal library code (
src/) to usedec!macro for compile-time precision. - Portfolio API: Deprecated closure-based
add_*methods in favor of the generic.add(). - Refactor: Replaced
Decimal::newwithdec!in internal logic and test assertions.
Fixed #
- BusinessZakat ID: Fixed recursion stack overflow in
get_id(). - Warnings: Resolved unused import warnings across the codebase.
0.7.0 - 2025-12-30 #
Added #
- Serialization: Added
serdesupport forPortfolioItemenum, allowing full JSON save/load of Portfolios. - PortfolioItem Enum: Unified asset storage in Portfolio to a single enum for better type safety and serialization.
Changed #
- Doc Audit: Comprehensive review and cleanup of all documentation comments.
0.6.1 - 2025-12-30 #
Fixed #
- Error Handling: Improved error precision for Livestock calculations.
- Financial Precision: Enhanced rounding logic for monetary assets.
0.6.0 - 2025-12-30 #
Added #
- Fiqh Compliance Audit: Validated logic against classical Fiqh sources.
- Dynamic Portfolio: Added
add_with_id,replace, andremovemethods using stable UUIDs.
0.5.0 - 2025-12-30 #
Changed #
- Fluent Struct API: Complete migration from Builder Pattern to Fluent Structs (e.g.,
BusinessZakat::new().cash(...)). - Validation: Moved validation to
calculate_zakat()time rather than build time.
0.4.1 - 2025-12-30 #
Added #
- Async Documentation: Updated README with async usage examples.
- Dependency Updates: Bumped internal dependencies.
0.4.0 - 2025-12-30 #
Changed #
- Business Zakat API: Refactored
BusinessZakatto be more ergonomic. - Validation Hardening: Stricter checks for negative values in business assets.
0.3.0 - 2025-12-29 #
Added #
- Portfolio Resilience: Logic to handle partial failures in portfolio calculations.
- Unified Builder Pattern: Standardized builder implementation across all assets.
0.2.0 - 2025-12-29 #
Added #
- Strategy Pattern: Introduced
ZakatStrategytrait for pluggable calculation rules (Madhabs). - Type Safety: Enhanced type usage for better compile-time guarantees.
- Utils: Added utility functions for common Zakat math.
0.1.5 - 2025-12-29 #
Added #
- Livestock Reporting: Detailed breakage of "In-Kind" payments (e.g., "1 Bint Makhad").
- Config DX: Improved configuration ergonomics.
0.1.4 - 2025-12-29 #
Added #
- Asset Labeling: Added
.label("My Asset")support for better debugging. - Input Sanitization: Basic blocking of invalid negative inputs where sensible.