pub struct History {
pub entries: Vec<HistoryEntry>,
pub last_result: Option<f64>,
}
Expand description
Represents the history of calculations performed by the calculator.
§Fields
entries
: A vector ofHistoryEntry
structs, each representing a single calculation.last_result
: An optional floating-point number (Option<f64>
) representing the result of the most recent successful calculation.
§Methods
§new
Creates a new, empty History
instance.
§add_entry
Adds a new entry to the history.
§Arguments
input
: A string representing the mathematical expression provided by the user.result
: An optional floating-point number representing the result of the calculation. UseNone
if the calculation failed.error_message
: An optional string containing an error message if the calculation failed. UseNone
if there was no error.
§get_history
Returns a reference to the vector of HistoryEntry
structs.
§get_last_result
Returns the result of the most recent successful calculation, or None
if no successful calculation has been performed.
Fields§
§entries: Vec<HistoryEntry>
§last_result: Option<f64>
Implementations§
Source§impl History
Represents the history of calculations performed by the calculator.
impl History
Represents the history of calculations performed by the calculator.
§Fields
entries
: A vector ofHistoryEntry
structs, each representing a single calculation.last_result
: An optional floating-point number (Option<f64>
) representing the result of the most recent successful calculation.
§Methods
§new
Creates a new, empty History
instance.
§add_entry
Adds a new entry to the history.
§Arguments
input
: A string representing the mathematical expression provided by the user.result
: An optional floating-point number representing the result of the calculation. UseNone
if the calculation failed.error_message
: An optional string containing an error message if the calculation failed. UseNone
if there was no error.
§get_history
Returns a reference to the vector of HistoryEntry
structs.
§get_last_result
Returns the result of the most recent successful calculation, or None
if no successful calculation has been performed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnwindSafe for History
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more