Skip to content

Commit

Permalink
Merge pull request #53 from thevilx/refactorModules
Browse files Browse the repository at this point in the history
merge time_ago & remaining_time to new time_diff module
  • Loading branch information
ali77gh authored Feb 4, 2024
2 parents b699be7 + 63b44be commit 4a5519f
Show file tree
Hide file tree
Showing 7 changed files with 375 additions and 437 deletions.
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ full = [
"number-to-words",
"get-bank-name-by-card-number",
"extract-card-number",
"time-ago",
"time-diff",
"get-place-by-iran-national-id",
"half-space",
"legal-id",
"words-to-number",
"sheba",
"remaining-time",
] # For now, by default we enable all features:


Expand All @@ -71,13 +70,12 @@ bill = ["dep:num", "dep:num-derive", "dep:num-traits", "dep:thiserror"]
number-to-words = ["dep:thiserror", "commas"]
get-bank-name-by-card-number = ["dep:thiserror"]
extract-card-number = []
time-ago = ["dep:thiserror", "dep:chrono"]
time-diff = ["dep:thiserror", "dep:chrono"]
get-place-by-iran-national-id = ["dep:thiserror"]
half-space = []
legal-id = ["dep:thiserror"]
words-to-number = ["dep:thiserror", "commas", "digits", "remove-ordinal-suffix"]
sheba = ["dep:thiserror"]
remaining-time = ["time-ago"]

[package.metadata.docs.rs]
all-features = true
Expand Down
12 changes: 3 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ all: build check test docs
fmt:
cargo fmt

build: full default add-ordinal-suffix commas digits find-capital-by-province persian-chars national-id remove-ordinal-suffix url-fix verity-card-number time-ago phone-number bill number-to-words get-bank-name-by-card-number extract-card-number get-place-by-iran-national-id half-space legal-id words-to-number sheba remaining-time
build: full default add-ordinal-suffix commas digits find-capital-by-province persian-chars national-id remove-ordinal-suffix url-fix verity-card-number phone-number bill number-to-words get-bank-name-by-card-number extract-card-number get-place-by-iran-national-id half-space legal-id words-to-number sheba time-diff

check: clippy lint

Expand Down Expand Up @@ -84,11 +84,6 @@ verity-card-number:
cargo build --no-default-features --features=verity-card-number
@ ls -sh target/debug/*.rlib

time-ago:
@ echo ""
cargo build --no-default-features --features=time-ago
@ ls -sh target/debug/*.rlib

number-plate:
@ echo ""
cargo build --no-default-features --features=number-plate
Expand Down Expand Up @@ -146,8 +141,7 @@ sheba:
cargo build --no-default-features --features=sheba
@ ls -sh target/debug/*.rlib

remaining-time:
time-diff:
@ echo ""
cargo build --no-default-features --features=remaining-time
cargo build --no-default-features --features=time-diff
@ ls -sh target/debug/*.rlib

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Rust🦀 implementation of [Persian-Tools](https://github.com/persian-tools/pers
- phone_number
- remove_ordinal_suffix
- sheba
- time_ago
- time_diff
- url_fix
- verity_card_number
- words_to_number
Expand Down
10 changes: 3 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
feature = "number-to-words",
feature = "get-bank-name-by-card-number",
feature = "extract-card-number",
feature = "time-ago",
feature = "get-place-by-iran-national-id",
feature = "half-space",
feature = "legal-id",
feature = "words-to-number",
feature = "sheba",
feature = "remaining-time",
feature = "time-diff",
)))]
compile_error!("No available Cargo feature is included");

Expand Down Expand Up @@ -72,8 +71,8 @@ pub mod get_bank_name_by_card_number;
#[cfg(feature = "extract-card-number")]
pub mod extract_card_number;

#[cfg(feature = "time-ago")]
pub mod time_ago;
#[cfg(feature = "time-diff")]
pub mod time_diff;

#[cfg(feature = "get-place-by-iran-national-id")]
pub mod get_place_by_iran_national_id;
Expand All @@ -89,6 +88,3 @@ pub mod words_to_number;

#[cfg(feature = "sheba")]
pub mod sheba;

#[cfg(feature = "remaining-time")]
pub mod remaining_time;
192 changes: 0 additions & 192 deletions src/remaining_time/mod.rs

This file was deleted.

Loading

0 comments on commit 4a5519f

Please sign in to comment.