Is there a way I can use map such that if a certain condition is met I can return an error? The reason is that i'm trying to implement the trait FromStr for my struct BigNum:
impl FromStr for BigNum { fn from_str(s: &str) -> Result<BigNum, BigNum::Err> { let filter_vec = t_num.chars(). map(|a| match a.to_digit(10) { Some(x) => { x }, None => { /* return from function with Err */ } }); } } Is this possible to do? Or should I simply iterate over the chars() myself and return an error upon reaching a None? Just wondering if there's an easy way to break out of map and return from the function
return Err(..whatever..)?