- /// Used to make try_fold closures more like normal loops
- #[derive(PartialEq)]
- enum LoopState<C, B> {
- Continue(C),
- Break(B),
- }
-
- impl<C, B> Try for LoopState<C, B> {
- type Ok = C;
- type Error = B;
- #[inline]
- fn into_result(self) -> Result<Self::Ok, Self::Error> {
- match self {
- LoopState::Continue(y) => Ok(y),
- LoopState::Break(x) => Err(x),
- }
- }
- #[inline]
- fn from_error(v: Self::Error) -> Self { LoopState::Break(v) }
- #[inline]
This file has been truncated. show original