Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 33188735 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

RUST: At the end, we will use the rust things to load/save documents, it will...

RUST: At the end, we will use the rust things to load/save documents, it will be easier in the long run
parent d93daadc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #4230 en échec
......@@ -15,7 +15,7 @@
Simply use cmake to build in another folder of the source folder:
```bash
cmake -Bbuild -DCMAKE_CXX_COMPILER=clang++ -CDMAKE_INSTALL_PREFIX=$HOME/.local -GNinja
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -CDMAKE_INSTALL_PREFIX=$HOME/.local -GNinja
ninja -Cbuild
ninja -Cbuild install
```
......
......@@ -458,6 +458,7 @@ version = "1.0.108"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b"
dependencies = [
"indexmap 2.0.2",
"itoa",
"ryu",
"serde",
......@@ -686,6 +687,8 @@ version = "0.5.0"
dependencies = [
"cbindgen",
"log",
"serde",
"serde_json",
"vvs_ass",
]
......
......@@ -25,14 +25,18 @@ nom = { version = "7", default-features = false, features = ["std"] }
nom_locate = { version = "4", default-features = false, features = ["std"] }
# SerDe
toml = { version = "0.8", default-features = false, features = [
"parse",
"display",
serde_json = { version = "1", default-features = false, features = [
"std",
"preserve_order",
] }
serde = { version = "1", default-features = false, features = [
"std",
"derive",
] }
toml = { version = "0.8", default-features = false, features = [
"parse",
"display",
] }
[profile.release]
strip = true
......
......@@ -12,6 +12,8 @@ crate-type = ["staticlib"]
[dependencies]
log.workspace = true
serde.workspace = true
serde_json.workspace = true
vvs_ass = { path = "../vvs_ass" }
......
......@@ -7,6 +7,7 @@
use std::ffi::c_char;
pub mod ass;
pub mod vivy;
/// Represents a string slice, the user may not modify this slice, never! Note that the string is
/// not null terminated and may contains null bytes in it, use the len attribute to get the length
......
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
#[derive(Debug, PartialEq, Eq)]
pub enum VivyDocumentCapabilities {
AudioAble = (1 << 1),
VideoAble = (1 << 2),
AssAble = (1 << 3),
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "PascalCase")]
pub struct VivyDocument {
#[serde(default = "u64::default")]
pub capabilities: u64,
pub name: String,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "PascalCase")]
#[serde(tag = "DocumentVersion", content = "SubDocuments")]
pub enum VivySubDocument {
Alpha {
sub_ass: Option<PathBuf>,
sub_audio: Option<PathBuf>,
sub_video: Option<PathBuf>,
},
}
#[test]
fn test_deserialize() {
if let Err(err) = serde_json::from_str::<VivyDocument>(include_str!("../test/sample.vivy")) {
panic!("{err}")
}
}
{
"Name": "test",
"Capabilities": 12,
"DocumentVersion": "alpha",
"SubDocuments": {
"SubAss": "vivy/src/Rust/vvs_ass/utils/empty.ass",
"SubVideo": "data/4036f7f60c08bf70741f118eca95dff61facfb66199351e9e40900071cd5322d.mkv"
}
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter