yandext/lib.rs
1pub struct Translator <'a> {
2 pub from: &'a str,
3 pub to: &'a str
4}
5
6
7impl Translator <'_> {
8 pub fn new <'a> (from: &'a str, to: &'a str) -> Translator <'a> {
9 Translator{from, to}
10 }
11
12 pub fn make_link(&self, base: String) -> String {
13 let mut based = "https://translated.turbopages.org/proxy_u/%%from-%%to.%%to.".to_owned().replace("%%from", &self.from).replace("%%to", &self.to);
14
15 based.push_str(&base.replace(":", ""));
16
17 String::from(based)
18 }
19}