We follow the Rust Code of Conduct (www.rust-lang.org/en-US/conduct.html)
In case of problem, feel free to contact either me or Alex in person or via mail/twitter
@crepererum
I feel I cannot control my stack usage.
fn main() {
println!("Hello world!");
}
print("Hello world!")
#include <iostream>
int main () {
std::cout << "Hello world!" << std::endl;
}
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
fn reverse(s: &str) -> String {
s.chars().rev().collect()
}
def reverse(s):
return s[::-1]
#include <string>
#include <algorithm>
std::string reverse(const std::string& s) {
std::string s2(s);
std::reverse(s2.begin(), s2.end());
return s2;
}
public class Reverser {
public static String reverseString(String s) {
return new StringBuilder(s).reverse().toString();
}
}
use std::fs::File;
use std::io::Read;
fn readAll(filename: &str) -> Vec<u8> {
let mut file = File::open(filename).unwrap();
let mut contents: Vec<u8> = Vec::new();
file.read_to_end(&mut contents).unwrap();
contents
}
def read_all(filename):
with open(filename) as f:
return f.read()
#include <fstream>
#include <string>
#include <iterator>
std::string readFile(const std::string& filename) {
std::ifstream infile(filename);
return std::string(
std::istreambuf_iterator<char>(infile),
std::istreambuf_iterator<char>(),
);
}
import java.nio.file.*;
public class ReadAll {
public static byte[] readAllBytes(String filename){
Path file = Paths.get(filename);
return Files.readAllBytes(file);
}
}
pub struct MyClass {
x: i64,
}
impl MyClass {
pub fn new(x: i64) -> Self {
Self { x }
}
pub fn f(&self, y: i64) -> i64 {
self.x + y
}
}
class MyClass:
def __init__(self, x):
self._x = x
def f(self, y):
return self._x + y
class MyClass {
private:
int x;
public:
MyClass(int x) {
this->x = x;
}
int f(int y) {
return x + y;
}
};
public class MyClass {
public MyClass(int x) {
this.x = x
}
public int f(int y) {
return x + y;
}
}
use std::collections::HashSet;
fn main() {
let mut s: HashSet<i64> = (1..=3).collect();
for i in s.iter() {
if *i > 2 {
s.insert(0);
}
}
}
s = {1, 2, 3}
for i in s:
if i > 2:
s.add(0)
#include <unordered_set>
int main() {
std::unordered_set<int> s;
for(int i = 0; i <= 3; i++) {
s.insert(i);
}
for (int i : s) {
if (i > 0) {
s.insert(0);
}
}
}
import java.util.*;
class Main {
public static void main(String[] args) {
HashSet<Integer> s = new HashSet<Integer>();
for (int i=0; i <= 3; i++) { s.add(i); }
for (int i: s) { for (int i2: s) {
if (i2 > 2) {
s.add(10);
}
}}
}
}
Any editor + terminal
Visual Studio Code (Rust + CodeLLDB + TOML + Crates)
More at areweideyet.com
Rust Playground (play.rust-lang.org)
Evcxr + Binder (goo.gl/AHsKxe)
Locally or via Rust Playground
Nice large collections, requires special CLI client
Different Crates
Rust Itself
at 22nd May
PhraseApp
You Talk?