Skip to content

Instantly share code, notes, and snippets.

@squiidz
squiidz / playground.rs
Created March 9, 2017 19:52 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::io::{self, Read, Write};
struct StringRW {
value: String,
buffer: Vec<u8>,
}
impl StringRW {
fn new(value: &str) -> Self {
StringRW {
@squiidz
squiidz / playground.rs
Created March 6, 2017 18:51 — forked from anonymous/playground.rs
Shared via Rust Playground
#[derive(Debug, PartialEq, Eq, Clone)]
struct Node<T: Clone> {
name: String,
value: T,
next: Option<Box<Node<T>>>
}
impl<T: PartialEq + Clone> Node<T> {
fn new(name: &str, value: T) -> Self {
Node {
@squiidz
squiidz / playground.rs
Created January 27, 2017 19:52 — forked from anonymous/playground.rs
Shared via Rust Playground
fn main() {
let text = "ありがとうございます";
let words = text.split("").map(|w| w.as_bytes()).collect::<Vec<&[u8]>>();
let length = words.iter().fold(0, |acc, val| acc + val.len());
println!("Input Text: {}", text);
println!("Bytes: {:?}", words);
println!("Text is {} bytes long", length);
let mut inline_bits = String::new();
@squiidz
squiidz / playground.rs
Created January 24, 2017 17:33 — forked from anonymous/playground.rs
Shared via Rust Playground
trait Entity {
fn walk(&self) -> String;
}
struct Dog {
name: String,
age: i32
}
impl Dog {