Moved the state out to a different file

This commit is contained in:
2020-05-31 05:29:13 +02:00
parent a888ec9a8a
commit ceb26b40b1
3 changed files with 27 additions and 22 deletions

18
src/state.rs Normal file
View File

@@ -0,0 +1,18 @@
use std::sync::{Arc, Mutex};
use serde::Serialize;
#[derive(Clone, Serialize)]
pub struct Object {
pub name: String,
pub x: f64,
pub y: f64,
}
#[derive(Clone, Serialize)]
pub struct State {
pub iteration: u64,
pub objects: Vec<Object>
}
pub type WrappedState = Arc<Mutex<State>>;