SmallPict Rust SDK
Official Rust SDK for the SmallPict Image Optimization API — high-performance next-gen image transcoding (AVIF, WebP), smart compression, Edge CDN delivery, and cache purging.
⚡ Features
- 🦀 Pure Rust TLS Stack: Uses
rustls-tlsby default to avoid OpenSSL C-runtime issues. - ⚡ Dual Asynchronous & Blocking Modes: High-concurrency
tokioasync client and optional syncBlockingClient. - 🛡️ Secure HMAC-SHA256 & Bearer Auth: Tamper-proof payload verification.
- ✨ 4 Core Unified Methods:
optimize(),get_quota(),purge_cdn(), andvalidate_key(). - 🔄 Resilience & Fault Tolerance: Automatic
Idempotency-KeyUUID injection, 30s timeouts, and exponential backoff with jitter on HTTP 429/5xx. - 🔒 Zero-Leak Privacy: API keys and credentials are automatically wrapped in
SecretRedactedand masked inDisplay,Debug, and error logs.
📥 Installation
In your Cargo.toml:
[]
= "1.0"
To enable synchronous / blocking mode:
[]
= { = "1.0", = ["blocking"] }
🚀 Quick Start
1. Asynchronous Example (Tokio)
use ;
use fs;
async
2. Synchronous / Blocking Example
use BlockingClient;
use ;
use fs;
📊 Account Quota & Edge CDN Purge
// 1. Check real-time quota usage
let quota = client.get_quota.await?;
println!;
// 2. Invalidate Edge CDN cache
let purge = client.purge_cdn.await?;
println!;
🧪 Testing
📄 License
MIT © SmallPict Engineering