Instantly share code, notes, and snippets.

View playground.rs
#![feature(futures_api)]
extern crate futures; // 0.1.25
use futures::prelude::*;
use futures::future::{ok};
pub struct Boop {}
pub enum Cmd {
A,
View playground.rs
extern crate futures; // 0.1.25
use futures::prelude::*;
use futures::future::{ok, err};
pub struct Boop {}
pub enum Cmd {
a,
b
View playground.rs
#![feature(trace_macros)]
macro_rules! _meme {
($sum:expr;) => {};
($sum:expr; $head:tt $($tail:tt)*) => {
{
println!("{} {}", $head, derp.$sum);
_meme!($sum + 1usize; $($tail)*)
}
};
View playground.rs
struct Flatten<I, S>
where
I: Iterator,
S: Iterator,
{
base: I,
inner: S,
}
impl<I> Flatten<I, <I::Item as IntoIterator>::IntoIter>
View playground.rs
struct Flatten<I, S>
where
I: Iterator,
S: Iterator,
{
base: I,
inner: S,
}
impl<I> Flatten<I, <I::Item as IntoIterator>::IntoIter>
View playground.rs
fn main() {
let s = "foo";
let res = match s {
"foo" => "foo",
"bar" => "bar",
_ => "other",
};
println!("res: {}", res);
}
View playground.rs
struct Foo<'a> {
bar: &'a i32
}
/*impl<'a, 'b: 'a> Foo<'b> {
fn new(bar: &'b i32) -> Self {
Foo { bar }
}
fn qux(&'a mut self) -> &'b i32 {
View playground.rs
use std::{
error,
fmt::{self, Display, Formatter},
io,
num::ParseIntError,
result,
};
#[derive(Debug)]
enum Error {
View playground.rs
use ferris_says::say; // from the previous step
use std::io::{stdout, BufWriter};
fn main() {
let stdout = stdout();
let out = b"Hello fellow Rustaceans!";
let width = 24;
let mut writer = BufWriter::new(stdout.lock());
say(out, width, &mut writer).unwrap();
View playground.rs
#![stable(feature = "playground", since = "0.0.0")]
#![feature(const_fn, staged_api)]
#![allow(dead_code)]
use core::marker::PhantomData;
#[stable(feature = "iter_empty", since = "1.2.0")]
pub struct Empty<T: 'static>(PhantomData<&'static T>);
impl<T> Empty<T> {