Skip to content

Instantly share code, notes, and snippets.

use std::run::{Process, ProcessOptions};
use std::str::{byte_slice};
fn main()
{
let mut p = Process::new("gnuplot", [~"-p"], ProcessOptions::new());
let input = p.input();
byte_slice("plot x*x\n", |s| { input.write(s); } );
}
@SiegeLord
SiegeLord / test.rs
Last active December 18, 2015 04:29
Parent-Child ref
fn main()
{
trait Trait
{
}
struct Parent
{
a : Option<~Trait>
struct Axes2D;
impl Axes2D
{
fn new() -> Axes2D
{
Axes2D
}
}
@SiegeLord
SiegeLord / bin.rs
Created June 13, 2013 16:00
Array impl
enum PlotOption<'self>
{
Caption(&'self str),
}
impl<'self> &'self [PlotOption<'self>]
{
}
struct A()
{
int opCmp(const ref A p) const
{
return 0;
}
string toString()
{
return "";
@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;
@SiegeLord
SiegeLord / commands
Created June 30, 2013 21:12
More bugs
dmd -shared -fPIC -O -m32 testlib.d -release
dmd -L./lib/32/shared/libtango-dmd.so.0.63.0 test2.d -L-lbz2 -L-ldl -defaultlib=libphobos2.so -L./testlib.so
@SiegeLord
SiegeLord / test.rs
Created July 6, 2013 15:50
Trait object
impl<'self> ToStr for ~std::to_str::ToStr
{
fn to_str(&self) -> ~str
{
self.to_str();
}
}
fn test<T : ToStr>(a : T)
{
@SiegeLord
SiegeLord / test.rs
Created August 4, 2013 15:07
Regression?
use private::*;
impl A
{
fn test()
{
}
}
mod private
@SiegeLord
SiegeLord / test.rs
Created August 24, 2013 20:31
Callbacks
extern "C"
{
fn a();
fn b(a: extern "C" fn());
}
fn main()
{
unsafe
{