This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! as_item { | |
($i:item) => {$i}; | |
} | |
macro_rules! impl_partial_eq { | |
([$($lt:tt)*] $lhs:ty, $rhs:ty) => { | |
as_item! { | |
impl<$($lt)*> PartialEq<$rhs> for $lhs { | |
fn eq(&self, other: &$rhs) -> bool { | |
// common implementation of PartialEq goes here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1560a5eff8d8d9d24c42f5e41787bdbc5408d701 Mon Sep 17 00:00:00 2001 | |
From: Tom Jakubowski <tom@crystae.net> | |
Date: Fri, 10 Jul 2015 17:11:54 -0700 | |
Subject: [PATCH] Make it build on stable | |
--- | |
src/main.rs | 2 -- | |
src/models/player.rs | 17 +++++++++-------- | |
2 files changed, 9 insertions(+), 10 deletions(-) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(on_unimplemented)] | |
trait TyEq<T> { } | |
#[rustc_on_unimplemented="{Self} is not type-equal to {T}"] | |
impl<T> TyEq<T> for T { } | |
fn static_assert_ty_eq<T: TyEq<U>, U>() { } | |
fn main(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test: | |
rm -f liberoc.rlib | |
rustc eroc.rs | |
rustc -L . -C codegen_units=2 unicode.rs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I think one realllly cool thing about github gists is that the non-adjustable input box is wider than the non-adjustable display box |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(macro_rules)] | |
macro_rules! try_harder { | |
($e:expr) => { | |
match $e { | |
Ok(val) => val, | |
Err(e) => return Err(e) | |
} | |
}; | |
($e:expr, $f:expr) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Convert a Markdown README to HTML with Github Flavored Markdown | |
# Github and Pygments styles are included in the output | |
# | |
# Requirements: json gem (`gem install json`) | |
# | |
# Input: STDIN or filename | |
# Output: STDOUT | |
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file | |
# cat README.md | flavor > README.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Foo { | |
fn foo(_: Self) -> int { | |
42 | |
} | |
} | |
struct Baz; | |
impl Foo for Baz { } | |
struct Bar { x: int } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn sum_vec_int<T: Num + Zero>(xs: &[T]) -> T { | |
let zero: T = Zero::zero(); | |
xs.iter().fold(zero, |x, y| { x + *y }) | |
} | |
sum_vec_int([1.0, 2.0, 3.0].as_slice()); |