Skip to content

Instantly share code, notes, and snippets.

View dummy_patch.go
type Patch struct {
// Implementation detail, should not be accessed
from string
to string
func NewPatch(from string, to string) *Patch {
return &Patch { from, to }
View Looking into the

Looking into the Future

futures-rs is the library which will hopefully become a shared foundation for everything async in Rust. However it's already become renowned for having a steep learning curve, even for experienced Rustaceans.

I think one of the best ways to get comfortable with using a library is to look at how it works internally: often API design can seem bizarre or impenetrable and it's only when you put yourself in the shoes of the library author that you can really understand why it was designed that way.

In this post I'll try to put down on "paper" my understanding of how futures work and I'll aim to do it in a visual way. I'm going to assume you're already somewhat familiar with Rust and why futures are a useful tool to have at one's disposal.

For most of this post I'll be talking about how things work today (as of September 2017). At the end I'll touch on what's being proposed next and also make a case for some of the changes I'd like to see.

If you're interested in learning more ab

# models/
from models.b import B
class A(B):

Keybase proof

I hereby claim:

  • I am diggsey on github.
  • I am diggsey ( on keybase.
  • I have a public key ASAbSggcnYsqsT-vB5R_CInXw8SoX802gTOYgA9VwEEttwo

To claim this, I am signing this object:

View gist:1484bae7380f2b67a64e
WARNING: Invalid ObjectId('56977123e8db417e08bcc14f') referenced from ObjectId('56977123e8db417e09bcc150')
WARNING: Deleting row (ProcessInstance)!
WARNING: Invalid ObjectId('56977123e8db417e08bcc14f') referenced from ObjectId('56977123e8db417e0abcc150')
WARNING: Deleting row (ProcessInstance)!
WARNING: Invalid ObjectId('56977123e8db417e08bcc14f') referenced from ObjectId('56977123e8db417e0bbcc150')
WARNING: Deleting row (ProcessInstance)!
WARNING: Invalid ObjectId('56977123e8db417e08bcc14f') referenced from ObjectId('56977123e8db417e0bbcc155')
WARNING: Deleting row (ProcessInstance)!
WARNING: Invalid ObjectId('56977123e8db417e08bcc14f') referenced from ObjectId('56977124e8db417e0abcc155')
WARNING: Deleting row (ProcessInstance)!
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base, DeclarativeMeta
class OwningContext(object):
__slots__ = ('instance', 'prefix')
def __init__(self, instance, prefix):
self.instance = instance
Diggsey / main.cpp
Created Oct 1, 2015
Simple quantum computer emulator
View main.cpp
#include "stdafx.h"
template<size_t N>
class qgate {
static const size_t c_inputs = N;
class qstate {
View gist:adcd1c2ac96c045b2e1c
This file has been truncated, but you can view the full file.
cfg: version 1.4.0-dev (d03456183 2015-08-05)
cfg: build triple x86_64-pc-windows-gnu
cfg: host triples x86_64-pc-windows-gnu
cfg: target triples x86_64-pc-windows-gnu
cfg: host for x86_64-pc-windows-gnu is x86_64
cfg: os for x86_64-pc-windows-gnu is pc-windows-gnu
cfg: good valgrind for x86_64-pc-windows-gnu is
cfg: using CC=gcc (CFG_CC)
cfg: disabling valgrind run-pass tests
View gist:cefdbd068c540a4d0daa

Program Database (PDB) File Format

The PDB file format is a compound file. It is composed of numbered data streams, each of which stores some predefined information about the target program. For example, one stream appears to contain a list of symbol names, while another describes the code and data sections used by the linker.

A special stream, the root stream, contains all the information necessary to locate the other streams within the file.

All numbers are encoded in little-endian format.

Credit to for reverse-engineering an older version of the PDB format, which helped considerably.

View gist:1b55018922accfbbbec3
// AmpBug.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <amp.h>
#include <iostream>
#include <iomanip>
using namespace concurrency;