Skip to content

Instantly share code, notes, and snippets.

Ben Striegel bstrie

  • Pittsburgh, PA
Block or report user

Report or block bstrie

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 gist:1d8acbf8992d7e2ac3c0c60531e3d9c8
fn redis_insert_account(
specified_id: Option<u64>,
account: AccountDetails,
) -> Box<dyn Future<Item = Account, Error = ()> + Send> {
let connection = self.connection.clone();
let routing_table = self.routes.clone();
let encryption_key = self.encryption_key.clone();
// Instead of storing the incoming secrets, we store the HMAC digest of them
View gist:694ce5dd17eca88328569eaaff38110f
error[E0599]: no method named `and_then` found for type `futures::future::either::Either<std::result::Result<(redis::async::SharedConnection, account::Account), _>, futures::future::and_then::AndThen<futures::future::and_then::AndThen<impl futures::future::Future, std::result::Result<account::Account, ()>, [closure@crates/interledger-store-redis/src/ 323:22 account:_]>, futures::future::and_then::AndThen<futures::future::map_err::MapErr<std::boxed::Box<dyn futures::future::Future<Item = (redis::async::SharedConnection, std::vec::Vec<bool>), Error = redis::types::RedisError> + std::marker::Send>, [closure@crates/interledger-store-redis/src/ 346:30]>, std::result::Result<(redis::async::SharedConnection, account::Account), ()>, [closure@crates/interledger-store-redis/src/ 355:34 keys:_, account:_]>, [closure@crates/interledger-store-redis/src/ 357:22 btp_incoming_token_hmac:_, http_incoming_token_hmac:_, connection:_]>>` in the current scope
bstrie /
Last active Sep 1, 2019
lazy static of the future
// This type is a replacement for the macro provided by the lazy_static crate
use lazy::Lazy;
use std::collections::HashMap;
static GLOBAL_MAP: Lazy<HashMap<u32, &str>> = Lazy::new(|| {
let mut m = HashMap::new();
m.insert(0, "foo");
m.insert(1, "bar");
m.insert(2, "baz");
Compiling countess v0.1.0 (C:\Users\Ben\code\rust\countess)
error[E0412]: cannot find type `ItemFn` in module `syn`
--> src\
7 | let input = syn::parse_macro_input!(item as syn::ItemFn);
| ^^^^^^ not found in `syn`
error: aborting due to previous error
View asdf.cpp
#include <iostream>
#include <vector>
int main() {
std::vector<int> v { 2, 3, 4 };
for(auto i: v) {
if (i % 2 == 0) {
v.push_back(i * -1);
src\ 54:34 error: cannot borrow `*self` as mutable more than once at a time
src\ let sprite = self.child_mut(id).unwrap();
src\ 54:34 note: previous borrow of `*self` occurs here; the mutable borrow prevents subsequent moves, borrows, or modification of `*self
` until the borrow ends
src\ let sprite = self.child_mut(id).unwrap();
src\ 81:6 note: previous borrow ends here
src\ pub fn event<E>(&'a mut self, e: &E) where E: GenericEvent {
extern crate serde;
use std::env;
use std::path::Path;
use serde::json;
fn main() {
let our_args: Vec<String> = std::env::args().collect();
let base_name = Path::new(&our_args[0])
.file_name().expect("Path is not a file")
use std::io::BufRead;
fn main() {
let stdin = std::io::stdin();
for line in stdin.lock().lines().take(2) {
println!("{}", line.unwrap());
fn main() {
let make_counter = || {
let mut count = 0;
move || { let so_far = count; count += 1; so_far }
let mut a = make_counter();
let mut b = make_counter();
println!("{} {}", a(), a());
println!("{} {}", b(), b());
View Cargo.toml
You can’t perform that action at this time.