playground-api 0.5.1

Simple API-binding for The Rust Playground
Documentation
use serde::{Deserialize, Serialize};
use std::borrow::Cow;

/// Represents metadata about a crate available on the Rust playground.
///
/// Includes the crate's name, version, and unique identifier.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct CrateInformation<'a> {
    /// The name of the crate.
    pub name: Cow<'a, str>,
    /// The version of the crate.
    pub version: Cow<'a, str>,
    /// The unique identifier for the crate.
    pub id: Cow<'a, str>,
}

/// A response containing a list of available crates on the Rust playground.
///
/// Each crate is represented by a [`CrateInformation`] struct.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub struct CratesResponse<'a> {
    /// A list of available crates.
    pub crates: Vec<CrateInformation<'a>>,
}

impl<'a> super::Response for CratesResponse<'a> {}