forked from torrust/torrust-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
31 lines (24 loc) · 726 Bytes
/
mod.rs
File metadata and controls
31 lines (24 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pub mod asserts;
pub mod client;
pub mod environment;
pub mod requests;
pub mod responses;
pub mod v1;
pub type Started = environment::Environment<server::Running>;
use percent_encoding::NON_ALPHANUMERIC;
use torrust_tracker::servers::http::server;
pub type ByteArray20 = [u8; 20];
pub fn percent_encode_byte_array(bytes: &ByteArray20) -> String {
percent_encoding::percent_encode(bytes, NON_ALPHANUMERIC).to_string()
}
pub struct InfoHash(ByteArray20);
impl InfoHash {
pub fn new(vec: &[u8]) -> Self {
let mut byte_array_20: ByteArray20 = Default::default();
byte_array_20.clone_from_slice(vec);
Self(byte_array_20)
}
pub fn bytes(&self) -> ByteArray20 {
self.0
}
}