These are chat archives for rust-lang/rust

8th
Dec 2017
Sean
@seanr707
Dec 08 2017 04:12
getting a long list of errors trying to compile for windows-gnu
--- stderr
fatal: Not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
configure: WARNING: using cross tools not prefixed with host triplet
configure: WARNING: configure found only the libz lib, not the header file!
configure: WARNING: the previous check could not be made default was used
configure: WARNING: skipped the ca-cert path detection when cross-compiling
configure: WARNING: Cannot find libraries for IDN support: IDN disabled
../lib/.libs/libcurl.a: error adding symbols: Archive has no index; run ranlib to add one
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:779: curl.exe] Error 1
make[1]: *** [Makefile:661: all] Error 2
make: *** [Makefile:897: all-recursive] Error 1
thread 'main' panicked at '
command did not execute successfully, got: exit code: 2
Currently trying to run with AR=x86_64-w64-mingw32-ar CC=x86_64-w64-mingw32-gcc PKG_CONFIG_ALLOW_CROSS=1 cargo build --release --target=x86_64-pc-windows-gnu
Dirk Van Haerenborgh
@vhdirk
Dec 08 2017 10:34
hi
I want to build a server that will keep the connection to its clients open for all iternity
Tom Cumming
@tomcumming
Dec 08 2017 10:35
what kind of connection?
Dirk Van Haerenborgh
@vhdirk
Dec 08 2017 10:35
aha, good question
a tls/tcp connection
Tom Cumming
@tomcumming
Dec 08 2017 10:36
good luck
Dirk Van Haerenborgh
@vhdirk
Dec 08 2017 10:36
now, I've been tinkering with the futures create, and so far I've been able to create a server that will asynchronously accept connections and do some simple echoing (like many of the examples)
Ideally, I'd like to write the whole client-connection state machine as a class (or whatever they call that in rust), and spawn it off as a fiber that will only stop when the connection closes
Seems to me that the futures's loop_fn would be a good start, but the example given there always creates a new copy of the struct (https://docs.rs/futures/*/futures/future/fn.loop_fn.html)
Tom Cumming
@tomcumming
Dec 08 2017 10:43
the Loop enum ?
notice how it moves client
so client instead could be some huge boxed thing
and you are not allocating every loop
Dirk Van Haerenborgh
@vhdirk
Dec 08 2017 10:47
so then all my 'methods' would take a Box<Client> instead of Client?
seems elegant enough. I've never worked with box types. Would there be no problem with the thing going out of scope/creating copies?
I've no intention to create copies. It's one of the reasons I'm looking at Rust
Tom Cumming
@tomcumming
Dec 08 2017 10:51
its not a copy, its creating a new Loop value
this will be as big as the types you put in it
(+ the tag)
Box will be word size i think
so dont worry about pushing 2 words onto the stack
Dirk Van Haerenborgh
@vhdirk
Dec 08 2017 10:54
hmm, I'm going to play with this a bit. Thank you
msiglreith
@msiglreith
Dec 08 2017 15:43
Someone knows how to cast fn types like here? (https://play.rust-lang.org/?gist=d7efe11de82a64c1e034c7d840098284&version=stable)
basically fn(_) into fn() but I end up with segfaults everytime or type-errors ):
Tom Cumming
@tomcumming
Dec 08 2017 15:50
it expects to pop something off the stack?
(the function)
msiglreith
@msiglreith
Dec 08 2017 16:04
Dirk Van Haerenborgh
@vhdirk
Dec 08 2017 16:42
hi
would anyone know what the type would be of the 'ping_til_done' variable in http://alexcrichton.com/futures-rs/futures/future/fn.loop_fn.html
I can read the docs, somewhat, but I'm not sure how you would actually write that
Tom Cumming
@tomcumming
Dec 08 2017 16:53
@vhdirk you can add an annotation like : () and the compiler will tell you
Dirk Van Haerenborgh
@vhdirk
Dec 08 2017 17:04
I did that, but does not tell me anything useful
It says the return type is of type LoopFn, but not what it should be specialized upon
Michal 'vorner' Vaner
@vorner
Dec 08 2017 19:07
Hello. If I depend on a package and I don't need all its default features, I can specify default-features = false in Cargo.toml. But this doesn't seem to work if I have an indirect dependency. The indirect dependency simply depends on it and it has no configuration knob. Can I tell cargo not to bring the optional features?
Denis Lisov
@tanriol
Dec 08 2017 19:24
@vhdirk As this type includes a closure, it most likely cannot be written down at all.
@vorner If you really need that, look at the manifest patch section.
Roman Proskuryakov
@kpp
Dec 08 2017 22:44
How do I build libstd fastly? It takes a huge amount of time even if I edit 1 line