diff options
| author | 2026-01-30 15:07:43 +0800 | |
|---|---|---|
| committer | 2026-01-30 15:07:43 +0800 | |
| commit | 2489003a79c59613ac81b19556c750192bdeac77 (patch) | |
| tree | 7ea2545095f67eaead3b279c628ad687f065980c /src-tauri/src/core | |
| parent | 2d830365f1424b8e4137dd3fbe239ba3d8b458a9 (diff) | |
| download | DropOut-2489003a79c59613ac81b19556c750192bdeac77.tar.gz DropOut-2489003a79c59613ac81b19556c750192bdeac77.zip | |
refactor(java): add TypeScript support to Java data structures
Diffstat (limited to 'src-tauri/src/core')
| -rw-r--r-- | src-tauri/src/core/java/mod.rs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src-tauri/src/core/java/mod.rs b/src-tauri/src/core/java/mod.rs index 770ba08..2215872 100644 --- a/src-tauri/src/core/java/mod.rs +++ b/src-tauri/src/core/java/mod.rs @@ -11,6 +11,7 @@ pub mod providers; pub mod validation; pub use error::JavaError; +use ts_rs::TS; /// Remove the UNC prefix (\\?\) from Windows paths pub fn strip_unc_prefix(path: PathBuf) -> PathBuf { @@ -31,7 +32,11 @@ use providers::AdoptiumProvider; const CACHE_DURATION_SECS: u64 = 24 * 60 * 60; -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[ts( + export, + export_to = "../../packages/ui-new/src/types/bindings/java/index.ts" +)] pub struct JavaInstallation { pub path: String, pub version: String, @@ -63,7 +68,11 @@ impl std::fmt::Display for ImageType { } } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[ts( + export, + export_to = "../../packages/ui-new/src/types/bindings/java/index.ts" +)] pub struct JavaReleaseInfo { pub major_version: u32, pub image_type: String, @@ -78,7 +87,11 @@ pub struct JavaReleaseInfo { pub architecture: String, } -#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[derive(Debug, Clone, Serialize, Deserialize, Default, TS)] +#[ts( + export, + export_to = "../../packages/ui-new/src/types/bindings/java/index.ts" +)] pub struct JavaCatalog { pub releases: Vec<JavaReleaseInfo>, pub available_major_versions: Vec<u32>, @@ -86,7 +99,11 @@ pub struct JavaCatalog { pub cached_at: u64, } -#[derive(Debug, Clone, Serialize)] +#[derive(Debug, Clone, Serialize, TS)] +#[ts( + export, + export_to = "../../packages/ui-new/src/types/bindings/java/index.ts" +)] pub struct JavaDownloadInfo { pub version: String, // e.g., "17.0.2+8" pub release_name: String, // e.g., "jdk-17.0.2+8" |