Skip to content

Instantly share code, notes, and snippets.

async fn update_root<V, U>(&self, ...) -> ... {
Box::new(async {
// 1. first we grab the lock
let tuf = self.tuf.lock().unwrap();
// 2. yield to the scheduler
let signed = await!(
repo.fetch_metadata(...)
);
/// Returns `true` if an update occurred and `false` otherwise.
fn update_root<V, U>(&self, repo: Arc<V>, config: &Config<U>) -> TufFuture<bool>
where
V: Repository<D> + 'static,
U: PathTranslator,
{
let err_msg = "TUF claimed no update occurred when one should have. \
This is a programming error. Please report this as a bug.";
let tuf = self.tuf.clone();
struct Foo {
things: Arc<Mutex<Thing>>,
}
impl Foo {
async fn foo(&self) {
let things = things.lock().unwrap();
await!(self.bar())
...
}
@erickt
erickt / history.md
Last active January 2, 2020 06:37
serde history

Rust serialization has a long history. At first, there was just some very simple formats. In March 2011, Patrick Walton added support for serializing rust object metadata into EBML (reader and writer. Then in November 2011, Elly Jones added a json library. But their functionality was quite limited, and required manual serialization. So in Feburary 2012, Niko Matsakis created the serialization plugin (1, 2, and 3).

Over time, Erick Tryzelaar took over maintenance of serialization. He converted it over to the new [trait system](https://github.

# Agenda
URL for tracker: https://github.com/rust-lang/rust/issues/40721
- Alex's notes
https://gist.github.com/alexcrichton/a9a6db33a9aaea4e37f539fa90ca7f13
- Historical problems
- Scope
#[derive(Queryable)]
pub struct Account {
#[diesel(type="BigInt")]
pub id: i32,
#[diesel(name="user_name", type="Nullable<VarChar>")]
pub username: String,
#[diesel(type="BigInt")]
pub balance: i32,
import csv
import itertools
import sys
from collections import defaultdict
from operator import itemgetter
import networkx as nx
import matplotlib.pyplot as plt
from networkx.drawing.nx_agraph import graphviz_layout
This file has been truncated, but you can view the full file.
2017/02/08 19:06:51 [WARN] Invalid log level: "1". Defaulting to level: TRACE. Valid levels are: [TRACE DEBUG INFO WARN ERROR]
2017/02/08 19:06:51 [INFO] Terraform version: 0.8.6
2017/02/08 19:06:51 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.8.6/bin/terraform", "get"}
2017/02/08 19:06:51 [DEBUG] Detected home directory from env var: /Users/erickt
2017/02/08 19:06:51 [DEBUG] Detected home directory from env var: /Users/erickt
2017/02/08 19:06:51 [DEBUG] Attempting to open CLI config file: /Users/erickt/.terraformrc
2017/02/08 19:06:51 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/02/08 19:06:51 [DEBUG] Detected home directory from env var: /Users/erickt
2017/02/08 19:06:51 [TRACE] Preserving existing state lineage "4fb31863-7a24-4b85-a598-0d1c8cb1758c"
2017/02/08 19:06:51 [TRACE] Preserving existing state lineage "4fb31863-7a24-4b85-a598-0d1c8cb1758c"
@erickt
erickt / gist:300d82eda262c70f144271c33c46c666
Created December 20, 2016 18:52
2016 Rust Belt Rust Conference Retrospective

Graphs speak louder than words

Some aggregate results from an attendee survey I sent out that 40 people responded to: http://imgur.com/gallery/fxKbm

Things that went well

  • I'm happy with our speaker selection, we had a good mix of locals and folks from out of town, Rust team members and people just starting to get active in the Rust community, experienced speakers and new speakers.
  • People had fun, learned things, and met each other!
  • Sponsors were amazing, especially Chef. One of my favorite moments was watching hoverbear send a PR to Habitat after hanging out in the hallway with them :)
  • I am so glad I invited the students from Pittsburgh's code bootcamp, Academy.
fn long_running_future(timer: Timer,
times: u64,
a: u64)
-> Box<Future<Item = u64, Error = TimerError> + Send> {
struct StateMachine<S, F> {
state: S,
next: F,
}
impl<S, F, Item, Error> StateMachine<S, F>
where S: ::std::default::Default,