mirror of
https://github.com/Xevion/byte-me.git
synced 2025-12-06 01:14:33 -06:00
fix: use proper path, specify all models, place test in models.rs
This commit is contained in:
@@ -43,5 +43,3 @@ pub fn extract_streams(info: &ffprobe::FfProbe) -> Vec<StreamDetail> {
|
||||
|
||||
streams
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -96,16 +96,3 @@ pub fn run() {
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ts_rs::TS;
|
||||
|
||||
#[test]
|
||||
fn export_bindings() {
|
||||
// This will generate TypeScript bindings when you run `cargo test export_bindings`
|
||||
use crate::models::*;
|
||||
|
||||
StreamDetail::export_all_to("../../src/bindings").expect("Failed to export bindings");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
|
||||
#[ts(export)]
|
||||
pub enum MediaType {
|
||||
Audio,
|
||||
Video,
|
||||
@@ -15,7 +14,6 @@ pub enum MediaType {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
|
||||
#[ts(export)]
|
||||
pub struct StreamResult {
|
||||
pub path: String,
|
||||
pub filename: String,
|
||||
@@ -26,7 +24,6 @@ pub struct StreamResult {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
|
||||
#[ts(export)]
|
||||
pub enum StreamDetail {
|
||||
Video {
|
||||
codec: String,
|
||||
@@ -48,9 +45,22 @@ pub enum StreamDetail {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
|
||||
#[ts(export)]
|
||||
pub struct StreamResultError {
|
||||
pub filename: Option<String>,
|
||||
pub reason: String,
|
||||
pub error_type: String,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn export_bindings() {
|
||||
// This will generate TypeScript bindings when you run `cargo test export_bindings`
|
||||
use super::*;
|
||||
|
||||
StreamDetail::export_all_to("../src/bindings").expect("Failed to export bindings");
|
||||
StreamResult::export_all_to("../src/bindings").expect("Failed to export bindings");
|
||||
StreamResultError::export_all_to("../src/bindings").expect("Failed to export bindings");
|
||||
MediaType::export_all_to("../src/bindings").expect("Failed to export bindings");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user