-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmodels.rs
47 lines (40 loc) · 1.19 KB
/
models.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Tauri Python Plugin
// © Copyright 2024, by Marco Mengelkoch
// Licensed under MIT License, see License file for more details
// git clone https://github.com/marcomq/tauri-plugin-python
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StringRequest {
pub value: String,
}
#[cfg(any(feature = "pyo3", feature = "pyembed"))]
#[derive(Debug, Serialize, Deserialize, pyo3::IntoPyObject)]
#[serde(untagged)]
pub enum JsMany {
Bool(bool),
Number(u64),
Float(f64),
String(String),
StringVec(Vec<String>),
FloatVec(Vec<f64>),
}
#[cfg(all(not(feature = "pyo3"), not(feature = "pyembed")))]
use serde_json::Value as JsMany;
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RegisterRequest {
pub python_function_call: String,
pub number_of_args: Option<u8>,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct RunRequest {
pub function_name: String,
pub args: Vec<JsMany>,
}
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct StringResponse {
pub value: String,
}