From 987a6ade9b2a362c54d351c7b0475c551ba59c9f Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 18 Nov 2022 10:44:01 +0100 Subject: [PATCH] chore: Turn project structure into workspace --- .gitmodules | 3 ++ Cargo.lock | 29 +++++++++++++++++++ Cargo.toml | 27 ++--------------- crates/dtmt/Cargo.toml | 26 +++++++++++++++++ {src/bin => crates/dtmt/src}/cmd/build.rs | 2 +- .../dtmt/src}/cmd/bundle/decompress.rs | 6 ++-- .../dtmt/src}/cmd/bundle/extract.rs | 4 +-- .../dtmt/src}/cmd/bundle/inject.rs | 4 +-- .../dtmt/src}/cmd/bundle/list.rs | 4 +-- .../bin => crates/dtmt/src}/cmd/bundle/mod.rs | 4 +-- .../bin => crates/dtmt/src}/cmd/dictionary.rs | 26 +++++++++++++---- {src/bin => crates/dtmt/src}/cmd/murmur.rs | 2 +- {src/bin => crates/dtmt/src}/cmd/new.rs | 2 +- {src/bin => crates/dtmt/src}/cmd/util.rs | 0 {src/bin => crates/dtmt/src}/cmd/watch.rs | 2 +- src/bin/dtmt.rs => crates/dtmt/src/main.rs | 2 +- lib/sdk/Cargo.toml | 20 +++++++++++++ {src => lib/sdk/src}/binary.rs | 0 {src => lib/sdk/src}/bundle/file.rs | 0 {src => lib/sdk/src}/bundle/mod.rs | 0 {src => lib/sdk/src}/context.rs | 0 {src => lib/sdk/src}/filetype/lua.rs | 0 {src => lib/sdk/src}/filetype/mod.rs | 0 {src => lib/sdk/src}/lib.rs | 0 {src => lib/sdk/src}/murmur/dictionary.rs | 3 +- {src => lib/sdk/src}/murmur/mod.rs | 0 {src => lib/sdk/src}/murmur/murmurhash32.rs | 0 {src => lib/sdk/src}/murmur/murmurhash64.rs | 0 {src => lib/sdk/src}/oodle/mod.rs | 0 {src => lib/sdk/src}/oodle/types.rs | 14 +++------ lib/serde_sjson | 1 + 31 files changed, 124 insertions(+), 57 deletions(-) create mode 100644 .gitmodules create mode 100644 crates/dtmt/Cargo.toml rename {src/bin => crates/dtmt/src}/cmd/build.rs (86%) rename {src/bin => crates/dtmt/src}/cmd/bundle/decompress.rs (96%) rename {src/bin => crates/dtmt/src}/cmd/bundle/extract.rs (99%) rename {src/bin => crates/dtmt/src}/cmd/bundle/inject.rs (97%) rename {src/bin => crates/dtmt/src}/cmd/bundle/list.rs (95%) rename {src/bin => crates/dtmt/src}/cmd/bundle/mod.rs (94%) rename {src/bin => crates/dtmt/src}/cmd/dictionary.rs (88%) rename {src/bin => crates/dtmt/src}/cmd/murmur.rs (91%) rename {src/bin => crates/dtmt/src}/cmd/new.rs (87%) rename {src/bin => crates/dtmt/src}/cmd/util.rs (100%) rename {src/bin => crates/dtmt/src}/cmd/watch.rs (87%) rename src/bin/dtmt.rs => crates/dtmt/src/main.rs (99%) create mode 100644 lib/sdk/Cargo.toml rename {src => lib/sdk/src}/binary.rs (100%) rename {src => lib/sdk/src}/bundle/file.rs (100%) rename {src => lib/sdk/src}/bundle/mod.rs (100%) rename {src => lib/sdk/src}/context.rs (100%) rename {src => lib/sdk/src}/filetype/lua.rs (100%) rename {src => lib/sdk/src}/filetype/mod.rs (100%) rename {src => lib/sdk/src}/lib.rs (100%) rename {src => lib/sdk/src}/murmur/dictionary.rs (97%) rename {src => lib/sdk/src}/murmur/mod.rs (100%) rename {src => lib/sdk/src}/murmur/murmurhash32.rs (100%) rename {src => lib/sdk/src}/murmur/murmurhash64.rs (100%) rename {src => lib/sdk/src}/oodle/mod.rs (100%) rename {src => lib/sdk/src}/oodle/types.rs (94%) create mode 160000 lib/serde_sjson diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a56154d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/serde_sjson"] + path = lib/serde_sjson + url = git@git.sclu1034.dev:lucas/serde_sjson.git diff --git a/Cargo.lock b/Cargo.lock index 30f74b6..edcb074 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -190,7 +190,9 @@ dependencies = [ "libloading", "nanorand", "pin-project-lite", + "sdk", "serde", + "serde_sjson", "tempfile", "tokio", "tokio-stream", @@ -589,6 +591,26 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "sdk" +version = "0.1.0" +dependencies = [ + "color-eyre", + "csv-async", + "futures", + "futures-util", + "glob", + "libloading", + "nanorand", + "pin-project-lite", + "serde", + "serde_sjson", + "tokio", + "tokio-stream", + "tracing", + "tracing-error", +] + [[package]] name = "serde" version = "1.0.147" @@ -609,6 +631,13 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_sjson" +version = "0.1.0" +dependencies = [ + "serde", +] + [[package]] name = "sharded-slab" version = "0.1.4" diff --git a/Cargo.toml b/Cargo.toml index d964cbd..aef4708 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,27 +1,6 @@ -[package] -name = "dtmt" -version = "0.1.0" -edition = "2021" - -[dependencies] -clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "unicode"] } -color-eyre = "0.6.2" -csv-async = { version = "1.2.4", features = ["tokio", "serde"] } -futures = "0.3.25" -futures-util = "0.3.24" -glob = "0.3.0" -libloading = "0.7.4" -nanorand = "0.7.0" -pin-project-lite = "0.2.9" -serde = { version = "1.0.147", features = ["derive"] } -tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } -tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } -tracing = { version = "0.1.37", features = ["async-await"] } -tracing-error = "0.2.0" -tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } - -[dev-dependencies] -tempfile = "3.3.0" +[workspace] +resolver = "2" +members = ["crates/*", "lib/*"] [profile.release] strip = "debuginfo" diff --git a/crates/dtmt/Cargo.toml b/crates/dtmt/Cargo.toml new file mode 100644 index 0000000..a1add45 --- /dev/null +++ b/crates/dtmt/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "dtmt" +version = "0.1.0" +edition = "2021" + +[dependencies] +clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "unicode"] } +color-eyre = "0.6.2" +csv-async = { version = "1.2.4", features = ["tokio", "serde"] } +sdk = { path = "../../lib/sdk", version = "0.1.0" } +futures = "0.3.25" +futures-util = "0.3.24" +glob = "0.3.0" +libloading = "0.7.4" +nanorand = "0.7.0" +pin-project-lite = "0.2.9" +serde = { version = "1.0.147", features = ["derive"] } +serde_sjson = { path = "../../lib/serde_sjson", version = "0.1.0" } +tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } +tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } +tracing = { version = "0.1.37", features = ["async-await"] } +tracing-error = "0.2.0" +tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } + +[dev-dependencies] +tempfile = "3.3.0" diff --git a/src/bin/cmd/build.rs b/crates/dtmt/src/cmd/build.rs similarity index 86% rename from src/bin/cmd/build.rs rename to crates/dtmt/src/cmd/build.rs index a7089bb..eb4cad1 100644 --- a/src/bin/cmd/build.rs +++ b/crates/dtmt/src/cmd/build.rs @@ -19,6 +19,6 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(_ctx: Arc>, _matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(_ctx: Arc>, _matches: &ArgMatches) -> Result<()> { unimplemented!() } diff --git a/src/bin/cmd/bundle/decompress.rs b/crates/dtmt/src/cmd/bundle/decompress.rs similarity index 96% rename from src/bin/cmd/bundle/decompress.rs rename to crates/dtmt/src/cmd/bundle/decompress.rs index c1f08f3..9f3ed24 100644 --- a/src/bin/cmd/bundle/decompress.rs +++ b/crates/dtmt/src/cmd/bundle/decompress.rs @@ -5,8 +5,8 @@ use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; use color_eyre::eyre::{self, Result}; use color_eyre::{Help, SectionExt}; -use dtmt::decompress; use futures::future::try_join_all; +use sdk::decompress; use tokio::fs::{self, File}; use tokio::io::BufReader; use tokio::sync::RwLock; @@ -44,7 +44,7 @@ pub(crate) fn command_definition() -> Command { #[tracing::instrument(skip(ctx))] async fn decompress_bundle( - ctx: Arc>, + ctx: Arc>, bundle: P1, destination: P2, ) -> Result<()> @@ -60,7 +60,7 @@ where } #[tracing::instrument(skip_all)] -pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { let bundles = matches .get_many::("bundle") .unwrap_or_default() diff --git a/src/bin/cmd/bundle/extract.rs b/crates/dtmt/src/cmd/bundle/extract.rs similarity index 99% rename from src/bin/cmd/bundle/extract.rs rename to crates/dtmt/src/cmd/bundle/extract.rs index 6bb6113..d9e1dcc 100644 --- a/src/bin/cmd/bundle/extract.rs +++ b/crates/dtmt/src/cmd/bundle/extract.rs @@ -6,9 +6,9 @@ use color_eyre::{ eyre::{self, Context, Result}, Help, Report, SectionExt, }; -use dtmt::Bundle; use futures::future::try_join_all; use glob::Pattern; +use sdk::Bundle; use tokio::{fs, sync::RwLock}; use crate::cmd::util::collect_bundle_paths; @@ -117,7 +117,7 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { { let ljd_bin = matches .get_one::("ljd") diff --git a/src/bin/cmd/bundle/inject.rs b/crates/dtmt/src/cmd/bundle/inject.rs similarity index 97% rename from src/bin/cmd/bundle/inject.rs rename to crates/dtmt/src/cmd/bundle/inject.rs index a96250c..2cf1c74 100644 --- a/src/bin/cmd/bundle/inject.rs +++ b/crates/dtmt/src/cmd/bundle/inject.rs @@ -5,7 +5,7 @@ use color_eyre::{ eyre::{self, Context, Result}, Help, }; -use dtmt::Bundle; +use sdk::Bundle; use tokio::{fs::File, io::AsyncReadExt, sync::RwLock}; pub(crate) fn command_definition() -> Command { @@ -42,7 +42,7 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { let bundle_path = matches .get_one::("bundle") .expect("required parameter not found"); diff --git a/src/bin/cmd/bundle/list.rs b/crates/dtmt/src/cmd/bundle/list.rs similarity index 95% rename from src/bin/cmd/bundle/list.rs rename to crates/dtmt/src/cmd/bundle/list.rs index dd4345f..06c1f12 100644 --- a/src/bin/cmd/bundle/list.rs +++ b/crates/dtmt/src/cmd/bundle/list.rs @@ -4,8 +4,8 @@ use std::sync::Arc; use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; use color_eyre::eyre::{self, Result}; use color_eyre::{Help, SectionExt}; -use dtmt::Bundle; use futures::future::try_join_all; +use sdk::Bundle; use tokio::sync::RwLock; use crate::cmd::util::collect_bundle_paths; @@ -32,7 +32,7 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { let bundles = matches .get_many::("bundle") .unwrap_or_default() diff --git a/src/bin/cmd/bundle/mod.rs b/crates/dtmt/src/cmd/bundle/mod.rs similarity index 94% rename from src/bin/cmd/bundle/mod.rs rename to crates/dtmt/src/cmd/bundle/mod.rs index 21ecdca..93f2c45 100644 --- a/src/bin/cmd/bundle/mod.rs +++ b/crates/dtmt/src/cmd/bundle/mod.rs @@ -4,7 +4,7 @@ use clap::{Arg, ArgMatches, Command}; use color_eyre::eyre::Result; use tokio::sync::RwLock; -use dtmt::Oodle; +use sdk::Oodle; mod decompress; mod extract; @@ -39,7 +39,7 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { if let Some(name) = matches.get_one::("oodle") { let oodle = Oodle::new(name)?; let mut ctx = ctx.write().await; diff --git a/src/bin/cmd/dictionary.rs b/crates/dtmt/src/cmd/dictionary.rs similarity index 88% rename from src/bin/cmd/dictionary.rs rename to crates/dtmt/src/cmd/dictionary.rs index d160def..ea9986d 100644 --- a/src/bin/cmd/dictionary.rs +++ b/crates/dtmt/src/cmd/dictionary.rs @@ -1,16 +1,32 @@ use std::path::PathBuf; use std::sync::Arc; -use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; +use clap::{value_parser, Arg, ArgAction, ArgMatches, Command, ValueEnum}; use color_eyre::eyre::{Context, Result}; use color_eyre::{Help, SectionExt}; -use dtmt::murmur::HashGroup; use tokio::fs::File; use tokio::io::{AsyncBufReadExt, BufReader}; use tokio::sync::RwLock; use tokio_stream::wrappers::LinesStream; use tokio_stream::StreamExt; +#[derive(Copy, Clone, PartialEq, ValueEnum)] +pub enum HashGroup { + Filename, + Filetype, + Other, +} + +impl From for sdk::murmur::HashGroup { + fn from(value: HashGroup) -> Self { + match value { + HashGroup::Filename => sdk::murmur::HashGroup::Filename, + HashGroup::Filetype => sdk::murmur::HashGroup::Filetype, + HashGroup::Other => sdk::murmur::HashGroup::Other, + } + } +} + pub(crate) fn command_definition() -> Command { Command::new("dictionary") .about("Manipulate a hash dictionary file.") @@ -59,7 +75,7 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) -> Result<()> { match matches.subcommand() { Some(("lookup", sub_matches)) => { let hash = sub_matches @@ -72,7 +88,7 @@ pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) - let ctx = ctx.read().await; for group in groups { - let value = ctx.lookup_hash(*hash, *group); + let value = ctx.lookup_hash(*hash, (*group).into()); println!("{}", value); } @@ -98,7 +114,7 @@ pub(crate) async fn run(ctx: Arc>, matches: &ArgMatches) - { let mut ctx = ctx.write().await; for line in lines.into_iter() { - ctx.lookup.add(line?, *group); + ctx.lookup.add(line?, (*group).into()); } } diff --git a/src/bin/cmd/murmur.rs b/crates/dtmt/src/cmd/murmur.rs similarity index 91% rename from src/bin/cmd/murmur.rs rename to crates/dtmt/src/cmd/murmur.rs index 51cdd2a..a5e53f4 100644 --- a/src/bin/cmd/murmur.rs +++ b/crates/dtmt/src/cmd/murmur.rs @@ -31,6 +31,6 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(_ctx: Arc>, _matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(_ctx: Arc>, _matches: &ArgMatches) -> Result<()> { unimplemented!() } diff --git a/src/bin/cmd/new.rs b/crates/dtmt/src/cmd/new.rs similarity index 87% rename from src/bin/cmd/new.rs rename to crates/dtmt/src/cmd/new.rs index b076823..2c3755a 100644 --- a/src/bin/cmd/new.rs +++ b/crates/dtmt/src/cmd/new.rs @@ -17,6 +17,6 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(_ctx: Arc>, _matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(_ctx: Arc>, _matches: &ArgMatches) -> Result<()> { unimplemented!() } diff --git a/src/bin/cmd/util.rs b/crates/dtmt/src/cmd/util.rs similarity index 100% rename from src/bin/cmd/util.rs rename to crates/dtmt/src/cmd/util.rs diff --git a/src/bin/cmd/watch.rs b/crates/dtmt/src/cmd/watch.rs similarity index 87% rename from src/bin/cmd/watch.rs rename to crates/dtmt/src/cmd/watch.rs index 07e8b4a..4a481d0 100644 --- a/src/bin/cmd/watch.rs +++ b/crates/dtmt/src/cmd/watch.rs @@ -21,6 +21,6 @@ pub(crate) fn command_definition() -> Command { } #[tracing::instrument(skip_all)] -pub(crate) async fn run(_ctx: Arc>, _matches: &ArgMatches) -> Result<()> { +pub(crate) async fn run(_ctx: Arc>, _matches: &ArgMatches) -> Result<()> { unimplemented!() } diff --git a/src/bin/dtmt.rs b/crates/dtmt/src/main.rs similarity index 99% rename from src/bin/dtmt.rs rename to crates/dtmt/src/main.rs index 98ecd5c..c000f57 100644 --- a/src/bin/dtmt.rs +++ b/crates/dtmt/src/main.rs @@ -65,7 +65,7 @@ async fn main() -> Result<()> { .init(); } - let ctx = dtmt::Context::new(); + let ctx = sdk::Context::new(); let ctx = Arc::new(RwLock::new(ctx)); { diff --git a/lib/sdk/Cargo.toml b/lib/sdk/Cargo.toml new file mode 100644 index 0000000..c0e6b50 --- /dev/null +++ b/lib/sdk/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "sdk" +version = "0.1.0" +edition = "2021" + +[dependencies] +color-eyre = "0.6.2" +csv-async = { version = "1.2.4", features = ["tokio", "serde"] } +futures = "0.3.25" +futures-util = "0.3.24" +glob = "0.3.0" +libloading = "0.7.4" +nanorand = "0.7.0" +pin-project-lite = "0.2.9" +serde = { version = "1.0.147", features = ["derive"] } +serde_sjson = { path = "../../lib/serde_sjson", version = "0.1.0" } +tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } +tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } +tracing = { version = "0.1.37", features = ["async-await"] } +tracing-error = "0.2.0" diff --git a/src/binary.rs b/lib/sdk/src/binary.rs similarity index 100% rename from src/binary.rs rename to lib/sdk/src/binary.rs diff --git a/src/bundle/file.rs b/lib/sdk/src/bundle/file.rs similarity index 100% rename from src/bundle/file.rs rename to lib/sdk/src/bundle/file.rs diff --git a/src/bundle/mod.rs b/lib/sdk/src/bundle/mod.rs similarity index 100% rename from src/bundle/mod.rs rename to lib/sdk/src/bundle/mod.rs diff --git a/src/context.rs b/lib/sdk/src/context.rs similarity index 100% rename from src/context.rs rename to lib/sdk/src/context.rs diff --git a/src/filetype/lua.rs b/lib/sdk/src/filetype/lua.rs similarity index 100% rename from src/filetype/lua.rs rename to lib/sdk/src/filetype/lua.rs diff --git a/src/filetype/mod.rs b/lib/sdk/src/filetype/mod.rs similarity index 100% rename from src/filetype/mod.rs rename to lib/sdk/src/filetype/mod.rs diff --git a/src/lib.rs b/lib/sdk/src/lib.rs similarity index 100% rename from src/lib.rs rename to lib/sdk/src/lib.rs diff --git a/src/murmur/dictionary.rs b/lib/sdk/src/murmur/dictionary.rs similarity index 97% rename from src/murmur/dictionary.rs rename to lib/sdk/src/murmur/dictionary.rs index 3f4a280..a293f6a 100644 --- a/src/murmur/dictionary.rs +++ b/lib/sdk/src/murmur/dictionary.rs @@ -1,4 +1,3 @@ -use clap::ValueEnum; use color_eyre::{eyre::Context, Help, Result, SectionExt}; use csv_async::{AsyncDeserializer, AsyncSerializer}; use serde::{Deserialize, Serialize}; @@ -7,7 +6,7 @@ use tokio_stream::StreamExt; use super::{murmurhash64, Murmur32, Murmur64, SEED}; -#[derive(Copy, Clone, Deserialize, PartialEq, Serialize, ValueEnum)] +#[derive(Copy, Clone, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "snake_case")] pub enum HashGroup { Filename, diff --git a/src/murmur/mod.rs b/lib/sdk/src/murmur/mod.rs similarity index 100% rename from src/murmur/mod.rs rename to lib/sdk/src/murmur/mod.rs diff --git a/src/murmur/murmurhash32.rs b/lib/sdk/src/murmur/murmurhash32.rs similarity index 100% rename from src/murmur/murmurhash32.rs rename to lib/sdk/src/murmur/murmurhash32.rs diff --git a/src/murmur/murmurhash64.rs b/lib/sdk/src/murmur/murmurhash64.rs similarity index 100% rename from src/murmur/murmurhash64.rs rename to lib/sdk/src/murmur/murmurhash64.rs diff --git a/src/oodle/mod.rs b/lib/sdk/src/oodle/mod.rs similarity index 100% rename from src/oodle/mod.rs rename to lib/sdk/src/oodle/mod.rs diff --git a/src/oodle/types.rs b/lib/sdk/src/oodle/types.rs similarity index 94% rename from src/oodle/types.rs rename to lib/sdk/src/oodle/types.rs index 4c99a1d..ee6c3fb 100644 --- a/src/oodle/types.rs +++ b/lib/sdk/src/oodle/types.rs @@ -1,8 +1,6 @@ #![allow(dead_code)] use core::ffi::{c_char, c_int, c_size_t, c_ulonglong, c_void}; -use clap::ValueEnum; - // Type definitions taken from Unreal Engine's `oodle2.h` #[repr(C)] @@ -44,19 +42,18 @@ impl From for OodleLZ_CheckCRC { #[repr(C)] #[allow(non_camel_case_types)] -#[derive(Clone, Copy, Debug, ValueEnum)] +#[derive(Clone, Copy, Debug)] pub enum OodleLZ_Verbosity { None = 0, Minimal = 1, Some = 2, Lots = 3, - #[clap(hide = true)] Force32 = 0x40000000, } #[repr(C)] #[allow(non_camel_case_types)] -#[derive(Clone, Copy, Debug, ValueEnum)] +#[derive(Clone, Copy, Debug)] pub enum OodleLZ_Decode_ThreadPhase { Phase1 = 1, Phase2 = 2, @@ -69,9 +66,8 @@ impl OodleLZ_Decode_ThreadPhase { #[repr(C)] #[allow(non_camel_case_types)] -#[derive(Clone, Copy, Debug, ValueEnum)] +#[derive(Clone, Copy, Debug)] pub enum OodleLZ_Compressor { - #[clap(hide = true)] Invalid = -1, // None = memcpy, pass through uncompressed bytes None = 3, @@ -97,13 +93,12 @@ pub enum OodleLZ_Compressor { Lzblw = 5, Lza = 6, Count = 14, - #[clap(hide = true)] Force32 = 0x40000000, } #[repr(C)] #[allow(non_camel_case_types)] -#[derive(Clone, Copy, Debug, ValueEnum)] +#[derive(Clone, Copy, Debug)] pub enum OodleLZ_CompressionLevel { // don't compress, just copy raw bytes None = 0, @@ -133,7 +128,6 @@ pub enum OodleLZ_CompressionLevel { HyperFast3 = -3, // fastest, less compression HyperFast4 = -4, - #[clap(hide = true)] Force32 = 0x40000000, } diff --git a/lib/serde_sjson b/lib/serde_sjson new file mode 160000 index 0000000..b53949d --- /dev/null +++ b/lib/serde_sjson @@ -0,0 +1 @@ +Subproject commit b53949d5df34f3407e09cdc21da426e64b976832