Skip to content

Commit

Permalink
Add rust (#50)
Browse files Browse the repository at this point in the history
* Add rust

* Add optimize flag
  • Loading branch information
ajami1331 authored Oct 3, 2024
1 parent a6643af commit 07a1bc3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/restore/restore-from-apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ apt-get update && \
ruby \
golang \
openjdk-8-jdk-headless \
unzip
unzip \
rustc
7 changes: 7 additions & 0 deletions sojj/languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,12 @@
"outputFile": "foo.jar",
"execute": ["java", "-jar", "foo.jar"],
"cpuLimit": 25
},
"rust2021": {
"type": "compiler",
"compile": ["/usr/bin/rustc", "-O", "foo.rs", "-o", "foo"],
"codeFile": "foo.rs",
"outputFile": "foo",
"execute": ["./foo"]
}
}
11 changes: 11 additions & 0 deletions testdata/compile-test/1.rust2021
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use std::io;

fn main() {
let mut line = String::new();
io::stdin().read_line(&mut line).expect("stdin");

let sum: i32 = line.split_whitespace()
.map(|x| x.parse::<i32>().expect("integer"))
.sum();
println!("{}", sum);
}

0 comments on commit 07a1bc3

Please sign in to comment.