lt_rs/alerts/implementations/
dht_reply.rs1use crate::alerts::DhtReplyAlert;
2use crate::ffi::alerts::dht_reply::ffi::dht_reply_alert_get_num_peers;
3use crate::torrent_handle::TorrentHandle;
4
5impl DhtReplyAlert {
6 #[inline(always)]
7 pub fn handle(&self) -> TorrentHandle {
8 self.as_torrent_alert().handle()
9 }
10
11 #[inline(always)]
12 pub fn torrent_name<'a>(&'a self) -> &'a str {
13 self.as_torrent_alert().torrent_name()
14 }
15
16 #[inline(always)]
17 pub fn message(&self) -> String {
18 self.as_torrent_alert().message()
19 }
20
21 #[inline(always)]
22 pub fn tracker_url<'a>(&'a self) -> &'a str {
23 self.as_tracker_alert().tracker_url()
24 }
25
26 #[inline(always)]
27 pub fn local_endpoint(&self) {
28 self.as_tracker_alert().local_endpoint()
29 }
30
31 #[inline(always)]
32 pub fn num_peers(&self) -> i32 {
33 unsafe { dht_reply_alert_get_num_peers(self.0) }
34 }
35}