Rustfmt
This commit is contained in:
parent
dc30a93d61
commit
6bf83540fb
10
src/calc.rs
10
src/calc.rs
@ -11,10 +11,8 @@ use errors::{CalculatorError, CalculatorResult};
|
|||||||
use operations::{
|
use operations::{
|
||||||
ArithmeticOperation, CalculatorOperation, CalculatorStateChange, MacroState, OpArgs,
|
ArithmeticOperation, CalculatorOperation, CalculatorStateChange, MacroState, OpArgs,
|
||||||
};
|
};
|
||||||
use serde::ser::Serializer;
|
use serde::{ser::Serializer, Deserialize, Serialize};
|
||||||
use serde::{Deserialize, Serialize};
|
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
|
||||||
use std::collections::{BTreeMap, HashMap};
|
|
||||||
use std::collections::{HashSet, VecDeque};
|
|
||||||
use types::{
|
use types::{
|
||||||
CalculatorAlignment, CalculatorAngleMode, CalculatorConstant, CalculatorConstants,
|
CalculatorAlignment, CalculatorAngleMode, CalculatorConstant, CalculatorConstants,
|
||||||
CalculatorDisplayMode, CalculatorMacro, CalculatorMacros, CalculatorRegisters, CalculatorState,
|
CalculatorDisplayMode, CalculatorMacro, CalculatorMacros, CalculatorRegisters, CalculatorState,
|
||||||
@ -307,7 +305,9 @@ impl Calculator {
|
|||||||
self.state = CalculatorState::WaitingForSetting;
|
self.state = CalculatorState::WaitingForSetting;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
c => self.op(OPERATION_MAP.get(&c).ok_or(CalculatorError::NoSuchOperator(c))?),
|
c => self.op(OPERATION_MAP
|
||||||
|
.get(&c)
|
||||||
|
.ok_or(CalculatorError::NoSuchOperator(c))?),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn constant_input(&mut self, c: char) -> CalculatorResult<()> {
|
fn constant_input(&mut self, c: char) -> CalculatorResult<()> {
|
||||||
|
@ -4,13 +4,11 @@ mod matrix;
|
|||||||
mod number;
|
mod number;
|
||||||
mod vector;
|
mod vector;
|
||||||
use super::errors::{CalculatorError, CalculatorResult};
|
use super::errors::{CalculatorError, CalculatorResult};
|
||||||
use crate::calc::types::CalculatorAngleMode;
|
use crate::calc::{types::CalculatorAngleMode, CalculatorDisplayMode};
|
||||||
use crate::calc::CalculatorDisplayMode;
|
|
||||||
pub use matrix::{Matrix, MatrixDimensions};
|
pub use matrix::{Matrix, MatrixDimensions};
|
||||||
pub use number::Number;
|
pub use number::Number;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::cmp::PartialEq;
|
use std::{cmp::PartialEq, fmt};
|
||||||
use std::fmt;
|
|
||||||
pub use vector::{Vector, VectorDirection};
|
pub use vector::{Vector, VectorDirection};
|
||||||
|
|
||||||
pub trait CalculatorEntry
|
pub trait CalculatorEntry
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
use super::VectorDirection;
|
use super::{Entry, Number, Vector, VectorDirection};
|
||||||
use super::{Entry, Number, Vector};
|
use crate::{
|
||||||
use crate::calc::errors::{CalculatorError, CalculatorResult};
|
calc::{
|
||||||
use crate::calc::types::CalculatorAngleMode;
|
errors::{CalculatorError, CalculatorResult},
|
||||||
use crate::calc::CalculatorDisplayMode;
|
types::CalculatorAngleMode,
|
||||||
use crate::CalculatorEntry;
|
CalculatorDisplayMode,
|
||||||
|
},
|
||||||
|
CalculatorEntry,
|
||||||
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
use super::VectorDirection;
|
use super::{Entry, Matrix, Vector, VectorDirection};
|
||||||
use super::{Entry, Matrix, Vector};
|
use crate::{
|
||||||
use crate::calc::errors::{CalculatorError, CalculatorResult};
|
calc::{
|
||||||
use crate::calc::types::CalculatorAngleMode;
|
errors::{CalculatorError, CalculatorResult},
|
||||||
use crate::calc::CalculatorDisplayMode;
|
types::CalculatorAngleMode,
|
||||||
use crate::CalculatorEntry;
|
CalculatorDisplayMode,
|
||||||
|
},
|
||||||
|
CalculatorEntry,
|
||||||
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
use super::{Entry, Matrix, Number};
|
use super::{Entry, Matrix, Number};
|
||||||
use crate::calc::errors::{CalculatorError, CalculatorResult};
|
use crate::{
|
||||||
use crate::calc::types::CalculatorAngleMode;
|
calc::{
|
||||||
use crate::calc::CalculatorDisplayMode;
|
errors::{CalculatorError, CalculatorResult},
|
||||||
use crate::CalculatorEntry;
|
types::CalculatorAngleMode,
|
||||||
|
CalculatorDisplayMode,
|
||||||
|
},
|
||||||
|
CalculatorEntry,
|
||||||
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use confy::ConfyError;
|
use confy::ConfyError;
|
||||||
use std::error;
|
use std::{error, fmt};
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
pub type CalculatorResult<T> = Result<T, CalculatorError>;
|
pub type CalculatorResult<T> = Result<T, CalculatorError>;
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use super::entries::Entry;
|
use super::entries::Entry;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::{collections::HashMap, fmt};
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
/// The calculator state
|
/// The calculator state
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
use std::iter;
|
use std::{iter, sync::mpsc};
|
||||||
use std::sync::mpsc;
|
|
||||||
|
|
||||||
use std::thread;
|
use std::{
|
||||||
use std::time::{Duration, Instant};
|
thread,
|
||||||
|
time::{Duration, Instant},
|
||||||
|
};
|
||||||
|
|
||||||
use crossterm::event::{self, Event as CEvent, KeyEvent};
|
use crossterm::event::{self, Event as CEvent, KeyEvent};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user