Improve config file format
This commit is contained in:
parent
3e2043729a
commit
43c3dfd0f9
@ -30,9 +30,13 @@ enum HistoryMode {
|
|||||||
pub struct Calculator {
|
pub struct Calculator {
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
l: String,
|
l: String,
|
||||||
|
pub stack: VecDeque<f64>,
|
||||||
save_on_close: bool,
|
save_on_close: bool,
|
||||||
pub calculator_alignment: CalculatorAlignment,
|
pub calculator_alignment: CalculatorAlignment,
|
||||||
pub stack: VecDeque<f64>,
|
#[serde(flatten)]
|
||||||
|
pub angle_mode: CalculatorAngleMode,
|
||||||
|
#[serde(flatten)]
|
||||||
|
pub display_mode: CalculatorDisplayMode,
|
||||||
#[serde(serialize_with = "ordered_char_map")]
|
#[serde(serialize_with = "ordered_char_map")]
|
||||||
pub macros: CalculatorMacros,
|
pub macros: CalculatorMacros,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
@ -47,8 +51,6 @@ pub struct Calculator {
|
|||||||
redo_buf: Vec<CalculatorStateChange>,
|
redo_buf: Vec<CalculatorStateChange>,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub state: CalculatorState,
|
pub state: CalculatorState,
|
||||||
pub angle_mode: CalculatorAngleMode,
|
|
||||||
pub display_mode: CalculatorDisplayMode,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ordered_char_map<S, T>(value: &HashMap<char, T>, serializer: S) -> Result<S::Ok, S::Error>
|
fn ordered_char_map<S, T>(value: &HashMap<char, T>, serializer: S) -> Result<S::Ok, S::Error>
|
||||||
|
@ -24,14 +24,12 @@ impl Default for CalculatorState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(tag = "constant")]
|
|
||||||
pub struct CalculatorConstant {
|
pub struct CalculatorConstant {
|
||||||
pub help: String,
|
pub help: String,
|
||||||
pub value: f64,
|
pub value: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(tag = "macro")]
|
|
||||||
pub struct CalculatorMacro {
|
pub struct CalculatorMacro {
|
||||||
pub help: String,
|
pub help: String,
|
||||||
pub value: String,
|
pub value: String,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user