Skip to content

Instantly share code, notes, and snippets.

@SiegeLord
SiegeLord / output
Created June 11, 2014 15:54
Rust matrix expression templates
clone
Matrix { data: [100, 200, 300] }
@SiegeLord
SiegeLord / output
Last active November 2, 2019 18:59
Rust matrix moving
clone
move
move
Matrix { data: [100, 200, 300] }
@SiegeLord
SiegeLord / crash.d
Created June 30, 2013 19:46
Bugs, bugs everywhere
import tango.io.Console;
import tango.io.Stdout;
import tango.io.stream.Buffered;
import tango.stdc.stdio;
void main()
{
auto b = (cast(BufferedOutput)Cout.stream);
auto s = Cout.stream;
OutputStream s2 = b;
extern mod extra;
use std::ops::Add;
use std::vec;
use std::fmt;
use std::io::Writer;
use std::num::min;
trait VectorGet
{
@SiegeLord
SiegeLord / test.rs
Last active December 30, 2015 10:49
Label setting
use std::io;
fn test1(adder: |add: |x: int, lw: |&mut io::Writer|||)
{
let mut out = io::stdout();
let w = &mut out as &mut io::Writer;
let add = |x: int, lw: |&mut io::Writer||
{
writeln!(w, "Location: {}", x);
@SiegeLord
SiegeLord / test.rs
Created November 2, 2013 22:27
NoSuck<E>
use std::num::Zero;
trait VectorOf<E>
{
fn new() -> Self;
fn get<'l>(&'l self, i: uint) -> &'l E;
}
impl<E> VectorOf<E> for ~[E]
{
@SiegeLord
SiegeLord / commands
Created October 31, 2013 03:09
LDC bug
ldc2 -relocation-model=pic -c test1.d
ldc2 -relocation-model=pic -c test2.d
ldc2 -shared -of test.so test1.o test2.o
@SiegeLord
SiegeLord / commands
Created October 19, 2013 22:54
Link bug
rustc --lib lib.rs
rustc test.rs -L.
@SiegeLord
SiegeLord / test.rs
Created October 10, 2013 06:13
use enum
pub use a::B;
mod a
{
pub enum B
{
C
}
}
@SiegeLord
SiegeLord / err
Last active December 25, 2015 02:59
Privacy
test.rs:1:4: 1:14 error: function `test` is private
test.rs:1 use A::B::test;
^~~~~~~~~~
error: aborting due to previous error