From e3f74d3f3eea5cf6f4952a9cc33f99ee7a2ca040 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Thu, 23 Feb 2023 18:08:41 +0900 Subject: [PATCH] Remove serde dependency --- Cargo.lock | 21 --------------------- Cargo.toml | 2 +- src/faux_quicksilver.rs | 12 +++++------- src/original_impl.rs | 15 +++++++-------- 4 files changed, 13 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 712ae33..138bf64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,7 +97,6 @@ version = "0.1.1" dependencies = [ "bindgen", "rand", - "serde", ] [[package]] @@ -245,26 +244,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "shlex" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index aeb771b..ca9de88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" [dependencies] #quicksilver = { version = "0.3.19", default-features = false, features = [ "fonts", "saving", "sounds" ] } rand = "0.7.2" -serde = { version = "1.0.101", features = ["derive"] } +#serde = { version = "1.0.101", features = ["derive"] } [build-dependencies] bindgen = "0.64" diff --git a/src/faux_quicksilver.rs b/src/faux_quicksilver.rs index e3630c9..33fd4a4 100644 --- a/src/faux_quicksilver.rs +++ b/src/faux_quicksilver.rs @@ -2,13 +2,11 @@ use std::collections::HashMap; use std::ops::{Add, AddAssign, Mul, Sub, SubAssign}; use std::path::Path; -use serde::{Deserialize, Serialize}; - use crate::agnostic_interface::{ FontInterface, GameInterface, ImageInterface, MusicInterface, SoundInterface, }; -#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct Color { pub r: u8, pub g: u8, @@ -43,7 +41,7 @@ impl Color { } } -#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Copy, Clone, Debug, PartialEq)] pub struct Rectangle { pub x: f32, pub y: f32, @@ -73,7 +71,7 @@ impl Default for Rectangle { } } -#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Copy, Clone, Debug, PartialEq)] pub struct Circle { pub x: f32, pub y: f32, @@ -91,7 +89,7 @@ impl Circle { } } -#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Copy, Clone, Debug, PartialEq)] pub struct Vector { pub x: f32, pub y: f32, @@ -156,7 +154,7 @@ impl From<(f32, f32)> for Vector { } } -#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] +#[derive(Copy, Clone, Debug, PartialEq)] pub struct Transform { pub mat: [f32; 9], } diff --git a/src/original_impl.rs b/src/original_impl.rs index 969071e..08f120e 100644 --- a/src/original_impl.rs +++ b/src/original_impl.rs @@ -3,7 +3,6 @@ use std::{path::PathBuf, str::FromStr}; use crate::agnostic_interface::CameraInterface; use crate::faux_quicksilver::{Circle, Color, Rectangle, Transform, Vector, Window}; use rand::prelude::*; -use serde::{Deserialize, Serialize}; const WIDTH_F: f32 = 800.0; const HEIGHT_F: f32 = 600.0; @@ -523,7 +522,7 @@ impl Menu { } } -#[derive(Serialize, Deserialize, Clone)] +#[derive(Clone)] struct Particle { rect: Rectangle, circle: Circle, @@ -536,7 +535,7 @@ struct Particle { life_timer: f32, } -#[derive(Serialize, Deserialize, Clone)] +#[derive(Clone)] struct ParticleSystem { particles: Vec, spawn_timer: f32, @@ -687,7 +686,7 @@ impl ParticleSystem { } } -#[derive(Serialize, Deserialize, Clone)] +#[derive(Clone)] struct RotatingParticleSystem { particle_system: ParticleSystem, r: f32, @@ -885,7 +884,7 @@ impl ExplConvParticleSystem { } } -#[derive(Serialize, Deserialize, Clone)] +#[derive(Clone)] struct Planet { circle: Circle, color: Color, @@ -971,7 +970,7 @@ impl Planet { } } -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone)] struct Star { color: Color, particle_system: ParticleSystem, @@ -1039,7 +1038,7 @@ impl Star { } } -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone)] struct Fish { pos: Vector, r: f32, @@ -1172,7 +1171,7 @@ impl Fish { } } -#[derive(Serialize, Deserialize, Clone)] +#[derive(Clone)] struct SaveData { planets: Vec, stars: Vec,