use error::{Error, ErrorKind, Result, ResultExt};
fn some_func(v: &str) -> Result<u32> {
v.parse::<u32>().chain_err(|| ErrorKind::ParseIntError)
}
The purpose of `chain_err` here is to add on top of the previous error, to explain what you were trying to do, instead of passing up the previous error (in this case, `std::num::ParseIntError`). use std::boxed::Box;
use std::error::Error;
fn some_func(v: &str) -> Result<u32, Box<Error>> {
v.parse::<u32>().map_err(|e| Box::new(e))
}
But then you'd have to box every error.
> Substituting our empirically derived domestic emissions for those modeled in the RFS RIA would raise ethanol’s projected life cycle GHG emissions for 2022 to 115.7 g CO2e MJ−1—a value 24% above baseline gasoline (93.1 g CO2e MJ−1). The RIA estimate, however, includes improvements in feedstock and ethanol production efficiency that were projected to occur by 2022, such that the GHG intensity of ethanol produced at earlier time periods and over the life of the RFS to date is likely much higher [...].
My understanding is that they took the model used in the RFS RIA (when the RFS was first introduced), and plugged in what they've seen over the past few years to that model. Take that with what you will.
> And we're to assume that, without the production of fuel ethanol, the same land wouldn't be tilled and used for other crops?
With the increase in demand for corn for fuel usage, more fields are needed to plant the corn. Because the corn is for fuel, not food, food wouldn't have been planted in place of the corn had there not been fuel demand.