Upgrade socket2 and log

This commit is contained in:
Steven Fackler 2018-01-09 20:32:55 -08:00
parent 89d39cc5ab
commit 863a295aae
5 changed files with 40 additions and 32 deletions

View File

@ -1,8 +1,9 @@
extern crate linked_hash_map;
extern crate marksman_escape;
extern crate phf_codegen;
extern crate regex;
extern crate marksman_escape;
extern crate linked_hash_map;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use std::path::Path;

View File

@ -1,8 +1,9 @@
use regex::Regex;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use std::collections::BTreeMap;
use std::fs::File;
use std::io::{Write, BufWriter};
use std::io::{BufWriter, Write};
use std::path::Path;
use marksman_escape::Escape;
@ -164,12 +165,13 @@ pub enum Inner {{"
}
fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
write!(w,
"impl Inner {{
write!(
w,
"impl Inner {{
pub fn from_oid(oid: Oid) -> Option<Inner> {{
match oid {{
",
).unwrap();
).unwrap();
for (oid, type_) in types {
write!(
@ -181,15 +183,16 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
).unwrap();
}
write!(w,
" _ => None,
write!(
w,
" _ => None,
}}
}}
pub fn oid(&self) -> Oid {{
match *self {{
",
).unwrap();
).unwrap();
for (oid, type_) in types {
@ -202,15 +205,16 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
).unwrap();
}
write!(w,
" Inner::Other(ref u) => u.oid,
write!(
w,
" Inner::Other(ref u) => u.oid,
}}
}}
pub fn kind(&self) -> &Kind {{
match *self {{
",
).unwrap();
).unwrap();
for type_ in types.values() {
let kind = match type_.kind {
@ -232,15 +236,16 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
).unwrap();
}
write!(w,
r#" Inner::Other(ref u) => &u.kind,
write!(
w,
r#" Inner::Other(ref u) => &u.kind,
}}
}}
pub fn name(&self) -> &str {{
match *self {{
"#,
).unwrap();
).unwrap();
for type_ in types.values() {
write!(
@ -263,25 +268,26 @@ r#" Inner::Other(ref u) => &u.kind,
}
fn make_consts(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
write!(w,
"pub mod consts {{
write!(
w,
"pub mod consts {{
use types::Type;
use types::type_gen::Inner;
",
).unwrap();
).unwrap();
for type_ in types.values() {
write!(w,
"
write!(
w,
"
/// {docs}
pub const {ident}: Type = Type(Inner::{variant});
",
docs = type_.doc,
ident = type_.ident,
variant = type_.variant).unwrap();
docs = type_.doc,
ident = type_.ident,
variant = type_.variant
).unwrap();
}
write!(w,
"}}"
).unwrap();
write!(w, "}}").unwrap();
}

View File

@ -1,5 +1,6 @@
use fallible_iterator::FallibleIterator;
use postgres_protocol::message::backend::DataRowBody;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use std::io;
use std::ops::Range;
@ -43,9 +44,8 @@ impl Sealed for str {
// FIXME ASCII-only case insensitivity isn't really the right thing to
// do. Postgres itself uses a dubious wrapper around tolower and JDBC
// uses the US locale.
stmt.iter().position(
|d| d.name().eq_ignore_ascii_case(self),
)
stmt.iter()
.position(|d| d.name().eq_ignore_ascii_case(self))
}
}

View File

@ -58,8 +58,8 @@ no-logging = []
[dependencies]
bytes = "0.4"
fallible-iterator = "0.1.3"
log = "0.3"
socket2 = "0.2"
log = "0.4"
socket2 = "0.3"
openssl = { version = "0.9.2", optional = true }
native-tls = { version = "0.1", optional = true }

View File

@ -2,9 +2,10 @@
use std::cell::Cell;
use std::fmt;
#[allow(unused_imports)]
use std::ascii::AsciiExt;
use {bad_response, Result, Connection};
use {bad_response, Connection, Result};
use rows::Rows;
use stmt::Statement;
use types::ToSql;