Skip to content

Instantly share code, notes, and snippets.

@staticgc
staticgc / conn.rs
Created January 30, 2021 06:31
Bandwidth control in hyper
use std::task::{Context, Poll};
use std::pin::Pin;
use hyper::client::{connect::{Connection, Connected}};
use tokio::net::{TcpStream};
use tokio::io::{ReadBuf, AsyncWrite, AsyncRead};
use async_speed_limit::{limiter::{Limiter, Consume}, clock::{StandardClock}};
use futures_util::future::Future;
//use anyhow::Error;
use std::io::Error;