These are chat archives for rust-lang/rust

16th
May 2019
David O'Connor
@David-OConnor
May 16 00:37
Follow-up question re serializing. Found this example in the Serde docs, which hints at the correct one: https://serde.rs/enum-number.html
Which begs the question: Where can I find documentation on the = syntax in enum definitions?
Don't see it in the Rust book
David O'Connor
@David-OConnor
May 16 00:56
@RReverser : You solved it, via serde_repr
David O'Connor
@David-OConnor
May 16 08:39
@siddhant3s Thanks!
jbg
@jbg
May 16 15:34
i'm doing a rust build in a Dockerfile and i have this weird issue where cargo build hangs randomly while downloading crates. and not always on the same crate. has anyone seen/solved this before? i tried on several different machines with the same outcome. using the rustlang/rust:nightly docker image.
the same cargo build command works fine outside of Docker.
jbg
@jbg
May 16 16:28
solved - don't try to run cargo build in /, it really doesn't like it :laughing:
soc
@soc
May 16 19:55
does someone have opinions on the Path/PathBuf usage here:
comments appreciated!
largely accepting &Path as arguments and returning PathBuf as a result
Denis Lisov
@tanriol
May 16 21:06
Makes sense if you want to support the possibility of the dirs changing at runtime.
soc
@soc
May 16 21:21
@tanriol in what sense? how would it look if I didn't support that?
jeez, that xdg-user-dirs stuff is a complete nightmare. whenever I think I arrived at the bottom of the pit of insanity reading the spec, I look at the implementation and despair.
their own https://cgit.freedesktop.org/xdg/xdg-user-dirs/tree/user-dirs.defaults has different rules than user's user-dirs.dirs
soc
@soc
May 16 21:27
and there is no real way to disable a user dir, except pointing to a non-existing dir, contrary to their own documentation
having a missing or empty user dir var returns $HOME ... lots of fun if you thought you had disabled PUBLICSHARE, and now it points to your home dir
soc
@soc
May 16 21:39
oh, and you can disable the whole user dir thing globally ... but the lookup function never checks it
Denis Lisov
@tanriol
May 16 21:54
If you did not support that, there would be other interesting options... for example, permanently cache the Strings by leaking them and return &'static str
Aleksandrov Vladimir
@invis87
May 16 22:18
is it possible to generate rust structures with diesel or diesel_ext from db schema?
Siddhant Sanyam
@siddhant3s
May 16 22:18
I think you should be able to do with Rust's macros
Aleksandrov Vladimir
@invis87
May 16 22:19
I create file schema.rs with infer_schema!("dotenv:DATABASE_URL"); and run diesel_ext, but output is empty :(
Denis Lisov
@tanriol
May 16 22:20
May be a better idea to do that manually with diesel_cli
Aleksandrov Vladimir
@invis87
May 16 22:20
how)?
looks like diesel print-schema
but it will ignore meta information like index, primary keys
is it possible to have such info in structures?