These are chat archives for rust-lang/rust

13th
Feb 2019
Martijn Bakker
@Gladdy
Feb 13 01:09
I had found the specialisation feature later on, but indeed ran into quite a lot of issues as it wouldn't support mismatching trait bounds on the different implementations.
I have been trying to work around it by explicitly extracting the level at which the Handler is implemented and then passing that straight through, bypassing the more ideal specialisation. Still running into some issues because my outer struct with a few levels of inner ones are all in a single object (no box/rc internally), whereas only the outermost struct is externally managed by a Rc<RefCell<...>>. So the (as of yet not worked out trick how to do so) is to have an object that takes it's lifetime as a Rc from the outermost struct while pointing at one of the inner structs (which then cannot be Rc because it is merely pointing at a location inside an already existing struct).
David O'Connor
@David-OConnor
Feb 13 04:15
@omni-viral - nailed it!
octave99
@octave99
Feb 13 07:04
@RReverser Well, it does run as daemon but I am specifically running it in foreground. To be precise, I am firing up gpsd process on Linux and have placed -N under Command args to run it in foreground. But its keep running even after the parent process has exited.
Tritone
@tritone11
Feb 13 13:22
Hi, when compiling a static rust library with crate-type = ["staticlib", "cdylib"], my .a file is very large, any optimization suggestion?
Martijn Bakker
@Gladdy
Feb 13 13:52
build in release mode or strip debug symbols?
Tritone
@tritone11
Feb 13 14:07
@Gladdy it's already in release mode, what are debug symbols? thanks!
Martijn Bakker
@Gladdy
Feb 13 14:08
usually there is quite of information linked into the binary that gdb can read to work out what the function names/parameter types and locations are
but I believe by default rust in release mode doesn't include those anyway
Michal 'vorner' Vaner
@vorner
Feb 13 14:09
It includes some, even if you explicitly ask it to include none. But you can strip it.
Also, I believe the lto doesn't run until the final linking. So while the .a might be big, the final product might be smaller.
(.a is basically just an archive with bunch of .o files in there)
Tritone
@tritone11
Feb 13 14:43
awesome, I reduced the size by a third stripping the debug symbols with binutils
thanks!
Michal 'vorner' Vaner
@vorner
Feb 13 15:33
However, if you want to distribute the .a, you might want to keep the debug symbols. And if it is an intermediate product (you build some binary out of it eventually), then you don't really have to care about this size much and you should prefer stripping/LTOing the end binary.
Ryan Levick
@rylev
Feb 13 16:03
Is there a way to iterate over a &Range<usize>? I've had to resort to cloning...
Zakarum
@omni-viral
Feb 13 16:04
No you can't because it uses (mutates) start field to iterate toward end field
But don't worry. Cloning Range<usize> is cheap as it is just two usizes
It should be actually Copy
But was decided to not implement that trait for weird reason
Ryan Levick
@rylev
Feb 13 16:07
Ah that makes sense... Yea I wasn't worried about the cost. Just like to eliminate clones unless I fully know why I"m doing them
Zakarum
@omni-viral
Feb 13 16:09
I don't like how Range forces all types I uses it in to not implement Copy which transitively goes up to literally half of possibly Copy able types