Skip to content

Instantly share code, notes, and snippets.

View leejw51crypto's full-sized avatar

Jongwhan Lee leejw51crypto

View GitHub Profile
@vi
vi / tcpclose.crs
Created August 2, 2018 16:29
Rust Tokio fast TCP socket close handling
#!/usr/bin/env run-cargo-script
//! ```cargo
//! [dependencies]
//! tokio = "=0.1.7"
//! tokio-codec = "*"
//! tokio-io = "=0.1.7"
//! futures-cpupool = "*"
//! mio = "*"
//!
//! [replace]
@alex-shapiro
alex-shapiro / and_select.rs
Created July 26, 2017 13:57
An "AND" version of the futures stream combinator
//! An adapter for merging the output of two streams, where
//! the stream resolves as soon either stream resolves.
use futures::{Poll, Async};
use futures::stream::{Stream, Fuse};
pub struct AndSelect<S1, S2> {
stream1: Fuse<S1>,
stream2: Fuse<S2>,
flag: bool,