[][src]Struct lib_xch::public::handler::Handler

pub struct Handler<'a, T> { /* fields omitted */ }

A handler which store the equation and other information

Methods

impl<'a, T: CheckedType + CheckedCalc> Handler<'a, T> where
    ParseIntError: From<<T as Num>::FromStrRadixErr> + From<<T as FromStr>::Err>, 
[src]

pub fn new(equ: &'a str) -> Self
[src]

Create a Handler by given equation

pub fn handle(self) -> Result<(ChemicalEquation, Vec<Vec<T>>), ErrorCases>
[src]

Parse and balance the equation. If it has been parsed, then just balance it.

If the equation can balance, function would return Ok((ChemicalEquation, Vec<Vec<T>>)) which contains the answer.

If not, it would return Err(ErrorCases) which contains the failure.

Panics

  • A large number (bigger than usize::MAX) of formula may cause panic. Because it is using Vec.

And in the other failed situation, it'll return ErrorCases.

pub fn parse(&mut self) -> Result<(ChemicalEquation, Vec<Vec<T>>), ErrorCases>
[src]

Parse the equation

Auto Trait Implementations

impl<'a, T> Send for Handler<'a, T> where
    T: Send

impl<'a, T> Sync for Handler<'a, T> where
    T: Sync

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>,