2/n Add pause/start actions

This commit is contained in:
Igor Katson 2023-11-24 14:29:05 +00:00
parent 0c4844f534
commit b79a21179f
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
3 changed files with 19 additions and 16 deletions

View file

@ -201,8 +201,11 @@ impl Session {
self.dht.as_ref()
}
pub fn with_torrents<R>(&self, callback: impl Fn(&[ManagedTorrentHandle]) -> R) -> R {
callback(&self.locked.read().torrents)
pub fn with_torrents<R>(
&self,
callback: impl Fn(&mut dyn Iterator<Item = (TorrentId, &ManagedTorrentHandle)>) -> R,
) -> R {
callback(&mut self.locked.read().torrents.iter().enumerate())
}
pub async fn add_torrent(