playground_api/endpoints/versions.rs
1use serde::{Deserialize, Serialize};
2
3/// A response containing Rust compiler toolchain versions for different release channels.
4///
5/// Includes versions for stable, beta, and nightly channels.
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
7pub struct VersionsResponse {
8 /// The stable channel versions.
9 pub stable: ChannelVersion,
10 /// The beta channel versions.
11 pub beta: ChannelVersion,
12 /// The nightly channel versions.
13 pub nightly: ChannelVersion,
14}
15
16impl super::Response for VersionsResponse {}
17
18/// Tool versions for a specific Rust release channel.
19///
20/// Contains versions for rustc, rustfmt, clippy, and optionally miri.
21#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
22pub struct ChannelVersion {
23 /// Version information for `rustc`.
24 pub rustc: Version,
25 /// Version information for `rustfmt`.
26 pub rustfmt: Version,
27 /// Version information for `clippy`.
28 pub clippy: Version,
29 /// Optional version information for `miri`, if available.
30 #[serde(skip_serializing_if = "Option::is_none")]
31 pub miri: Option<Version>,
32}
33
34/// Version metadata for a specific tool in the Rust toolchain.
35///
36/// Includes the version string, commit hash, and release date.
37#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
38pub struct Version {
39 /// The version string (e.g., "1.70.0").
40 pub version: String,
41 /// The git commit hash of the release.
42 pub hash: String,
43 /// The release date (ISO 8601 format).
44 pub date: String,
45}