| Crates.io | world-shipping |
| lib.rs | world-shipping |
| version | 0.2.2 |
| created_at | 2025-07-12 20:41:33.543551+00 |
| updated_at | 2025-07-15 10:36:49.569048+00 |
| description | A simple shipping calculator |
| homepage | https://gofranz.com/ |
| repository | https://github.com/franzos/world-tax-rs |
| max_upload_size | |
| id | 1749680 |
| size | 82,351 |
This is meant to be used to calculate standard shipping rates wordwide, based on origin country and destination country, size and weight, and required level of service.
There's a couple of things to keep in mind:
I cannot guarantee that this is 100% accurate, nor up to date.
Best practice:
If something is off, I'd appreciate a PR.
let db = ShippingDatabase::from_file("shipping_rates.json").unwrap();
let query = ShippingRateQuery {
source_region: Region::new("DE".to_string(), None).expect("Country code to be valid"),
destination_region: Region::new("FR".to_string(), None).expect("Country code to be valid"),
items: vec![ShippingItem {
identifier: "small_package".to_string(),
weight: Some(1500),
length: Some(30),
width: Some(20),
height: Some(2),
}],
provider: Some(Provider::DPD),
service_level: Some(ServiceLevel::Standard),
};
let results = db.get_total_shipping_cost(&query).unwrap();
The available providers and service levels, depend on the country of origin.
Provider::DHL
ServiceLevel::StandardServiceLevel::ExpressProvider::DPD
ServiceLevel::StandardProvider::LaPoste
ServiceLevel::StandardIf you are shipping from Germany, or France, this package will have some use for you; Otherwise, feel free to add more countries, providers and service levels to the JSON file and submit a PR.
Generate TypeScript types using typeshare:
cargo install typeshare-cli
typeshare . --lang=typescript --output-file=types.ts
RUST_LOG=debug cargo test -- --nocapture
RUST_LOG=debug cargo test -- --test-threads=1 --nocapture
Compile and start server:
guix shell -m manifest.scm
cargo build
Clippy:
docker run --rm -v $(pwd):/app -w /app rust:1.82 sh \
-c "rustup component add clippy && cargo clippy \
--all-targets --all-features -- -D warnings"
Format:
docker run --rm -v $(pwd):/app -w /app rust:1.82 sh \
-c "rustup component add rustfmt && cargo fmt --all"