I hereby claim:
- I am sfackler on github.
- I am sfackler (https://keybase.io/sfackler) on keybase.
- I have a public key whose fingerprint is 9F2B F803 5007 0D26 48D1 D60C 4089 17B7 276A 5226
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
let client = connect("user=postgres").await; | |
let f = async move { | |
let params: Vec<Box<dyn ToSql + Sync + Send>> = vec![Box::new(1i32)]; | |
client.query_raw("SELECT $1::INT4", params.iter().map(|p| &**p as _)).await.unwrap(); | |
}; | |
fn is_send<T: Send>(_: T) {} | |
is_send(f); |
use futures::task::{self, Task}; | |
use futures::{Async, Future, Poll}; | |
use hyper::body::{Body, Payload}; | |
use hyper::server::conn::Connection; | |
use hyper::service::Service; | |
use parking_lot::Mutex; | |
use std::collections::HashMap; | |
use std::error::Error; | |
use std::sync::Arc; | |
use tokio_io::{AsyncRead, AsyncWrite}; |
error[E0277]: the trait bound `Bd: std::marker::Unpin` is not satisfied in `server::idle::__unpin_scope_TrackedBody::__TrackedBody<'_, Bd>` | |
--> sorcery2/src/server/idle.rs:47:20 | |
| | |
47 | conn: http.serve_connection(io, service), | |
| ^^^^^^^^^^^^^^^^ within `server::idle::__unpin_scope_TrackedBody::__TrackedBody<'_, Bd>`, the trait `std::marker::Unpin` is not implemented for `Bd` | |
| | |
= help: consider adding a `where Bd: std::marker::Unpin` bound | |
= note: required because it appears within the type `server::idle::__unpin_scope_TrackedBody::__TrackedBody<'_, Bd>` | |
= note: required because of the requirements on the impl of `std::marker::Unpin` for `server::idle::TrackedBody<Bd>` | |
= note: required because of the requirements on the impl of `core::future::future::Future` for `hyper::proto::h2::server::H2Stream<server::idle::TrackedFuture<<S as tower_service::Service<http::request::Request<hyper::body::body::Body>>>::Future>, server::idle::TrackedBody<Bd>>` |
error[E0277]: the trait bound `Bd: std::marker::Unpin` is not satisfied in `server::idle::__unpin_scope_TrackedBody::__TrackedBody<'_, Bd>` | |
--> sorcery2/src/server/idle.rs:47:20 | |
| | |
47 | conn: http.serve_connection(io, service), | |
| ^^^^^^^^^^^^^^^^ within `server::idle::__unpin_scope_TrackedBody::__TrackedBody<'_, Bd>`, the trait `std::marker::Unpin` is not implemented for `Bd` | |
| | |
= help: consider adding a `where Bd: std::marker::Unpin` bound | |
= note: required because it appears within the type `server::idle::__unpin_scope_TrackedBody::__TrackedBody<'_, Bd>` | |
= note: required because of the requirements on the impl of `std::marker::Unpin` for `server::idle::TrackedBody<Bd>` | |
= note: required because of the requirements on the impl of `core::future::future::Future` for `hyper::proto::h2::server::H2Stream<server::idle::TrackedFuture<<S as tower_service::Service<http::request::Request<hyper::body::body::Body>>>::Future>, server::idle::TrackedBody<Bd>>` |
use bytes::Buf; | |
use futures::task::Context; | |
use futures::Sink; | |
use http::HeaderMap; | |
use http_body::{Body, SizeHint}; | |
use pin_project::pin_project; | |
use std::pin::Pin; | |
use std::task::Poll; | |
pub trait WriteBody { |
use criterion::{Bencher, Benchmark, Criterion}; | |
use postgres::{Client, NoTls}; | |
use postgres_sync::{Connection, TlsMode}; | |
fn prepare_new(b: &mut Bencher) { | |
let mut client = Client::connect("user=postgres host=localhost port=5433", NoTls).unwrap(); | |
b.iter(|| client.prepare("SELECT $1::TEXT").unwrap()); | |
} | |
fn prepare_old(b: &mut Bencher) { |
extern crate openssl; | |
use openssl::ssl::{SslConnectorBuilder, SslMethod}; | |
use std::net::TcpStream; | |
const INCLUSTER_CA_FILE: &str = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"; | |
fn main() { | |
let mut builder = SslConnectorBuilder::new(SslMethod::tls()).expect("can't create connector"); | |
builder.builder_mut().set_ca_file(INCLUSTER_CA_FILE).expect("can't add root cert"); |
// This implementation and the test suite comes from Java metric-core's | |
// ExponentiallyDecayingReservoir. | |
use ordered_float::NotNaN; | |
use std::collections::BTreeMap; | |
use std::time::{Instant, Duration}; | |
use rand::{self, Rng, Open01}; | |
const DEFAULT_SIZE: usize = 1028; | |
const DEFAULT_ALPHA: f64 = 0.015; |
time: 0.009 parsing | |
time: 0.000 recursion limit | |
time: 0.000 crate injection | |
time: 0.000 plugin loading | |
time: 0.000 plugin registration | |
time: 0.040 expansion | |
time: 0.000 maybe building test harness | |
time: 0.000 maybe creating a macro crate | |
time: 0.000 checking for inline asm in case the target doesn't support it | |
time: 0.001 complete gated feature checking |