lt_rs/alerts/implementations/
tracker_reply.rs1use crate::{
2 alerts::{TrackerReplyAlert, protocol_version::ProtocolVersion},
3 ffi::alerts::tracker_reply::ffi::{
4 tracker_reply_alert_get_num_peers, tracker_reply_alert_get_version,
5 },
6 torrent_handle::TorrentHandle,
7};
8
9impl TrackerReplyAlert {
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 tracker_url<'a>(&'a self) -> &'a str {
27 self.as_tracker_alert().tracker_url()
28 }
29
30 #[inline(always)]
31 pub fn local_endpoint(&self) {
32 self.as_tracker_alert().local_endpoint()
33 }
34
35 #[inline(always)]
36 pub fn num_peers(&self) -> i32 {
37 unsafe { tracker_reply_alert_get_num_peers(self.0) }
38 }
39
40 #[inline(always)]
41 pub fn version(&self) -> ProtocolVersion {
42 ProtocolVersion::from_u8(unsafe { tracker_reply_alert_get_version(self.0) })
43 }
44}