These are chat archives for rust-lang/rust

30th
Nov 2016
Ravi Teja Gudapati
@tejainece
Nov 30 2016 16:31
does anybody use rust on windows?
does it use cygwin or can it produce real windows libraries and binaries?
i would like to build native windows library
Ingvar Stepanyan
@RReverser
Nov 30 2016 16:37
@tejainece either
install either Rust with MSVC ABI or Rust with GNU ABI depending on what you want to get
MSVC sounds like the one you want (I'm using it by default too)
Ravi Teja Gudapati
@tejainece
Nov 30 2016 16:40
cool. thanks :)
Peter Atashian
@retep998
Nov 30 2016 16:50
@tejainece Rust actually doesn't support cygwin at all
@tejainece the GNU version of Rust on Windows is for use with MinGW, not cygwin or msys
But yeah, if you use the msvc version, you get completely native windows stuff
Ingvar Stepanyan
@RReverser
Nov 30 2016 16:52
@retep998 it doesn't matter which one you use, it works with msys just fine
that's what ABI is for after all :)
Peter Atashian
@retep998
Nov 30 2016 16:52
@RReverser It'll run inside an msys environment sure, but it won't work if you compile and link against an msys toolchain
Ingvar Stepanyan
@RReverser
Nov 30 2016 16:52
didn't try with cygwin specifically, but I suppose it will as well
what do you mean? statically link with its libc?
Peter Atashian
@retep998
Nov 30 2016 16:53
the significantly different libc is one of the issues
basically Rust just doesn't support compiling and linking against an msys or cygwin toolchain. You might be able to get it to work, it's just unsupported territory
Ingvar Stepanyan
@RReverser
Nov 30 2016 16:55
dunno, never needed static linking inside of mingw/msys/cygwin, so maybe you're right :) generally using it only to ensure that libs compile and work as expected (all inside of its environment)
Ravi Teja Gudapati
@tejainece
Nov 30 2016 17:00
thanks guys
Ravi Teja Gudapati
@tejainece
Nov 30 2016 19:59
i am new to rust
what is this &'static str
David McGillicuddy
@djmcgill
Nov 30 2016 20:05
It's a reference (&) to a string (str) that exists for the duration of the whole program 'static
Ravi Teja Gudapati
@tejainece
Nov 30 2016 20:05
thanks
what generally is '
Tyred
@tyred
Nov 30 2016 20:06
‘static or sometimes ‘a is a specifier for lifetime
Ravi Teja Gudapati
@tejainece
Nov 30 2016 20:06
i think i saw it some where without a following static
yeah i saw 'a
David McGillicuddy
@djmcgill
Nov 30 2016 20:06
It's too long to explain just in here I'm afraid, look at https://doc.rust-lang.org/book/lifetimes.html
Tyred
@tyred
Nov 30 2016 20:06
You will see ‘a or ‘b, etc in functions
Ravi Teja Gudapati
@tejainece
Nov 30 2016 20:07
was totally confusing
David McGillicuddy
@djmcgill
Nov 30 2016 20:07
'a is a lifetime variable, whereas 'static is special value
Tyred
@tyred
Nov 30 2016 20:08
Exactly
@tejainece But definitely give the lifetimes part a read because being new to rust you’ll probably run into lifetime errors (I did :D)
Also I’ll add this a good video to watch
https://air.mozilla.org/guaranteeing-memory-safety-in-rust/
mchapala
@mchapala
Nov 30 2016 20:40
hey.
I am trying to make use of crate flate2 for decoding zipped response from server. I can see in the flate2 documentation and in the flate2 code that flate2::read:: GzDecoder is available. But I am getting a compilation error. Any idea what I might be doing wrong
use flate2::read:: GzDecoder;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Did you mean `self::flate2::read`?
Sergey Noskov
@Albibek
Nov 30 2016 20:55
looks like an unintended space, should be use flate2::read::GzDecoder;
mchapala
@mchapala
Nov 30 2016 21:00
The space was a typo mistake. I have it as
use flate2::read::GzDecoder;
Sergey Noskov
@Albibek
Nov 30 2016 21:08
it gives you the same error?
mchapala
@mchapala
Nov 30 2016 21:15

yeah the use statement gives error but If i use it directly I don’t get error. No error

let mut d = flate2::read::GzDecoder::new(buffer.as_slice()).unwrap();

but using it with use statement gives compile error

mchapala
@mchapala
Nov 30 2016 21:32
I am pretty sure I am doing something wrong but I have checked in my code
https://github.com/mchapala/RustAlarm/blob/master/src/http/mod.rs#L9
Emil Gardström
@Emilgardis
Nov 30 2016 21:46
@mchapala If the Cargo.toml in that repo is up to date then you are missing an extern crate flate2 inside it
and you don't need the extern crate * inside http.rs
mchapala
@mchapala
Nov 30 2016 21:50
ah. Thanks @Emilgardis. So I can define all my crates in main.rs and remove the imports from all other modules
Emil Gardström
@Emilgardis
Nov 30 2016 21:51
As long as it is all in the same lib/bin yes :)
mchapala
@mchapala
Nov 30 2016 21:53
Thanks I will read up on using the extern
Emil Gardström
@Emilgardis
Nov 30 2016 21:58
no problem
David McGillicuddy
@djmcgill
Nov 30 2016 22:30
Wait, you can extern crate *? What does that do, pull in everything from your toml?
How does it interact with wanting to allow macros for individual crates?