Skip to content

Commit 8f7f0f5

Browse files
Firestar99urisinger
authored andcommitted
Remove the serde feature and instead just always require it (GraphiteEditor#2737)
workspace: remove feature `serde`, always require it instead
1 parent 733c501 commit 8f7f0f5

34 files changed

+161
-297
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ bezier-rs = { path = "libraries/bezier-rs", features = ["dyn-any", "serde"] }
3535
dyn-any = { path = "libraries/dyn-any", features = ["derive", "glam", "reqwest", "log-bad-types", "rc"] }
3636
math-parser = { path = "libraries/math-parser" }
3737
path-bool = { path = "libraries/path-bool" }
38-
graphene-core = { path = "node-graph/gcore", default-features = false }
39-
graph-craft = { path = "node-graph/graph-craft", features = ["serde"] }
38+
graphene-core = { path = "node-graph/gcore" }
39+
graph-craft = { path = "node-graph/graph-craft" }
4040
graphene-std = { path = "node-graph/gstd" }
4141
interpreted-executor = { path = "node-graph/interpreted-executor" }
4242
node-macro = { path = "node-graph/node-macro" }
@@ -130,7 +130,7 @@ kurbo = { version = "0.11.0", features = ["serde"] }
130130
petgraph = { version = "0.7.1", default-features = false, features = [
131131
"graphmap",
132132
] }
133-
half = { version = "2.4.1", default-features = false, features = ["bytemuck"] }
133+
half = { version = "2.4.1", default-features = false, features = ["bytemuck", "serde"] }
134134
tinyvec = { version = "1" }
135135
criterion = { version = "0.5", features = ["html_reports"] }
136136
iai-callgrind = { version = "0.12.3" }

editor/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ ron = ["dep:ron"]
2727
# Local dependencies
2828
graphite-proc-macros = { workspace = true }
2929
graph-craft = { workspace = true }
30-
interpreted-executor = { workspace = true, features = [
31-
"serde",
32-
] }
33-
graphene-std = { workspace = true, features = ["serde"] }
30+
interpreted-executor = { workspace = true }
31+
graphene-std = { workspace = true }
3432

3533
# Workspace dependencies
3634
js-sys = { workspace = true }

node-graph/gcore/Cargo.toml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ wasm = ["web-sys"]
1414
wgpu = ["dep:wgpu"]
1515
vello = ["dep:vello", "bezier-rs/kurbo", "wgpu"]
1616
dealloc_nodes = []
17-
serde = [
18-
"dep:serde",
19-
"glam/serde",
20-
"bezier-rs/serde",
21-
"bezier-rs/serde",
22-
"half/serde",
23-
"base64",
24-
]
2517

2618
[dependencies]
2719
# Local dependencies
@@ -49,10 +41,10 @@ half = { workspace = true }
4941
tinyvec = { workspace = true }
5042
kurbo = { workspace = true }
5143
log = { workspace = true }
44+
base64 = { workspace = true }
5245

5346
# Optional workspace dependencies
5447
serde = { workspace = true, optional = true }
55-
base64 = { workspace = true, optional = true }
5648
vello = { workspace = true, optional = true }
5749
wgpu = { workspace = true, optional = true }
5850
web-sys = { workspace = true, optional = true }

node-graph/gcore/src/animation.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use crate::{Ctx, ExtractAnimationTime, ExtractTime};
22

33
const DAY: f64 = 1000. * 3600. * 24.;
44

5-
#[derive(Debug, Clone, Copy, PartialEq, Eq, dyn_any::DynAny, Default, Hash, node_macro::ChoiceType)]
6-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5+
#[derive(Debug, Clone, Copy, PartialEq, Eq, dyn_any::DynAny, Default, Hash, node_macro::ChoiceType, serde::Serialize, serde::Deserialize)]
76
pub enum RealTimeMode {
87
#[label("UTC")]
98
Utc,

node-graph/gcore/src/application_io.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ use std::ptr::addr_of;
1111
use std::sync::Arc;
1212
use std::time::Duration;
1313

14-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
15-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
1615
pub struct SurfaceId(pub u64);
1716

1817
impl std::fmt::Display for SurfaceId {
@@ -21,8 +20,7 @@ impl std::fmt::Display for SurfaceId {
2120
}
2221
}
2322

24-
#[derive(Debug, Clone, Copy, PartialEq)]
25-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
23+
#[derive(Debug, Clone, Copy, PartialEq, serde::Serialize, serde::Deserialize)]
2624
pub struct SurfaceFrame {
2725
pub surface_id: SurfaceId,
2826
pub resolution: UVec2,

node-graph/gcore/src/graphic_element.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ use std::hash::Hash;
1212

1313
pub mod renderer;
1414

15-
#[derive(Copy, Clone, Debug, PartialEq, DynAny, specta::Type)]
16-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15+
#[derive(Copy, Clone, Debug, PartialEq, DynAny, specta::Type, serde::Serialize, serde::Deserialize)]
1716
#[serde(default)]
1817
pub struct AlphaBlending {
1918
pub blend_mode: BlendMode,
@@ -74,15 +73,13 @@ impl AlphaBlending {
7473
pub fn migrate_graphic_group<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<GraphicGroupTable, D::Error> {
7574
use serde::Deserialize;
7675

77-
#[derive(Clone, Debug, PartialEq, DynAny, Default)]
78-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
76+
#[derive(Clone, Debug, PartialEq, DynAny, Default, serde::Serialize, serde::Deserialize)]
7977
pub struct OldGraphicGroup {
8078
elements: Vec<(GraphicElement, Option<NodeId>)>,
8179
transform: DAffine2,
8280
alpha_blending: AlphaBlending,
8381
}
84-
#[derive(Clone, Debug, PartialEq, DynAny, Default)]
85-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
82+
#[derive(Clone, Debug, PartialEq, DynAny, Default, serde::Serialize, serde::Deserialize)]
8683
pub struct GraphicGroup {
8784
elements: Vec<(GraphicElement, Option<NodeId>)>,
8885
}
@@ -162,8 +159,7 @@ impl From<RasterDataTable<GPU>> for GraphicGroupTable {
162159
}
163160

164161
/// The possible forms of graphical content held in a Vec by the `elements` field of [`GraphicElement`].
165-
#[derive(Clone, Debug, Hash, PartialEq, DynAny)]
166-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
162+
#[derive(Clone, Debug, Hash, PartialEq, DynAny, serde::Serialize, serde::Deserialize)]
167163
pub enum GraphicElement {
168164
/// Equivalent to the SVG <g> tag: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g
169165
GraphicGroup(GraphicGroupTable),
@@ -279,8 +275,7 @@ impl serde::Serialize for Raster<GPU> {
279275
}
280276

281277
/// Some [`ArtboardData`] with some optional clipping bounds that can be exported.
282-
#[derive(Clone, Debug, Hash, PartialEq, DynAny)]
283-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
278+
#[derive(Clone, Debug, Hash, PartialEq, DynAny, serde::Serialize, serde::Deserialize)]
284279
pub struct Artboard {
285280
pub graphic_group: GraphicGroupTable,
286281
pub label: String,
@@ -313,8 +308,7 @@ impl Artboard {
313308
pub fn migrate_artboard_group<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<ArtboardGroupTable, D::Error> {
314309
use serde::Deserialize;
315310

316-
#[derive(Clone, Default, Debug, Hash, PartialEq, DynAny)]
317-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
311+
#[derive(Clone, Default, Debug, Hash, PartialEq, DynAny, serde::Serialize, serde::Deserialize)]
318312
pub struct ArtboardGroup {
319313
pub artboards: Vec<(Artboard, Option<NodeId>)>,
320314
}

node-graph/gcore/src/graphic_element/renderer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,7 @@ pub fn to_transform(transform: DAffine2) -> usvg::Transform {
350350

351351
// TODO: Click targets can be removed from the render output, since the vector data is available in the vector modify data from Monitor nodes.
352352
// This will require that the transform for child layers into that layer space be calculated, or it could be returned from the RenderOutput instead of click targets.
353-
#[derive(Debug, Default, Clone, PartialEq, DynAny)]
354-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
353+
#[derive(Debug, Default, Clone, PartialEq, DynAny, serde::Serialize, serde::Deserialize)]
355354
pub struct RenderMetadata {
356355
pub upstream_footprints: HashMap<NodeId, Footprint>,
357356
pub local_transforms: HashMap<NodeId, DAffine2>,

node-graph/gcore/src/memo.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ pub struct MemoHash<T: Hash> {
149149
value: T,
150150
}
151151

152-
#[cfg(feature = "serde")]
153152
impl<'de, T: serde::Deserialize<'de> + Hash> serde::Deserialize<'de> for MemoHash<T> {
154153
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
155154
where
@@ -159,7 +158,6 @@ impl<'de, T: serde::Deserialize<'de> + Hash> serde::Deserialize<'de> for MemoHas
159158
}
160159
}
161160

162-
#[cfg(feature = "serde")]
163161
impl<T: Hash + serde::Serialize> serde::Serialize for MemoHash<T> {
164162
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
165163
where

node-graph/gcore/src/ops.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,7 @@ fn extract_xy<T: Into<DVec2>>(_: impl Ctx, #[implementations(DVec2, IVec2, UVec2
534534
}
535535

536536
/// The X or Y component of a coordinate.
537-
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
538-
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type)]
537+
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash, DynAny, node_macro::ChoiceType, specta::Type, serde::Serialize, serde::Deserialize)]
539538
#[widget(Dropdown)]
540539
pub enum XY {
541540
#[default]

0 commit comments

Comments
 (0)