lt_rs/alerts/implementations/
file_error.rs

1use crate::alerts::FileErrorAlert;
2use crate::alerts::operation::Operation;
3use crate::errors::LtrsError;
4use crate::ffi::alerts::file_error::ffi::{
5    file_error_alert_get_error, file_error_alert_get_filename, file_error_alert_get_op,
6};
7use crate::torrent_handle::TorrentHandle;
8
9impl FileErrorAlert {
10    #[inline(always)]
11    pub fn handle(&self) -> TorrentHandle {
12        self.as_torrent_alert().handle()
13    }
14
15    #[inline(always)]
16    pub fn torrent_name<'a>(&'a self) -> &'a str {
17        self.as_torrent_alert().torrent_name()
18    }
19
20    #[inline(always)]
21    pub fn message(&self) -> String {
22        self.as_torrent_alert().message()
23    }
24
25    #[inline(always)]
26    pub fn get_filename<'a>(&'a self) -> &'a str {
27        unsafe { file_error_alert_get_filename(self.0) }
28    }
29
30    #[inline(always)]
31    pub fn get_error(&self) -> LtrsError {
32        unsafe { file_error_alert_get_error(self.0) }.into()
33    }
34
35    #[inline(always)]
36    pub fn get_op(&self) -> Operation {
37        unsafe { file_error_alert_get_op(self.0) }.into()
38    }
39}