1
각 분기가 다른 유형을 반환 할 수있는 일치를 실행하려고하는 코드가 있지만 이 유형은 모두 Iterator<Item=usize>
을 구현합니다. 반복자를 반환하는 팔을 일치 시킵니까?
let found: Iterator<Item = usize> = match requirements {
Requirements::A => MatchingAs { ainternals: [] },
Requirements::B => MatchingBs { binternals: [] },
Requirements::C => MatchingCs { cinternals: [] },
};
return found.any(|m| m == 1)
... 어디
MatchingAs
,
MatchingBs
및
MatchingCs
모든
impl
std::iter::Iterator<Item = usize>
.
나는 Iterator
이 크기되지 않는다는 사실과 벽 타격 해요 :
| the trait `std::marker::Sized` is not implemented for `std::iter::Iterator<Item=usize>`
를 매치 팔이 공유 특성과 개체를 반환하고 의지가 할 수있는 좋은 방법이 있나요 (만) 결과를 처리하는 특성에?
이것이 [반복자를 반환하는 올바른 방법]과 중복되지 않는 이유를 설명하십시오. (http://stackoverflow.com/q/27535289/155423) – Shepmaster