lt_rs/alerts/implementations/
torrent_error.rs1use crate::{
2 alerts::TorrentErrorAlert,
3 errors::LtrsError,
4 ffi::alerts::torrent_error::ffi::{
5 torrent_error_alert_get_error, torrent_error_alert_get_filename,
6 },
7 torrent_handle::TorrentHandle,
8};
9
10impl TorrentErrorAlert {
11 #[inline(always)]
12 pub fn handle(&self) -> TorrentHandle {
13 self.as_torrent_alert().handle()
14 }
15
16 #[inline(always)]
17 pub fn torrent_name<'a>(&'a self) -> &'a str {
18 self.as_torrent_alert().torrent_name()
19 }
20
21 #[inline(always)]
22 pub fn message(&self) -> String {
23 self.as_torrent_alert().message()
24 }
25
26 #[inline(always)]
27 pub fn error(&self) -> LtrsError {
28 unsafe { torrent_error_alert_get_error(self.0) }.into()
29 }
30
31 #[inline(always)]
32 pub fn filename<'a>(&'a self) -> &'a str {
33 unsafe { torrent_error_alert_get_filename(self.0) }
34 }
35}