Split up a couple large functions
This commit is contained in:
parent
340d54eafa
commit
5488e1d40f
2 changed files with 88 additions and 71 deletions
|
|
@ -49,7 +49,10 @@ pub struct TorrentMetaV1<BufType> {
|
|||
|
||||
impl<BufType> TorrentMetaV1<BufType> {
|
||||
pub fn iter_announce(&self) -> impl Iterator<Item = &BufType> {
|
||||
once(&self.announce).chain(self.announce_list.iter().flatten())
|
||||
if self.announce_list.iter().flatten().next().is_some() {
|
||||
return itertools::Either::Left(self.announce_list.iter().flatten());
|
||||
}
|
||||
itertools::Either::Right(once(&self.announce))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue