s2rs 0.5.13

An intuitive Rust -> Scratch API library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14

pub trait VecUtils<T> {
    fn try_map<U, E>(self) -> Result<Vec<U>, E> where T: TryInto<U, Error = E>;
}

impl<T> VecUtils<T> for Vec<T> {
    fn try_map<U, E>(self) -> Result<Vec<U>, E> where T: TryInto<U, Error = E> {
        let mut result = Vec::new();
        for item in self {
            result.push(item.try_into()?)
        }
        Ok(result)
    }
}