-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some refactor to allow for satellite selection
- Loading branch information
1 parent
68b030b
commit 5c2dde3
Showing
6 changed files
with
141 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
use serde::Deserialize; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::GroundStation; | ||
// use super::GroundStation; | ||
use super::{State, Satellite}; | ||
|
||
#[derive(Deserialize)] | ||
pub trait Action { | ||
// UpdateStation{name : str, status : str} | ||
// SelectSatellite{satellite: Satellite}, | ||
fn apply(self, state: &mut State); | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
#[serde(tag = "type")] | ||
pub enum Action { | ||
// some operations on the state | ||
UpdateStation { | ||
name: String, | ||
status: GroundStation, | ||
}, | ||
} | ||
pub struct FrontendAction { | ||
SelectSatellite{satellite: Satellite}, | ||
} | ||
|
||
impl Action for FrontendAction { | ||
fn apply(self, state: &mut State) { | ||
match self { | ||
FrontendAction::SelectSatellite { satellite } => { | ||
state.current_satellite = satellite; | ||
}, | ||
// Action::UpdateStation{name, status} => { | ||
// state.stations.insert(name, status); | ||
// } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters