Skip to content

Instantly share code, notes, and snippets.

boats withoutboats

Block or report user

Report or block withoutboats

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View scalar-conv.rs
/*
Psuedocode from signal:
calculate_key_pair(k):
E = kB
A.y = E.y
A.s = 0
if E.s == 1:
a = -k (mod q)
View for-await.md

Considerations for writing a loop over a Stream as it relates to await syntax.

JavaScript uses this syntax:

for await (elem of stream) {
   // ...
}
View pin-projection-builtin.md

We add a built in attribute for handling pin projection:

struct MyCombinator<F> {
    #[pin_accessor]
    field: F,
}

This generates a method fn field_pin(self: PinMut<'_, Self>) -> PinMut<'_, F>, and also generates these constraints:

@withoutboats
withoutboats / alt-registry-use-cases.md
Created Jul 11, 2018
use cases for alternative registries
View alt-registry-use-cases.md

This is a list of potential use cases for something like alternative registries & some analysis of how to solve these use cases.

As context, a registry contains two network service components:

  1. The index: a git repository containing metadata about the packages in the registry
  2. The crate source: an HTTP server serving the actual package data

Private registry

I want to host my own crates separately from crates.io, to serve to people with appropriate access.

View fix-the-error-trait.md

We don't need a need a new error trait if we just fix std::error::Error

Our great anguish around error handling is the incorrectness of the Error trait. Here's an easy way to solve the problem: fix the error trait. Literally: just change the existing trait so that it is correct.

Step 1: Remove description (DONE)

Description is already being deprecated, with a default method provided. Done and done.

Step 2: Add backtrace (TRIVIAL)

@withoutboats
withoutboats / async-methods-ii.md
Last active Jun 21, 2018
Async Methods II: object safety
View async-methods-ii.md

Async Methods II: object safety

(Note: this is posted as a gist because my primary blog host is having some trouble today, and I can't get my blog to deploy. It will be on my blog eventually.)

[Last time][async-methods-i], we introduced the idea of async methods, and talked about how they would be implemented: as a kind of anonymous associated type on the trait that declares the method, which corresponds to a different, anonymous future type for each implementation of that method. Starting this

View async-methods.md

Goal:

trait MyTrait {
    async fn foo(&self) -> i32;
}

impl MyTrait for MyType {
    async fn foo(&self) -> i32 {
       /* ... * /
@withoutboats
withoutboats / net-wg-slides.md
Created Mar 29, 2018
net wg presentation slide data
View net-wg-slides.md

Network services WG


Network services WG

  1. Async IO
  2. Library support for network services

@withoutboats
withoutboats / constraint-kinds.md
Last active Mar 16, 2018
Constraint Kinds in Rust
View constraint-kinds.md

Notes on adding Constraint Kinds to Rust

Background: Constraint Kinds

a trait can be thought of as a type operator generating a "constraint" - what in Rust would usually be called a bound. For example:

// Declares a new item `Foo` with kind `type -> constraint`
trait Foo { }
View cargonauts_echo.rs
#[macro_use] extern crate cargonauts;
use cargonauts::futures::{Future, future};
use cargonauts::resources::{Resource, Environment, Error};
use cargonauts::methods::Get;
use cargonauts::formats::Debug;
routes! {
resource Echo {
method Get in Debug;
You can’t perform that action at this time.