From c654f65bf1d9fce3fe01454dea436b3d3016c030 Mon Sep 17 00:00:00 2001 From: Eric Brown Date: Thu, 23 Oct 2025 20:04:58 -0400 Subject: [PATCH] feature: add serde support to LoadOptions --- Cargo.toml | 4 +++- src/lib.rs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1d72b07..f64c785 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,7 @@ arbitrary = ["arbitrary/derive"] futures = ["dep:futures-lite", "async"] tokio = ["dep:tokio", "async"] use_f64 = [] +serde = [] [dependencies] arbitrary = { version = "1.3.0", optional = true } @@ -35,10 +36,11 @@ ahash = { version = "0.8.7", optional = true } futures-lite = { version = "2.6.0", optional = true } log = { version = "0.4.17", optional = true } tokio = { version = "1.43.0", optional = true, features = ["io-util", "fs"] } +serde = { version = "1.0.228" } [dev-dependencies] tokio-test = "0.4.2" float_eq = "1.0.1" [package.metadata.docs.rs] -features = ["log", "merging", "reordering", "async", "futures", "tokio", "use_f64"] +features = ["log", "merging", "reordering", "async", "futures", "tokio", "use_f64", "serde"] diff --git a/src/lib.rs b/src/lib.rs index f94e3b8..b9f5c82 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -251,6 +251,9 @@ use std::future::Future; #[cfg(feature = "merging")] use std::mem::size_of; +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; + #[cfg(feature = "ahash")] type HashMap = ahash::AHashMap; @@ -422,6 +425,7 @@ pub struct Mesh { /// an offline path tracer or the like. #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[derive(Debug, Default, Clone, Copy)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct LoadOptions { /// Merge identical positions. ///