fresh_core/
file_explorer.rs1use serde::{Deserialize, Serialize};
2use std::path::PathBuf;
3use ts_rs::TS;
4
5#[derive(Debug, Clone, Serialize, Deserialize, TS)]
7#[serde(deny_unknown_fields)]
8#[ts(export)]
9pub struct FileExplorerDecoration {
10 #[ts(type = "string")]
12 pub path: PathBuf,
13 pub symbol: String,
15 #[ts(type = "[number, number, number]")]
17 pub color: [u8; 3],
18 #[serde(default)]
20 pub priority: i32,
21}
22
23#[cfg(feature = "plugins")]
24impl<'js> rquickjs::FromJs<'js> for FileExplorerDecoration {
25 fn from_js(_ctx: &rquickjs::Ctx<'js>, value: rquickjs::Value<'js>) -> rquickjs::Result<Self> {
26 rquickjs_serde::from_value(value).map_err(|e| rquickjs::Error::FromJs {
27 from: "object",
28 to: "FileExplorerDecoration",
29 message: Some(e.to_string()),
30 })
31 }
32}