Skip to content

Instantly share code, notes, and snippets.

View hoodie's full-sized avatar
🎯
Focusing

Hendrik Sollich hoodie

🎯
Focusing
View GitHub Profile

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

@ruempel
ruempel / stopmonitor.html
Last active January 30, 2018 14:42
Stop monitor for selected stops in Dresden public transport (HTML+JS installable to Android homescreen)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Stop Monitor</title>
<meta name="viewport" content="width=device-width"/>
<link rel="manifest" href="manifest.json"/>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha384-xBuQ/xzmlsLoJpyjoggmTEz8OWUFM0/RC5BsqQBDX2v5cMvDHcMakNTNrHIW2I5f"
crossorigin></script>
@kiliankoe
kiliankoe / clfdns.rb
Last active February 22, 2019 20:37
Cloudflare DynDNS
#! /usr/bin/env ruby
require 'net/http'
require 'cloudflare'
# Email used for login
CLOUDFLARE_EMAIL = ENV["CLOUDFLARE_EMAIL"]
# API Key, can be found here => https://www.cloudflare.com/a/account/my-account
CLOUDFLARE_API_KEY = ENV["CLOUDFLARE_API_KEY"]
@bkaradzic
bkaradzic / orthodoxc++.md
Last active May 30, 2024 05:37
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@hoodie
hoodie / 35C3.svg
Last active February 5, 2023 11:49
assembly poster
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@deadalusai
deadalusai / tasks.json
Last active September 23, 2023 03:18
VS Code tasks.json for Rust/Cargo
/*
Before using this tasks.json you may like to consider trying one of the following VS Code extensions:
rust-analyzer
Marketplace: https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer
Source: https://github.com/rust-analyzer/rust-analyzer
rls
Marketplace: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Source: https://github.com/rust-lang/rls-vscode
@s-panferov
s-panferov / option.ts
Created November 30, 2014 12:15
Option and Result types from Rust in TypeScript
interface Option<T> {
map <U>(fn: (a: T) => U): Option<U>;
isSome(): boolean;
isNone(): boolean;
isSomeAnd(fn: (a: T) => boolean): boolean;
isNoneAnd(fn: () => boolean): boolean;
unwrap(): T;
unwrapOr(def: T): T;
unwrapOrElse(f: () => T): T;
map<U>(f: (a: T) => U): Option<U>;