Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn convert_result<'a, T: Deserialize<'a>>(&self, result: Result<Iter<Vec<String>>, RedisError>) -> Result<Vec<T>, RepositoryError> {
- match result {
- Ok(iter) =>
- Ok(iter.flat_map(|s| { s })
- .collect::<Vec<String>>()
- .into_iter()
- .map(|m| serde_json::from_str::<T>(&m).unwrap())
- .collect()
- ),
- Err(error) => return Err(
- RepositoryError::from(
- ErrorKind::IO, "Could not retrieve data from redis.",
- )
- )
- }
- }
- error[E0597]: `m` does not live long enough
- --> src/infrastructure/domain/repository/commons.rs:26:56
- |
- 20 | fn convert_result<'a, T: Deserialize<'a>>(&self, result: Result<Iter<Vec<String>>, RedisError>) -> Result<Vec<T>, RepositoryError> {
- | -- lifetime `'a` defined here
- ...
- 26 | .map(|m| serde_json::from_str::<T>(&m).unwrap())
- | --------------------------^^- - `m` dropped here while still borrowed
- | | |
- | | borrowed value does not live long enough
- | argument requires that `m` is borrowed for `'a`
Add Comment
Please, Sign In to add comment