Struct calc::Context [−][src]
Calculation context.
Stores a history of calculated values, so that the history lookups (@
) work properly.
Also reifies the numeric type backing the calculations.
Fields
history: Vec<N>
Implementations
impl<N> Context<N> where
N: Debug + Calcable,
<N as Calcable>::Err: 'static,
[src]
N: Debug + Calcable,
<N as Calcable>::Err: 'static,
pub fn evaluate(&mut self, expr: &str) -> Result<N, Error<N>>
[src]
Evaluate an expression in this context.
This both returns the calculated value and stores a copy in the context’s history.
impl<N> Context<N> where
N: Debug + Calcable + Numeric,
<N as Calcable>::Err: 'static,
[src]
N: Debug + Calcable + Numeric,
<N as Calcable>::Err: 'static,
pub fn evaluate_annotated(&mut self, expr: &str) -> Result<String, Error<N>>
[src]
Evaluate an annotated expression in this context.
Annotations can include output formatting directives. Therefore, the return value
is a formatted String
.
This also stores a copy in the context’s history.
Trait Implementations
Auto Trait Implementations
impl<N> RefUnwindSafe for Context<N> where
N: RefUnwindSafe,
N: RefUnwindSafe,
impl<N> Send for Context<N> where
N: Send,
N: Send,
impl<N> Sync for Context<N> where
N: Sync,
N: Sync,
impl<N> Unpin for Context<N> where
N: Unpin,
N: Unpin,
impl<N> UnwindSafe for Context<N> where
N: UnwindSafe,
N: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,