ThunkMetrc Rust Wrapper SDK
Type-safe, rate-limited, async Rust wrapper for the Metrc API.
📦 Installation
Add to your Cargo.toml:
[]
= "0.3.3"
= "0.3.3"
= { = "1.0", = ["full"] }
= "0.3"
🚀 Getting Started
1. Initialize
Use MetrcFactory to handle shared rate limiting effectively.
use MetrcFactory;
use MetrcWrapper;
async
2. Make Requests
All service methods are async and return Result<Option<T>, Error>.
match wrapper.facilities.get_facilities.await
3. Pagination (Streams)
Use the iterate_ methods to get a Stream of items, automatically handling page traversal.
use StreamExt;
let mut stream = wrapper.packages.iterate_get_active_packages;
while let Some = stream.next.await
🛡️ Rate Limiting
The SDK uses MetrcRateLimiter to enforce:
- Integrator Limits: Default 150/sec.
- Facility Limits: Default 50/sec per facility.
- Backoff: Exponential backoff on 429/500 errors.
- Retries: Automatic retry logic properly handling
Retry-After.
Configuration is handled via the MetrcFactory.