profile
viewpoint
Steven Fackler sfackler @palantir Palo Alto, CA

estk/log4rs 316

A highly configurable logging framework for Rust

a8m/pb 291

Console progress bar for Rust

sebasmagri/env_logger 195

A logging implementation for `log` which is configured via an environment variable.

pyfisch/cbor 177

CBOR support for serde.

gnzlbg/jemallocator 153

Rust allocator using jemalloc as a backend

carllerche/syncbox 128

Concurrency utilities for Rust

kornelski/rust-security-framework 66

Bindings to the macOS Security.framework

rust-lang-nursery/unix-socket 51

Unix socket support for Rust

pull request commentrust-lang/rust

Implement TryFrom<Vec<u8>> for String

That's going down the nightmare encoding detection heuristics route.

chmln

comment created time in 2 days

pull request commentrust-lang/rust

Implement TryFrom<Vec<u8>> for String

I think this has come up in the past, and we did not want to do this due to the question of text encoding. Locking the impl down to UTF8 only is kind of arbitrary, and we don't want to have some nightmare encoding detection heuristics either.

chmln

comment created time in 2 days

pull request commentsfackler/r2d2

Derive PartialEq for Error

Why do you need to compare your wrapped error for equality? There are a lot of error types in the wild that cannot do that (e.g. io::Error, Box<dyn Error>, ...).

joecorcoran

comment created time in 2 days

pull request commentsfackler/r2d2

Derive PartialEq for Error

I don't know if comparing the string description of the underlying error is the best idea.

joecorcoran

comment created time in 2 days

pull request commentrust-lang/rust

Make `u8::is_ascii` a stable `const fn`

@bors r+ rollup

ecstatic-morse

comment created time in 2 days

issue commentrust-lang/triagebot

Add `ack` as a synonym for `acknowledge` in Zulip

Thanks!

sfackler

comment created time in 3 days

issue openedrust-lang/triagebot

Add `ack` as a synonym for `acknowledge` in Zulip

When running through my list of notifications, it'd be nice if I could just type ack 1 versus acknowledge 1, since the second is a bit of a handful to type.

created time in 3 days

delete branch sfackler/rocksdb

delete branch : logger-consistency

delete time in 3 days

delete branch palantir/conjure-rust

delete branch : back-compat-fix

delete time in 3 days

push eventpalantir/conjure-rust

Steven Fackler

commit sha cfa7accd56917427d0a3dd3985dc3d79c62cc372

Clients now allow void methods to return JSON

view details

Steven Fackler

commit sha 254131b380e0694beb0e47e87041ba21b54ce5f4

Add generated changelog entries

view details

Steven Fackler

commit sha 48f6893c4fab17c7fd3d8cfed17f0eaafde02be1

Add generated changelog entries

view details

Steven Fackler

commit sha 1299f6b44232f7fd36221205fa8e1ae72d0f29d6

Merge pull request #101 from palantir/back-compat-fix Clients now allow void methods to return JSON

view details

push time in 3 days

PR merged palantir/conjure-rust

Reviewers
Clients now allow void methods to return JSON

Before this PR

Clients would previously treat an unexpected JSON response from an endpoint expected to return nothing as an error.

After this PR

==COMMIT_MSG== Clients now allow a server to return JSON to from an endpoint expected to return nothing. ==COMMIT_MSG==

+25 -2

1 comment

3 changed files

sfackler

pr closed time in 3 days

delete branch palantir/conjure

delete branch : sfackler-patch-1

delete time in 3 days

push eventpalantir/conjure

Steven Fackler

commit sha ca1aeb72d9447e0301f47ab309d145da8e878e9f

Add some clarifications around empty responses (#535)

view details

push time in 3 days

PR merged palantir/conjure

Reviewers
Add some clarifications around empty responses
+6 -1

1 comment

1 changed file

sfackler

pr closed time in 3 days

issue commentrust-lang/rust

`is_x86_feature_detected!("avx512f")` fails to build on nightly

Even if we don't want to stabilize the intrinsics themselves for whatever reason, it seems fine to allow detection of avx512 support via the macro.

oconnor663

comment created time in 3 days

PR opened palantir/conjure-rust

Reviewers
Clients now allow void methods to return JSON

Before this PR

Clients would previously treat an unexpected JSON response from an endpoint expected to return nothing as an error.

After this PR

==COMMIT_MSG== Clients now allow a server to return JSON to from an endpoint expected to return nothing. ==COMMIT_MSG==

+19 -2

0 comment

2 changed files

pr created time in 3 days

create barnchpalantir/conjure-rust

branch : back-compat-fix

created branch time in 3 days

push eventpalantir/conjure-rust

push time in 3 days

push eventpalantir/conjure-rust

Steven Fackler

commit sha b520644fae8c244c00071e71e0ba7700b0aa6771

Clients now allow void methods to return JSON

view details

push time in 3 days

create barnchpalantir/conjure

branch : sfackler-patch-1

created branch time in 3 days

PR closed rust-lang/rust

Fix an inconsistency in Linux version of TcpListener::accept S-waiting-on-author T-libs disposition-close finished-final-comment-period

If TcpListener is in non-blocking mode then accepted streams inherit this property on all platforms except Linux, where accept4 is used instead of accept.

This fix checks if a listener is in non-blocking mode and pass the corresponding flag to accept4.

Fixes https://github.com/rust-lang/rust/issues/67027

+40 -2

14 comments

2 changed files

hashmap

pr closed time in 3 days

delete branch sfackler/team

delete branch : patch-1

delete time in 3 days

PR opened rust-lang/team

Add zulip-id for sfackler

r? @Mark-Simulacrum

+1 -0

0 comment

1 changed file

pr created time in 3 days

push eventsfackler/team

Steven Fackler

commit sha de561943fc5268b8d87fd1c52e69e1b26861d0e5

Add zulip-id for sfackler

view details

push time in 3 days

fork sfackler/team

Rust teams structure

fork in 3 days

issue commenthyperium/hyper

Slow reading of small chunks

Definitely worth profiling to find where the hot spots are, but I ran into something similar with tokio-postgres and found that it was much more efficient to send "macro blocks" of multiple messages through the channel from the connection to request future and have it split apart in the response stream itself: https://github.com/sfackler/rust-postgres/pull/452

dneuhaeuser-zalando

comment created time in 4 days

issue commentrust-lang/cargo

cannot produce proc-macro when `--target` is set on musl host toolchain

You don't need to use a MUSL host toolchain to target MUSL.

12101111

comment created time in 5 days

pull request commentrust-lang/rust

#[track_caller] in traits

r? @eddyb

anp

comment created time in 5 days

pull request commentsfackler/rust-native-tls

Implement PKCS8 certificate support for all three backends.

It's probably best to just remove the README test - that feature of rustdoc isn't super robust as the current failure shows.

Goirad

comment created time in 5 days

Pull request review commentsfackler/rust-native-tls

Implement PKCS8 certificate support for all three backends.

 impl Identity {          Ok(Identity { cert: identity })     }++    pub fn from_pkcs8(pem: &[u8], key: &[u8]) -> Result<Identity, Error> {+        let mut store = Memory::new()?.into_store();+        let mut cert_iter = crate::pem::PemBlock::new(pem).into_iter();+        let leaf = cert_iter.next().expect("at least one certificate must be provided to create an identity");+        let cert = CertContext::from_pem(std::str::from_utf8(leaf).map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "leaf cert contains invalid utf8"))?)?;++        let mut options = AcquireOptions::new();+        options.container("schannel");

I think this test still needs to be added.

Goirad

comment created time in 5 days

Pull request review commentsfackler/rust-native-tls

Implement PKCS8 certificate support for all three backends.

+#![allow(unused)]++/// Split data by PEM guard lines+pub struct PemBlock<'a> {

Since this is only used by the schannel backend, could you move it into that module?

Goirad

comment created time in 5 days

Pull request review commentsfackler/rust-postgres

Expose async notifications in sync API

 impl Config {         self.config.get_channel_binding()     } -    /// Opens a connection to a PostgreSQL database.-    pub fn connect<T>(&self, tls: T) -> Result<Client, Error>+    /// Like `connect`, but `notify_fn` will be invoked with any asynchronous+    /// notifications or connection errors that arise.+    ///+    /// `notify_fn` is invoked from an asynchronous runtime and therefore must+    /// not block.+    pub fn connect_with<T, F>(&self, tls: T, mut notify_fn: F) -> Result<Client, Error>

I'd go with an Arc<dyn Fn(AsyncMessage) + Sync + Send>.

benesch

comment created time in 5 days

push eventsfackler/rust-postgres

Richard Dodd

commit sha 51dac3c86207b8fa7abe60ed4f935690f72829c5

Add Debug impls. This commit makes the following changes - Add an opaque `Debug` impl for `Client`. - Add a rich `Debug` impl for `Row`. - Make the `Debug` impl for `Type` clearer. - Change the `Debug` for `Column` to be slightly neater.

view details

Richard Dodd

commit sha 369427b38179d15d0ec11f4ee315a16d4aab96e5

Allow clippy lint in macro output.

view details

Richard Dodd

commit sha 6fd69dfd474d378ecdeecc77b1e9ec1acbb9a749

Make requested changes

view details

Steven Fackler

commit sha 89ea051d5affe1a3305869a7eaa36eee290ef36f

Merge pull request #538 from derekdreery/add_debug_impls Add Debug impls.

view details

push time in 5 days

PR merged sfackler/rust-postgres

Add Debug impls.

I added/modified some of the Debug implementations to help me make sense of why some of my queries didn't work as expected (spoiler alert: I had semantic errors in the queries). I thought these additions might be useful to the community.

This commit makes the following changes

  • Add an opaque Debug impl for Client.
  • Add a rich Debug impl for Row.
  • Make the Debug impl for Type clearer.
  • Change the Debug for Column to be slightly neater.
+42 -5

3 comments

4 changed files

derekdreery

pr closed time in 5 days

pull request commentsfackler/rust-postgres

Add Debug impls.

Merged, sorry for the delay!

derekdreery

comment created time in 5 days

issue commentsfackler/rust-log-mdc

Scoped access to inner `HashMap<String, String>`

Hmm, this does expose some implementation details, but I think that's probably fine? The whole idea of the crate is that it's just a thread-local map after all. We could wrap the HashMap in an opaque wrapper type but that'd just be a ton of work for not much benefit.

Feel free to open a PR!

nwtnni

comment created time in 5 days

pull request commentrust-lang/rust

Stabilize {f32, f64}::{LOG2_10, LOG10_2}

Thanks!

LeSeulArtichaut

comment created time in 5 days

pull request commentrust-lang/rust

Stabilize {f32, f64}::{LOG2_10, LOG10_2}

@bors r+ rollup

LeSeulArtichaut

comment created time in 5 days

issue commentrust-lang/cargo

cargo metadata --no-deps includes all packages in the workspace

Ideally there'd be a better way of using cargo-metadata with crate-oriented operations, but minimally the help docs should say how it behaves here.

sfackler

comment created time in 6 days

issue commentrust-lang/rust

RwLock: support upgrades and downgrades

pthreads is not a gold standard, it is a least common denominator. The standard library does not intend to provide arbitrarily obscure functionality.

I disagree that these operations are "essential" - C# is the only language that I'm aware of that offers them as part of its standard library.

d-e-s-o

comment created time in 6 days

issue commentrust-lang/rust

RwLock: support upgrades and downgrades

It would prohibit us from backing synchronization primitives with pthreads.

d-e-s-o

comment created time in 6 days

issue commentrust-lang/rust

RwLock: support upgrades and downgrades

Even though we want to move the internals to parking_lot, that's an implementation detail. I don't think we'd want to expand the API beyond what pthreads provides.

d-e-s-o

comment created time in 6 days

issue commentsfackler/rust-openssl

"session id context uninitialized" error on second connection (with peer verify)

You need to set a session ID context:

https://docs.rs/openssl/0.10.28/openssl/ssl/struct.SslContextBuilder.html#method.set_session_id_context

krzk

comment created time in 6 days

issue openedrust-lang/cargo

cargo metadata --no-deps includes all packages in the workspace

Problem

The --no-deps flag of cargo-metadata is documented as such

        --no-deps                     Output information only about the root package and don't fetch dependencies

From that, I would expect that the output would only include a single package. However, when run in a workspace, information about all packages in the workspace is output.

Steps <!-- The steps to reproduce the bug. -->

  1. Find a workspace with multiple packages.
  2. Run cargo metadata --no-deps --format-version 1
  3. Observe multiple packages in output

Notes

Output of cargo version: cargo 1.41.0 (626f0f40e 2019-12-03)

created time in 6 days

issue commentrust-lang/rust

SocketAddr from UnixDatagram recv_from missing the last character (on OS X)

I think the relevant bit of unix(7) may be this:

For example, some (but not all) implementations append a null terminator if none is present in the supplied sun_path.

So I think the correct behavior is to only chop off the last byte of sun_path if it is actually a zero byte.

zonyitoo

comment created time in 7 days

issue commenttokio-rs/tokio

tokio::fs discards all io::Errors and gives opaque, unclear errors

That does not throw away errors produced by filesystem calls, it throws away the JoinError which in this context can only be returned if the filesystem call panicked.

Can you give a specific example of some code that produces an opaque, unclear error?

djahandarie

comment created time in 8 days

issue commentrust-lang/rust

thread::Builder::spawn returns WouldBlock

If the process has reached its limit on how many threads it is allowed to have, it does not seem wise to just hot-spin trying to make a new one forever.

jethrogb

comment created time in 9 days

issue closedsfackler/rust-postgres

How to fetch all rows from a row-limited Portal?

The documentation is not very clear around query_portal and query_portal_raw. What happens when you call it and there are no rows left? Does it return an Error or an empty vec / empty Iterator?

I think that fetching all rows of a query, but in batches, is the main use case of this and having an example in the documentation on how to do that with both would be helpful.

Thanks!

closed time in 9 days

fbernier

issue closedsfackler/rust-postgres

Eager requests with pipelining

It would be great to attempt sending (and queuing when network would block) the request when Client::query is called, instead of deferring this until the future is polled. The benefit would be that results could already be waiting if enough compute or unrelated future waiting happens before the future is awaited.

Note that the claim

In both cases, the PostgreSQL server is executing the queries sequentially - pipelining just allows both sides of the connection to work concurrently when possible.

explicitly does not apply to CockroachDB.

Also, for various reasons, one is strongly incentivized to send early. It would be great if tokio-postgres would (at least optionally) support this. There are certainly ways around it, but I don't see any clean workaround.

closed time in 9 days

namibj

issue commentrust-lang/rfcs

Make alloc-free string manipulation more ergonomic with String::mutate(&mut self, ...)

The only time reallocation would be required is if the new slice is larger than the String's current capacity. Beyond that, the entire implementation is just to copy the slice into the bottom of the String's buffer and set its length to the size of the slice.

mqudsi

comment created time in 9 days

issue commentrust-lang/rfcs

Make alloc-free string manipulation more ergonomic with String::mutate(&mut self, ...)

I don't understand why the magic 'restricted semantics matter at all. In what way would the implementation be unable to deal with a string from outside its own buffer?

mqudsi

comment created time in 9 days

issue commentrust-lang/rust

Jemalloc causes os-level deadlock

Your compiler version is a year and a half out of date. Rust applications have used the system allocator by default since the 1.32.0 release (13 months ago).

git-blame

comment created time in 9 days

issue closedsfackler/rust-postgres

Consider exposing the `slice_iter` utility function in the public interface

I struggled for quite a while with Client::query_raw. I wasn't able to get usage of it to compile until I found the slice_iter helper function in the tokio-postgres code. As far as I can tell, you pretty much have to re-implement that function in order to use query_raw.

closed time in 9 days

aloucks

issue commentsfackler/rust-postgres

Consider exposing the `slice_iter` utility function in the public interface

slice_iter is just an internal function to adjust the codegen a bit. The master branch has an example of using query_raw: https://github.com/sfackler/rust-postgres/blob/master/tokio-postgres/src/client.rs#L333

aloucks

comment created time in 9 days

delete branch palantir/conjure-rust-runtime

delete branch : conjure-up

delete time in 9 days

push eventpalantir/conjure-rust-runtime

Steven Fackler

commit sha ec87b087d2a868762a3c069d9eb606861e8cf0ca

Upgrade conjure to 0.7

view details

Steven Fackler

commit sha f45bee3625585a09b53f862453fbd56ffdabd2d2

Release v0.2.0

view details

Steven Fackler

commit sha 01800e778d9e74338067b160301b8a1745b86727

Add generated changelog entries

view details

Steven Fackler

commit sha 7cccdfa0485d4addb5b5dcd6b24ac99b277c2ef9

Merge pull request #16 from palantir/conjure-up Upgrade conjure to 0.7

view details

push time in 9 days

PR opened palantir/conjure-rust-runtime

Reviewers
Upgrade conjure to 0.7
+20 -20

0 comment

6 changed files

pr created time in 10 days

create barnchpalantir/conjure-rust-runtime

branch : conjure-up

created branch time in 10 days

created tagpalantir/witchcraft-rust-logging

tagwitchcraft-log-0.3.0

Rust implementation of Witchcraft structured logging

created time in 10 days

release palantir/witchcraft-rust-logging

witchcraft-log-0.3.0

released time in 10 days

delete branch palantir/witchcraft-rust-logging

delete branch : conjure-up

delete time in 10 days

push eventpalantir/witchcraft-rust-logging

Steven Fackler

commit sha 5078dd6ab8deeb5d8a3ba1d25896a5b96b26ddf5

Release v0.3.0

view details

Steven Fackler

commit sha 9ad057fd599156fe5e23d467ba8da3f01fd00962

Bump ci version

view details

Steven Fackler

commit sha bfe88af2ab80029be882fcbc9d59e2e719d1e13e

Merge pull request #5 from palantir/conjure-up Upgrade conjure-error to 0.7

view details

push time in 10 days

push eventpalantir/witchcraft-rust-logging

Steven Fackler

commit sha 9ad057fd599156fe5e23d467ba8da3f01fd00962

Bump ci version

view details

push time in 10 days

create barnchpalantir/witchcraft-rust-logging

branch : conjure-up

created branch time in 10 days

delete branch palantir/conjure-rust

delete branch : any

delete time in 10 days

push eventpalantir/conjure-rust

Steven Fackler

commit sha c478bd7669da8f263745b5802d5383ab76d56d5c

Add a custom Any type

view details

Steven Fackler

commit sha bb1794a52fdbfc6dd7c22ee60bb44c5b04a1fb48

Add generated changelog entries

view details

Steven Fackler

commit sha b848743723d6d6c2f92e731cccf8cdbdcd1de199

Fix method name

view details

Steven Fackler

commit sha b6bc654db805e2af2aa8cebabb2a9894d4c4327b

Fix serialization codegen

view details

Steven Fackler

commit sha 80d1fc33529a2e079a2c4c1a288f67c6e96c8846

Release v0.7.0

view details

Steven Fackler

commit sha 1ff0a681f9b991878ab774a35a902028dccccd17

Make ErrorKind properly non exhaustive

view details

Steven Fackler

commit sha 1fdc47b269978d242f635273cccccb9f7429c7aa

Merge pull request #100 from palantir/any Add a custom Any type

view details

push time in 10 days

PR merged palantir/conjure-rust

Reviewers
Add a custom Any type

Before this PR

We previously used serde_value::Value as our any type, but this failed to respect some of the special casing required around things like non-finite floats and binary data.

Closes #4

After this PR

==COMMIT_MSG== serde_value::Value has been replaced by a new conjure_object::Any type which correctly respects Conjure's serialization requirements. ==COMMIT_MSG==

+1524 -198

1 comment

40 changed files

sfackler

pr closed time in 10 days

issue closedpalantir/conjure-rust

Using serde-value::Value for Any misses float/bytes special casing

We presumably want deserialization from our Any equivalent to a concrete type to behave like deserialization directly from JSON to that type, but we currently will miss our special case handling of base64 bytes and non-finite floats.

We'll probably need to stop using serde-value and make our own version of the same thing that handles the special cases.

closed time in 10 days

sfackler

push eventpalantir/conjure-rust

Steven Fackler

commit sha 1ff0a681f9b991878ab774a35a902028dccccd17

Make ErrorKind properly non exhaustive

view details

push time in 10 days

issue commentrust-lang/rust

make format! accept const vars as format-strings

Macros run before name resolution, so there's no way for format! to find the contents of the string y.

matthiaskrgr

comment created time in 10 days

issue commentsfackler/rust-postgres

the trait `tokio_postgres::generic_client::GenericClient` cannot be made into an object

You can't use GenericClient as a trait object. You can instead use it as a type parameter:

pub async fn get_user_by_username<T>(client: &T, username: &str) -> Result<Option<Self>, Error>
where
    T: GenericClient,
{
    ...
}
jsandler18

comment created time in 10 days

Pull request review commentsfackler/rust-postgres

Expose async notifications in sync API

 impl Config {         self.config.get_channel_binding()     } -    /// Opens a connection to a PostgreSQL database.-    pub fn connect<T>(&self, tls: T) -> Result<Client, Error>+    /// Like `connect`, but `notify_fn` will be invoked with any asynchronous+    /// notifications or connection errors that arise.+    ///+    /// `notify_fn` is invoked from an asynchronous runtime and therefore must+    /// not block.+    pub fn connect_with<T, F>(&self, tls: T, mut notify_fn: F) -> Result<Client, Error>     where         T: MakeTlsConnect<Socket> + 'static + Send,         T::TlsConnect: Send,         T::Stream: Send,         <T::TlsConnect as TlsConnect<Socket>>::Future: Send,+        F: FnMut(Result<AsyncMessage, Error>) + Send + 'static,

I'd rather it take a AsyncMessage rather than a Result.

benesch

comment created time in 10 days

Pull request review commentsfackler/rust-postgres

Expose async notifications in sync API

 impl Config {         self.config.get_channel_binding()     } -    /// Opens a connection to a PostgreSQL database.-    pub fn connect<T>(&self, tls: T) -> Result<Client, Error>+    /// Like `connect`, but `notify_fn` will be invoked with any asynchronous+    /// notifications or connection errors that arise.+    ///+    /// `notify_fn` is invoked from an asynchronous runtime and therefore must+    /// not block.+    pub fn connect_with<T, F>(&self, tls: T, mut notify_fn: F) -> Result<Client, Error>

Rather than a separate method, I think it would make more sense to store the callback in the config with a setter.

benesch

comment created time in 10 days

push eventsfackler/rust-openssl

Steven Fackler

commit sha 78012267960737944747e87e995d1eaa22c5b4fc

Tweak interface a bit

view details

push time in 10 days

push eventsfackler/rust-openssl

Akos Vandra

commit sha c81810d869f0c815d222524838727272f8459f7f

adds ability access the internal &SslContext of an SslAcceptor and SslConnector

view details

Steven Fackler

commit sha eed35cefb03ae199a571ca081244a0f7fe698be8

Merge pull request #1229 from axos88/master SslAcceptor and SslConnector: Ability to turn into SslContext

view details

push time in 10 days

PR merged sfackler/rust-openssl

SslAcceptor and SslConnector: Ability to turn into SslContext

Addresses #1228

Deref did not seem to be enough because I could not construct an SslContextRef from &SslContext

+17 -1

1 comment

1 changed file

axos88

pr closed time in 10 days

Pull request review commentpalantir/conjure-rust

Add a custom Any type

+// Copyright 2020 Palantir Technologies, Inc.+//+// Licensed under the Apache License, Version 2.0 (the "License");+// you may not use this file except in compliance with the License.+// You may obtain a copy of the License at+//+// http://www.apache.org/licenses/LICENSE-2.0+//+// Unless required by applicable law or agreed to in writing, software+// distributed under the License is distributed on an "AS IS" BASIS,+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+// See the License for the specific language governing permissions and+// limitations under the License.+use crate::any::{Any, Error, Inner};+use ordered_float::NotNan;+use serde::ser::{+    Error as _, Impossible, SerializeMap, SerializeSeq, SerializeStruct, SerializeStructVariant,+    SerializeTuple, SerializeTupleStruct, SerializeTupleVariant,+};+use serde::{Serialize, Serializer};+use std::collections::BTreeMap;+use std::f64;+use std::fmt;++impl Serialize for Any {+    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>+    where+        S: Serializer,+    {+        match &self.0 {+            Inner::Null => serializer.serialize_unit(),+            Inner::Bool(v) => serializer.serialize_bool(*v),+            Inner::Float(v) => serializer.serialize_f64(**v),+            Inner::PositiveInt(v) => serializer.serialize_u64(*v),+            Inner::NegativeInt(v) => serializer.serialize_i64(*v),+            Inner::String(v) => serializer.serialize_str(v),+            Inner::Array(v) => v.serialize(serializer),+            Inner::Object(v) => v.serialize(serializer),+        }+    }+}++pub(crate) struct AnySerializer;++impl Serializer for AnySerializer {+    type Ok = Any;+    type Error = Error;+    type SerializeSeq = ArraySerializer;+    type SerializeTuple = ArraySerializer;+    type SerializeTupleStruct = ArraySerializer;+    type SerializeTupleVariant = TupleVariantSerializer;+    type SerializeMap = ObjectSerializer;+    type SerializeStruct = ObjectSerializer;+    type SerializeStructVariant = StructVariantSerializer;++    #[inline]+    fn serialize_bool(self, v: bool) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::Bool(v)))+    }++    #[inline]+    fn serialize_i8(self, v: i8) -> Result<Self::Ok, Self::Error> {+        self.serialize_i64(v as i64)+    }++    #[inline]+    fn serialize_i16(self, v: i16) -> Result<Self::Ok, Self::Error> {+        self.serialize_i64(v as i64)+    }++    #[inline]+    fn serialize_i32(self, v: i32) -> Result<Self::Ok, Self::Error> {+        self.serialize_i64(v as i64)+    }++    #[inline]+    fn serialize_i64(self, v: i64) -> Result<Self::Ok, Self::Error> {+        if v >= 0 {+            Ok(Any(Inner::PositiveInt(v as u64)))+        } else {+            Ok(Any(Inner::NegativeInt(v)))+        }+    }++    #[inline]+    fn serialize_u8(self, v: u8) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::PositiveInt(v as u64)))+    }++    #[inline]+    fn serialize_u16(self, v: u16) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::PositiveInt(v as u64)))+    }++    #[inline]+    fn serialize_u32(self, v: u32) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::PositiveInt(v as u64)))+    }++    #[inline]+    fn serialize_u64(self, v: u64) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::PositiveInt(v)))+    }++    #[inline]+    fn serialize_f32(self, v: f32) -> Result<Self::Ok, Self::Error> {+        self.serialize_f64(v as f64)+    }++    #[inline]+    fn serialize_f64(self, v: f64) -> Result<Self::Ok, Self::Error> {+        if v.is_nan() {+            Ok(Any(Inner::String("NaN".to_string())))+        } else if v == f64::INFINITY {+            Ok(Any(Inner::String("Infinity".to_string())))+        } else if v == f64::NEG_INFINITY {+            Ok(Any(Inner::String("-Infinity".to_string())))+        } else {+            Ok(Any(Inner::Float(NotNan::new(v).unwrap())))+        }+    }++    #[inline]+    fn serialize_char(self, v: char) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::String(v.to_string())))+    }++    #[inline]+    fn serialize_str(self, v: &str) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::String(v.to_string())))+    }++    #[inline]+    fn serialize_bytes(self, v: &[u8]) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::String(base64::encode(v))))+    }++    #[inline]+    fn serialize_none(self) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::Null))+    }++    fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Self::Ok, Self::Error>+    where+        T: Serialize,+    {+        value.serialize(self)+    }++    #[inline]+    fn serialize_unit(self) -> Result<Self::Ok, Self::Error> {+        Ok(Any(Inner::Null))+    }++    #[inline]+    fn serialize_unit_struct(self, _: &'static str) -> Result<Self::Ok, Self::Error> {+        self.serialize_unit()+    }++    #[inline]+    fn serialize_unit_variant(+        self,+        _: &'static str,+        _: u32,+        variant: &'static str,+    ) -> Result<Self::Ok, Self::Error> {+        self.serialize_str(variant)+    }++    fn serialize_newtype_struct<T: ?Sized>(+        self,+        _: &'static str,+        value: &T,+    ) -> Result<Self::Ok, Self::Error>+    where+        T: Serialize,+    {+        value.serialize(self)+    }++    fn serialize_newtype_variant<T>(+        self,+        _: &'static str,+        _: u32,+        variant: &'static str,+        value: &T,+    ) -> Result<Self::Ok, Self::Error>+    where+        T: ?Sized + Serialize,+    {+        let mut map = BTreeMap::new();+        let value = value.serialize(self)?;+        map.insert(variant.to_string(), value);

This is encoding the default serde_json enum format rather than the conjure enum format.

sfackler

comment created time in 10 days

pull request commentsfackler/streaming-iterator

Bump Rust Version

The rust:latest Docker tag always has the newest release.

gsquire

comment created time in 11 days

push eventpalantir/conjure-rust

Steven Fackler

commit sha 80d1fc33529a2e079a2c4c1a288f67c6e96c8846

Release v0.7.0

view details

push time in 11 days

push eventpalantir/conjure-rust

Steven Fackler

commit sha b6bc654db805e2af2aa8cebabb2a9894d4c4327b

Fix serialization codegen

view details

push time in 11 days

push eventpalantir/conjure-rust

Steven Fackler

commit sha da860f0313726f963b847ef9c3e2238f55908eb9

Fix serialization codegen

view details

push time in 11 days

push eventpalantir/conjure-rust

Steven Fackler

commit sha b848743723d6d6c2f92e731cccf8cdbdcd1de199

Fix method name

view details

push time in 11 days

PR opened palantir/conjure-rust

Reviewers
Add a custom Any type

Before this PR

We previously used serde_value::Value as our any type, but this failed to respect some of the special casing required around things like non-finite floats and binary data.

Closes #4

After this PR

==COMMIT_MSG== serde_value::Value has been replaced by a new conjure_object::Any type which correctly respects Conjure's serialization requirements. ==COMMIT_MSG==

+1474 -139

0 comment

33 changed files

pr created time in 11 days

create barnchpalantir/conjure-rust

branch : any

created branch time in 11 days

issue commentrust-lang/rust

SocketAddr from UnixDatagram recv_from missing the last character (on OS X)

The problem appears to be that Python sets the socklen_t to just the size up to the last byte of the addr not including the null terminator, and that number gets sent to recvfrom on OSX. I guess we should check if the last byte is a null before ignoring it.

zonyitoo

comment created time in 11 days

issue commentrust-lang/rust

SocketAddr from UnixDatagram recv_from missing the last character (on OS X)

I can reproduce this, but weirdly not when sending from Rust code, just Python.

zonyitoo

comment created time in 11 days

issue commentrust-lang/docker-rust

Ubuntu based images

I'm not aware of any official images based off of Ubuntu.

xoac

comment created time in 11 days

push eventsfackler/rust-openssl

Nipunn Koorapati

commit sha 16d93a937254bc0d22f1d5bfcd9b4edabaef646e

Allow bad style on pkey.rs

view details

Steven Fackler

commit sha 2dec15dbaaafeae25f6839cb98b38b900abbb84c

Merge pull request #1232 from rbtying/warn_non_snake Allow bad style on EVP_PKEY_up_ref in pkey.rs

view details

push time in 11 days

PR merged sfackler/rust-openssl

Allow bad style on EVP_PKEY_up_ref in pkey.rs

This follows the pattern used in other files in rust-openssl

+1 -0

1 comment

1 changed file

nipunn1313

pr closed time in 11 days

issue commentrust-lang/rust

SocketAddr from UnixDatagram recv_from missing the last character (on OS X)

Wow, can't believe this made it 3.5 years without being noticed!

zonyitoo

comment created time in 12 days

issue closedsfackler/rust-native-tls

Blocking on timeout

This is how I initialize my socket before consuming it with connector.connect:

        let mut socket = TcpStream::connect(&addr)?;
        socket.set_read_timeout(Some(std::time::Duration::new(4, 0)))?;
        socket.set_write_timeout(Some(std::time::Duration::new(4, 0)))?;
        socket
            .set_nonblocking(true)
            .expect("set_nonblocking call failed");


I expect that this will mean it reads should never block. However if I leave that connection open for too long and then try a read it will block: <details><summary>backtrace</summary>

#0    0x00007f6db798a7be in __libc_recv (flags=0, len=5, buf=0x556449e87b03, fd=7) at ../sysdeps/unix/sysv/linux/recv.c:28                                                                     [7/1904]
#1    0x00007f6db798a7be in __libc_recv (fd=7, buf=0x556449e87b03, len=5, flags=0) at ../sysdeps/unix/sysv/linux/recv.c:23
#2    0x0000556447e5ad6a in std::sys::unix::net::Socket::recv_with_flags () at src/libstd/sys/unix/net.rs:231
#3    0x0000556447e5ad6a in std::sys::unix::net::Socket::read () at src/libstd/sys/unix/net.rs:240
#4    0x0000556447e5ad6a in std::sys_common::net::TcpStream::read () at src/libstd/sys_common/net.rs:256
#5    0x0000556447e5ad6a in <std::net::tcp::TcpStream as std::io::Read>::read () at src/libstd/net/tcp.rs:570
#6    0x0000556447b21883 in openssl::ssl::bio::bread::{{closure}} ()
                         at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.28/src/ssl/bio.rs:113
#7    0x00005564478633f4 in core::ops::function::FnOnce::call_once ()
                         at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/ops/function.rs:227
#8    0x0000556447b67d85 in <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once (self=std::panic::AssertUnwindSafe<closure-0> (openssl::ssl::bio::bread::closure-0 (0x7ffc4
51c2a70, 0x7ffc451c2a78)), _args=())
                         at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panic.rs:315
#9    0x0000556447b6db79 in std::panicking::try::do_call (data=0x7ffc451c29d0 "p*\034E\374\177\000")
                         at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panicking.rs:292
#10   0x0000556447e6da8a in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:80
#11   0x0000556447b6d536 in std::panicking::try (f=std::panic::AssertUnwindSafe<closure-0> (openssl::ssl::bio::bread::closure-0 (0x7ffc451c2a70, 0x7ffc451c2a78)))
                         at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panicking.rs:271
#12   0x0000556447b67eb5 in std::panic::catch_unwind (f=std::panic::AssertUnwindSafe<closure-0> (openssl::ssl::bio::bread::closure-0 (0x7ffc451c2a70, 0x7ffc451c2a78)))
                         at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panic.rs:394
#13   0x0000556447b214d3 in openssl::ssl::bio::bread (bio=0x556449f77dd0, buf=0x556449e87b03 "\267m\177", len=5)
                         at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.28/src/ssl/bio.rs:113
#14   0x00007f6db7ab2d8a in No symbol matches 0x00007f6db7ab2d8a. () at /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
#15   0x00007f6db7ab1c33 in No symbol matches 0x00007f6db7ab1c33. () at /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
#16   0x00007f6db7ab21e3 in BIO_read + 0x23 () at /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
#17   0x00007f6db7d0162f in No symbol matches 0x00007f6db7d0162f. () at /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#18   0x00007f6db7d054ba in No symbol matches 0x00007f6db7d054ba. () at /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#19   0x00007f6db7d02e20 in No symbol matches 0x00007f6db7d02e20. () at /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#20   0x00007f6db7d0a265 in No symbol matches 0x00007f6db7d0a265. () at /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#21   0x00007f6db7d14cfa in No symbol matches 0x00007f6db7d14cfa. () at /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#22   0x00007f6db7d14e03 in SSL_read + 0x23 () at /usr/lib/x86_64-linux-gnu/libssl.so.1.1
#23   0x0000556447d5d999 in openssl::ssl::SslRef::read (self=0x556449e92450, buf=&mut [u8](len: 1024) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...})
                         at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.28/src/ssl/mod.rs:2375
#24   0x00005564479f6fc9 in openssl::ssl::SslStream<S>::ssl_read (self=0x7ffc451c4148, buf=&mut [u8](len: 1024) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...})
                         at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.28/src/ssl/mod.rs:3414
#25   0x00005564479f5e7d in <openssl::ssl::SslStream<S> as std::io::Read>::read (self=0x7ffc451c4148, buf=&mut [u8](len: 1024) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...})
                         at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-0.10.28/src/ssl/mod.rs:3556
#26   0x0000556447b73650 in <native_tls::imp::TlsStream<S> as std::io::Read>::read (self=0x7ffc451c4148, buf=&mut [u8](len: 1024) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...})
                         at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/native-tls-0.2.3/src/imp/openssl.rs:396
#27   0x0000556447b1e310 in <native_tls::TlsStream<S> as std::io::Read>::read (self=0x7ffc451c4148, buf=&mut [u8](len: 1024) = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0--Type <RET> for more, q to quit, c to c
ontinue without paging--
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...})

</details>

closed time in 12 days

epilys

push eventsfackler/rust-openssl

Nipunn Koorapati

commit sha 4898f60e5234bdcab36b1d8924ca51cb6a0f9c7e

Attach cfg[allow_deprecated] to methods w/ uninitialized functionality Additionally - update usage of ONCE_INIT

view details

Steven Fackler

commit sha ec46d27f838eab592fdb0e1092fd2327756f8762

Merge pull request #1231 from rbtying/allow_deprecated Attach cfg[allow_deprecated] to methods w/ uninitialized functionality

view details

push time in 12 days

PR merged sfackler/rust-openssl

Attach cfg[allow_deprecated] to methods w/ uninitialized functionality

Additionally - update usage of ONCE_INIT

+22 -5

4 comments

4 changed files

nipunn1313

pr closed time in 12 days

pull request commentsfackler/rust-openssl

Attach cfg[allow_deprecated] to methods w/ uninitialized functionality

Thanks! Yeah, the windows CI tends to be a bit flaky historically :(

nipunn1313

comment created time in 12 days

pull request commentsfackler/rust-openssl

Update to mem::MaybeUninit and Once::new()

Sticking #[allow(deprecated)] on the offending functions seems reasonable.

nipunn1313

comment created time in 13 days

issue commentsfackler/rust-postgres

Error kind is private

I'd just use query_opt instead and avoid having to deal with figuring out which kind of error it is in the first place.

m-lima

comment created time in 13 days

more