lt_rs/alerts/implementations/
performance.rs

1use crate::{
2    alerts::{PerformanceAlert, performance_warning::PerformanceWarning},
3    ffi::alerts::performance::ffi::performance_alert_get_warning_code,
4    torrent_handle::TorrentHandle,
5};
6
7impl PerformanceAlert {
8    #[inline(always)]
9    pub fn handle(&self) -> TorrentHandle {
10        self.as_torrent_alert().handle()
11    }
12
13    #[inline(always)]
14    pub fn torrent_name<'a>(&'a self) -> &'a str {
15        self.as_torrent_alert().torrent_name()
16    }
17
18    #[inline(always)]
19    pub fn message(&self) -> String {
20        self.as_torrent_alert().message()
21    }
22
23    #[inline(always)]
24    pub fn warning_code(&self) -> PerformanceWarning {
25        let warning_code = unsafe { performance_alert_get_warning_code(self.0) };
26        PerformanceWarning::from_u8(warning_code)
27    }
28}