cryptologo 0.1.0

Rust client for crypto-logo.com — 413 cryptocurrency logos in SVG, PNG, WebP, ICO
Documentation
# cryptologo

[![crates.io](https://img.shields.io/crates/v/cryptologo.svg)](https://crates.io/crates/cryptologo)
[![docs.rs](https://docs.rs/cryptologo/badge.svg)](https://docs.rs/cryptologo)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

Rust client for [crypto-logo.com](https://crypto-logo.com) — the cryptocurrency logo database with 413 coins in SVG, PNG, WebP, JPEG, and ICO formats. Async API powered by `reqwest` and `serde`.

Every logo is available as a scalable SVG vector and pre-generated raster derivatives in 13 standard sizes (16px to 2000px). Logos are served from Cloudflare R2 CDN with immutable cache headers.

> **Browse logos at [crypto-logo.com]https://crypto-logo.com**[API docs]https://crypto-logo.com/api/docs/

## Install

```toml
[dependencies]
cryptologo = "0.1"
tokio = { version = "1", features = ["full"] }
```

## Quick Start

```rust,no_run
use cryptologo::{CryptoLogo, LogoFormat};

#[tokio::main]
async fn main() -> Result<(), cryptologo::Error> {
    let client = CryptoLogo::new();

    // List all 413 coins sorted by market cap
    let coins = client.list_coins().await?;
    for coin in coins.iter().take(3) {
        println!("{} ({}) — rank #{:?}", coin.name, coin.ticker, coin.market_cap_rank);
    }

    // Download Bitcoin SVG logo
    let svg = client.get_logo("bitcoin-btc", LogoFormat::Svg, None).await?;
    std::fs::write("bitcoin.svg", &svg)?;

    // Generate CDN URL for embedding
    let url = client.get_cdn_url("ethereum-eth", LogoFormat::WebP, 128);
    println!("{}", url);
    // https://cdn.crypto-logo.com/logos/ethereum-eth/128x128/transparent.webp

    Ok(())
}
```

## What You Can Do

### List Coins

```rust,no_run
let coins = client.list_coins().await?;
let svg_coins: Vec<_> = coins.iter().filter(|c| c.has_svg).collect();
println!("{} coins have SVG logos", svg_coins.len());
```

### Fetch Logos

```rust,no_run
use cryptologo::{LogoFormat, LogoOptions};

// SVG vector (no options needed)
let svg = client.get_logo("bitcoin-btc", LogoFormat::Svg, None).await?;

// PNG at 256x256
let opts = LogoOptions { width: Some(256), ..Default::default() };
let png = client.get_logo("bitcoin-btc", LogoFormat::Png, Some(opts)).await?;

// OG image with white background
let og_opts = LogoOptions {
    width: Some(1200), height: Some(630), bg: Some("FFFFFF".into()),
};
let og = client.get_logo("bitcoin-btc", LogoFormat::Png, Some(og_opts)).await?;
```

### CDN URLs

```rust
// CDN URL for fast display
let url = client.get_cdn_url("bitcoin-btc", LogoFormat::WebP, 128);
// https://cdn.crypto-logo.com/logos/bitcoin-btc/128x128/transparent.webp
```

## Cryptocurrency Logo Standards

| Use Case | Format | Size |
|----------|--------|------|
| Website UI | SVG | Scalable |
| Exchange listing | PNG | 512x512 |
| Social/OG | PNG | 1200x630 |
| Favicon | ICO/SVG | 32x32 |

Pre-generated sizes: 16, 32, 48, 64, 96, 120, 128, 200, 256, 400, 512, 1024, 2000.

## API Reference

| Method | Returns | Description |
|--------|---------|-------------|
| `CryptoLogo::new()` | `CryptoLogo` | Create client |
| `list_coins()` | `Result<Vec<Coin>>` | All 413 coins |
| `get_logo(slug, fmt, opts)` | `Result<Vec<u8>>` | Logo bytes |
| `get_logo_url(slug, fmt, opts)` | `String` | API URL |
| `get_cdn_url(slug, fmt, width)` | `String` | CDN URL |
| `download_logo(slug, fmt, opts, path)` | `Result<()>` | Save to file |
| `get_asset(path)` | `Result<Vec<u8>>` | Variant/history |

## Also Available

| Platform | Package | Install |
|----------|---------|---------|
| **PyPI** | [cryptologo]https://pypi.org/project/cryptologo/ | `pip install cryptologo` |
| **npm** | [cryptologo]https://www.npmjs.com/package/cryptologo | `npm install cryptologo` |
| **Go** | [cryptologo-go]https://github.com/dobestan/cryptologo-go | `go get github.com/dobestan/cryptologo-go` |
| **Ruby** | [cryptologo]https://rubygems.org/gems/cryptologo | `gem install cryptologo` |

## License

MIT