lt_rs/alerts/implementations/
storage_moved_failed.rs

1use crate::alerts::StorageMovedFailedAlert;
2use crate::alerts::operation::Operation;
3use crate::errors::LtrsError;
4use crate::ffi::alerts::storage_moved_failed::ffi::{
5    storage_moved_failed_alert_file_path, storage_moved_failed_alert_get_error,
6    storage_moved_failed_alert_get_op,
7};
8use crate::torrent_handle::TorrentHandle;
9
10impl StorageMovedFailedAlert {
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    /// If the error happened for a specific file, this returns its path.
27    #[inline(always)]
28    pub fn file_path<'a>(&'a self) -> &'a str {
29        unsafe { storage_moved_failed_alert_file_path(self.0) }
30    }
31
32    #[inline(always)]
33    pub fn error(&self) -> LtrsError {
34        unsafe { storage_moved_failed_alert_get_error(self.0) }.into()
35    }
36
37    /// This indicates what underlying operation caused the error
38    #[inline(always)]
39    pub fn op(&self) -> Operation {
40        unsafe { storage_moved_failed_alert_get_op(self.0) }.into()
41    }
42}