Skip to content

Instantly share code, notes, and snippets.

@Gankra
Gankra / gist:06b4c5454bd4f3ef732a
Last active August 29, 2015 14:04
libcollections traits 0.1
pub trait Collection {
fn len(self) -> uint;
fn is_empty(&self) -> bool; //defaulted
}
pub trait Mutable: Collection {
fn clear(&mut self);
}
pub trait Container<T>: Collection {
anonymous
anonymous / playground.rs
Created February 11, 2016 19:23
Shared via Rust Playground
use std::collections::VecDeque;
// The kind * -> *
trait TypeToType<Input> {
type Output;
}
struct Vec_;
struct VecDeque_;
anonymous
anonymous / playground.rs
Created February 12, 2016 16:43
Shared via Rust Playground
trait StreamingIterator<'a> {
type Item;
fn next(&'a mut self) -> Option<Self::Item>;
}
struct Buffer<T> {
data: Vec<T>,
pos: usize
}