Skip to content

Instantly share code, notes, and snippets.

View Kimundi's full-sized avatar

Marvin Löbel Kimundi

  • Dortmund, Germany
View GitHub Profile
@Kimundi
Kimundi / playground.rs
Created September 19, 2015 11:49 — forked from anonymous/playground.rs
Shared via Rust Playground
#![feature(unsize)]
#![feature(raw)]
#![feature(const_fn)]
use std::marker::{Unsize, PhantomData};
use std::fmt::Display;
use std::raw::TraitObject;
use std::cell::Cell;
use std::mem;
use std::ops::Deref;
@Kimundi
Kimundi / playground.rs
Created September 19, 2015 13:21 — forked from anonymous/playground.rs
Shared via Rust Playground
#![feature(unsize)]
#![feature(raw)]
#![feature(const_fn)]
use std::marker::{Unsize, PhantomData};
use std::fmt::Display;
use std::fmt::Debug;
use std::raw::TraitObject;
use std::cell::Cell;
use std::mem;
@Kimundi
Kimundi / playground.rs
Created September 19, 2015 14:42 — forked from anonymous/playground.rs
Shared via Rust Playground
#![feature(unsize)]
#![feature(raw)]
#![feature(const_fn)]
use std::marker::{Unsize, PhantomData};
use std::fmt::Display;
use std::fmt::Debug;
use std::raw::TraitObject;
use std::cell::Cell;
use std::mem;
@Kimundi
Kimundi / playground.rs
Created September 19, 2015 15:14 — forked from anonymous/playground.rs
Shared via Rust Playground
#![feature(unsize)]
#![feature(raw)]
#![feature(const_fn)]
use std::marker::{Unsize, PhantomData};
use std::fmt::Display;
use std::fmt::Debug;
use std::raw::TraitObject;
use std::cell::Cell;
use std::mem;
@Kimundi
Kimundi / playground.rs
Created September 19, 2015 15:18 — forked from anonymous/playground.rs
Shared via Rust Playground
#![feature(unsize)]
#![feature(raw)]
#![feature(const_fn)]
use std::marker::{Unsize, PhantomData};
use std::fmt::Display;
use std::fmt::Debug;
use std::raw::TraitObject;
use std::cell::Cell;
use std::mem;
@Kimundi
Kimundi / playground.rs
Created September 19, 2015 15:44 — forked from anonymous/playground.rs
Shared via Rust Playground
#![feature(unsize)]
#![feature(raw)]
#![feature(const_fn)]
#![feature(unique)]
use std::marker::{Unsize, PhantomData};
use std::fmt::Display;
use std::raw::TraitObject;
use std::mem;
use std::ops::Deref;
@Kimundi
Kimundi / debug_or.rs
Created June 10, 2016 21:40 — forked from anonymous/playground.rs
Debug or
#![feature(specialization)]
macro_rules! debug_or {
($e:expr, $s:expr, $($a:expr),*) => {
$e.debug_or_else(|f| write!(f, $s, $($a),*))
};
($e:expr, $s:expr) => {
debug_or!($e, $s,)
}
}
@Kimundi
Kimundi / github-pandoc.css
Created September 5, 2016 14:03 — forked from dashed/github-pandoc.css
GitHub-like CSS for pandoc standalone HTML files (perfect for HTML5 output). Based on Marked.app's GitHub CSS. Added normalize.css (v2.1.3) in the prior to GitHub css.
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
@Kimundi
Kimundi / playground.rs
Created November 13, 2016 14:35 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::mem;
use std::cell::Cell;
fn ref_as_cell<T: Copy>(t: &mut T) -> &Cell<T> {
unsafe { mem::transmute(t) }
}
fn slice_as_cell<T: Copy>(t: &mut [T]) -> &[Cell<T>] {
unsafe { mem::transmute(t) }
}
@Kimundi
Kimundi / playground.rs
Created April 3, 2017 15:49 — forked from anonymous/playground.rs
Shared via Rust Playground
#![feature(specialization)]
use std::fmt::*;
trait Maybe<T: ?Sized> {
fn implements_this(&self) -> bool;
fn fmt(&self, &mut Formatter) -> Result;
}
macro_rules! impl_maybe {