Function lib_xch::handler::handler_api
[−]
[src]
pub fn handler_api(equation: &str) -> Result<Vec<i32>, ErrorHandler>
the API balances the Chemical Equation by equation.
If the equation can balance, function would return a i32
vector which contains the answer.
If not, it would return handler::ErrorHandler
which contains Delta-3 the parser's result and error message.
Panics
The equation you provided should be a common unbalanced chemical equation which only contains one =
.
- Stack Overflow may cause panic. Because it is using recusive balancer and regex-based parser.
- The implement for Ord trait may cause panic. Because it should return
Ordering
.
And in the other failed situation, it'll return a error_message
and contain parser_result
(maybe it is empty).