Skip to content

Commit

Permalink
fix: serde default all structs
Browse files Browse the repository at this point in the history
  • Loading branch information
manankarnik committed Jan 14, 2024
1 parent 2b484fe commit 4baf540
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Plugin for MapPlugin {

/// Component for map configuration
#[derive(Component, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default, rename_all = "camelCase")]
pub struct Map {
/// Noise configuration of the map
pub noise: Noise,
Expand Down
8 changes: 4 additions & 4 deletions src/noise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl fmt::Display for FunctionName {

/// Fractal function configuration
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default, rename_all = "camelCase")]
pub struct Function {
/// Name of the function
pub name: Option<FunctionName>,
Expand Down Expand Up @@ -98,7 +98,7 @@ impl Default for Function {

/// Region based on height
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default, rename_all = "camelCase")]
pub struct Region {
/// Label of the region
pub label: String,
Expand All @@ -120,7 +120,7 @@ impl Default for Region {

/// Gradient used to map color values
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default, rename_all = "camelCase")]
pub struct Gradient {
/// Image handle of gradient
#[serde(skip)]
Expand All @@ -146,7 +146,7 @@ impl Default for Gradient {

/// Noise configuration
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default, rename_all = "camelCase")]
pub struct Noise {
pub(crate) size: [u32; 2],
/// Seed of the noise
Expand Down
2 changes: 1 addition & 1 deletion src/planet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use crate::{

/// Component for planet configuration
#[derive(Component, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default, rename_all = "camelCase")]
pub struct Planet {
/// Seed of the noise
pub seed: u32,
Expand Down
2 changes: 1 addition & 1 deletion src/terrain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::{noise::generate_noise_map, noise::Noise, util::export_model};

/// Component for terrain configuration
#[derive(Component, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(default, rename_all = "camelCase")]
pub struct Terrain {
/// Noise configuration for terrain
pub noise: Noise,
Expand Down

0 comments on commit 4baf540

Please sign in to comment.