Rust · 1474 bytes Raw Blame History
1 // Test file for ghost text autocomplete
2 // Try typing the first 2-3 characters of these words and see ghost suggestions
3
4 fn authentication_handler() {
5 println!("authentication started");
6 }
7
8 fn authorization_check() {
9 println!("authorization verified");
10 }
11
12 fn calculate_total(items: Vec<i32>) -> i32 {
13 items.iter().sum()
14 }
15
16 fn calculate_average(items: Vec<i32>) -> f64 {
17 let total = calculate_total(items.clone());
18 total as f64 / items.len() as f64
19 }
20
21 fn process_request(request: String) {
22 println!("processing: {}", request);
23 }
24
25 fn process_response(response: String) {
26 println!("response: {}", response);
27 }
28
29 struct Configuration {
30 database_url: String,
31 database_port: u16,
32 server_host: String,
33 server_port: u16,
34 }
35
36 impl Configuration {
37 fn new() -> Self {
38 Configuration {
39 database_url: String::from("localhost"),
40 database_port: 5432,
41 server_host: String::from("0.0.0.0"),
42 server_port: 8080,
43 }
44 }
45 }
46
47 // Test suggestions:
48 // Type "auth" -> should suggest "entication" or "orization"
49 // Type "calc" -> should suggest "ulate_total" or "ulate_average"
50 // Type "proc" -> should suggest "ess_request" or "ess_response"
51 // Type "data" -> should suggest "base_url" or "base_port"
52 // Type "serv" -> should suggest "er_host" or "er_port"
53 // Type "Conf" -> should suggest "iguration"
54
55 fn main() {
56 let config = Configuration::new();
57
58 // Try typing here:
59 //
60
61 }
62