rstructor 0.3.2

Get structured, validated data out of LLMs as native Rust structs and enums. Derive a type and rstructor generates the JSON Schema, prompts the model, parses the reply, and retries on validation errors — across OpenAI, Anthropic Claude, Google Gemini, and xAI Grok. The Rust answer to Python's Pydantic + Instructor.
Documentation
use rstructor::MediaFile;

pub const RUST_LOGO_URL: &str = "https://www.rust-lang.org/logos/rust-logo-512x512.png";
pub const RUST_LOGO_MIME: &str = "image/png";

#[allow(dead_code)]
pub const RUST_SOCIAL_URL: &str = "https://www.rust-lang.org/static/images/rust-social-wide.jpg";
#[allow(dead_code)]
pub const RUST_SOCIAL_MIME: &str = "image/jpeg";

pub async fn download_media(url: &str, mime: &str) -> MediaFile {
    let bytes = reqwest::get(url)
        .await
        .expect("Failed to download media fixture")
        .bytes()
        .await
        .expect("Failed to read media fixture bytes");
    MediaFile::from_bytes(&bytes, mime)
}

#[allow(dead_code)]
pub fn media_url(url: &str, mime: &str) -> MediaFile {
    MediaFile::new(url, mime)
}