lt_rs/alerts/implementations/
hash_failed.rs

1use crate::alerts::HashFailedAlert;
2use crate::ffi::alerts::hash_failed::ffi::hash_failed_alert_get_piece_index;
3use crate::ffi::ffi::PieceIndex;
4use crate::torrent_handle::TorrentHandle;
5
6impl HashFailedAlert {
7    #[inline(always)]
8    pub fn handle(&self) -> TorrentHandle {
9        self.as_torrent_alert().handle()
10    }
11
12    #[inline(always)]
13    pub fn torrent_name<'a>(&'a self) -> &'a str {
14        self.as_torrent_alert().torrent_name()
15    }
16
17    #[inline(always)]
18    pub fn message(&self) -> String {
19        self.as_torrent_alert().message()
20    }
21
22    #[inline(always)]
23    pub fn piece_index(&self) -> PieceIndex {
24        unsafe { hash_failed_alert_get_piece_index(self.0) }
25    }
26}