Skip to content

Instantly share code, notes, and snippets.

The Rust Playground rust-play

Block or report user

Report or block rust-play

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
#![allow(unreachable_code)]
fn main() {
println!("{:?}", {
yep
});
}
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
println!("Hello, world!");
}
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
#![allow(unused_variables)]
fn main() {
struct Car;
struct Computer;
struct Person {
name: String,
car: Option<Car>,
computer: Option<Computer>,
age: u8,
}
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
match Some(42) {
option @ Some(x) => (),
None => (),
}
}
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
println!("Hello, world!");
}
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
struct Cat {
weight: i32,
}
trait Animal {
type Weight;
fn get_weight(&self) -> &Self::Weight;
}
impl Animal for Cat {
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
struct Cat {
weight: i32,
}
trait Animal {
type T;
fn get_weight(&self) -> &Self::T;
}
impl Animal for Cat {
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
println!("Hello, world!");
}
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
use std::fs;
fn main() {
let s = fs::read_to_string("input.txt").unwrap();
let slice: str = *s.as_str();
}
@rust-play
rust-play / playground.rs
Created Jul 19, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
let closure = |a: u32| -> u32 {
a
};
println!("{}", std::mem::size_of_val(&closure));
}
You can’t perform that action at this time.