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 Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
println!("Hello, world!");
}
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
#[derive(Debug)]
struct MyItem1 {
name: String,
}
#[derive(Debug)]
struct MyItem2 {
value: String,
id: u8,
}
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
use std::any::{Any, TypeId};
use std::collections::HashMap;
use std::vec::Vec;
pub struct World {
components: HashMap<TypeId, Box<dyn Any>>,
next_entity_id: Entity,
entities: Vec<EntityData>,
}
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
fn main()
{
for y in 1..13
{
for x in 1..13
{
println!("{} x {} : {}", y, x, y * x);
}
println!("");
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
let x = vec![1,2,3,4];
}
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
struct A {
x: i32,
}
impl A {
pub fn new(x: i32) -> Self {
Self { x }
}
pub fn dummy_fn() {
println!(">> Dummy_fn successfully called!");
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
struct Test {
a: i32,
}
trait TestTrait: Fn(i32, Test) -> i32 + Sync + Send + TestTraitClone {}
trait TestTraitClone {
fn clone_boxed(&self) -> Box<dyn TestTrait>;
}
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
//use std::mem;
#[derive(PartialEq)]
enum Foo { A, B}
/*
use std::ops::Deref;
use std::ops::DerefMut;
impl Deref for Foo {
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
println!("Hello, world!");
}
@rust-play
rust-play / playground.rs
Created Jun 18, 2019
Code shared from the Rust Playground
View playground.rs
fn main() {
println!("Hello, world!");
}
You can’t perform that action at this time.