These are chat archives for rust-lang/rust

17th
Sep 2018
Kelly Thomas Kline
@kellytk
Sep 17 2018 01:28
https://aturon.github.io/apr/async-in-rust/chapter.html is a good reference in development
Sam Johnson
@sam0x17
Sep 17 2018 02:12
what is the actual type of this kind of string literal (as in if I want to make a function that takes one of these)? b"some string"
Sam Johnson
@sam0x17
Sep 17 2018 03:59
like let str = b"some string" what is the type of str???
answered my own question, it is in fact a &[u8]
Zakarum
@omni-viral
Sep 17 2018 07:29
You need json implementation that uses LinkedHashMap to store object data
trsh
@trsh
Sep 17 2018 07:33
@omni-viral any examples, links, suggestions?
Denis Lisov
@tanriol
Sep 17 2018 07:34
Do you need to preserve it for one specific object or for every one in this JSON?
trsh
@trsh
Sep 17 2018 07:41
@tanriol all
trsh
@trsh
Sep 17 2018 08:03
Interesting topic serde-rs/serde#269
trsh
@trsh
Sep 17 2018 08:18
Serde seems to use IndexMap now, that also preserves order
But why then?
Denis Lisov
@tanriol
Sep 17 2018 10:05
You need to depend on serde_json[preserve_order]
trsh
@trsh
Sep 17 2018 10:09
@tanriol how is that?
Denis Lisov
@tanriol
Sep 17 2018 10:17
On serde-json with features = ["preserve_order"]
David Vo
@auscompgeek
Sep 17 2018 10:47
Did you put it in brackets?
Sylwester Rąpała
@xoac
Sep 17 2018 15:33
Hi,
I am looking for solution of backup my RAM data. This data are really small so I would need format that will allow me append file and alow restore data if end of file is not write propertlly.
what is more I need to store 2 types of data the one I check as already sent and second to_send
Lyle Mantooth
@IslandUsurper
Sep 17 2018 16:34
I don't think I completely understand your requirements, @xoac. Do you mean you want to be able to read data from the beginning of the file, even if it's not properly formatted towards the end? Which means you'd only get some of your data back, I think.
Lyle Mantooth
@IslandUsurper
Sep 17 2018 16:40
For two types of data, use two files, or if they must be together, you need a descriptive format to let you know which chunk is already_sent and which is to_send.
Genysys
@Genysys
Sep 17 2018 17:04

Hi all,

I am trying to install rust on azure via run command on a RHEL 7.5 VM. I am not allowed to ssh into the machine for security reasons. I have managed to install to and can seen the binaries in the ~/.cargon/bin folder. But when my script calls cargo, I get a command not found. Would appreciate any guidance on this.

Hans W. Uhlig
@huhlig
Sep 17 2018 17:05
@Genysys can you alter your path at all?
if not you can run things like this
Genysys
@Genysys
Sep 17 2018 17:05
I am very new to RHEL and not sure how to do it
Hans W. Uhlig
@huhlig
Sep 17 2018 17:05
It's not really a RHEL thing, it's an azure thing
you can also run like this
EXPORT=$PATH:~/.cargo/bin cargo build
It's annoying as hell but it should work
Genysys
@Genysys
Sep 17 2018 17:06
Ill take it!!
so how would this transalte
cargo build --release --features final
Hans W. Uhlig
@huhlig
Sep 17 2018 17:08
EXPORT=$PATH:~/.cargo/bin cargo build --release --features final
Genysys
@Genysys
Sep 17 2018 17:10
I am using running commands last time I tried used variables in the script it appeared to strip them out
Sylwester Rąpała
@xoac
Sep 17 2018 17:10
@IslandUsurper I work on emebeded device that can be power off at any time. So data can be "destroyed" at end of file. I want to be able to read data from that file and lost just end of file.
I am curious about witch format I should use to save that files?
Genysys
@Genysys
Sep 17 2018 17:11
@huhlig same thing:
/var/lib/waagent/run-command/download/66/script.sh: line 24: cargo: command not found
Lyle Mantooth
@IslandUsurper
Sep 17 2018 17:11
@xoac, I'd probably go with "streaming" YAML.
Each "document" in YAML starts with --- and (optionally, I think) ends with .... Especially if you put the ending marker, you can know if you have a complete record.
@xoac, YAML also lets you make new types, which could be useful for your case, if your two types of data don't have different shapes.
Zakarum
@omni-viral
Sep 17 2018 17:20
Is it possible to find out if thread currently panicking with #![no_std]?
Denis Lisov
@tanriol
Sep 17 2018 17:31
@omni-viral Your code is running :-) AFAIR, there's no unwind support in no_std, is there?
Sylwester Rąpała
@xoac
Sep 17 2018 17:31
@IslandUsurper I wnated to use more compact serializer. I thought about Bincode
Hans W. Uhlig
@huhlig
Sep 17 2018 17:46
@Genysys was cargo properly installed in ~/.cargo/bin?
if you do ls -alF in ~/.cargo/bin does everything show up?
Genysys
@Genysys
Sep 17 2018 17:47
yes
ive seen all the binaries with -aLF
do in need it in my bash_rc instead?
Thanks alot for your help in betweeen
Hans W. Uhlig
@huhlig
Sep 17 2018 17:48
oh! if your bash_rc is editable, then you can put the export in there
export PATH=$PATH:~/.cargo/bin
I also realized... I gave you the wrong command line
PATH=$PATH:~/.cargo/bin cargo build --release --features final
Zakarum
@omni-viral
Sep 17 2018 17:49
@tanriol Drop gets called during unwind. But I need to check if it is called during unwinging or nomal control flow
Genysys
@Genysys
Sep 17 2018 17:53
@huhlig i just run that as a run command will it update my bashrc?
Hans W. Uhlig
@huhlig
Sep 17 2018 17:53
no
that's the one off I screwed up earlier
add the following to bash rc
export PATH=$PATH:~/.cargo/bin
Genysys
@Genysys
Sep 17 2018 17:54
can you please give me a cat or echo that works with it?
thanks alot!
ive tried with cat but cant seem to do it
I cant ssh into the machine so cant edit with nano
Hans W. Uhlig
@huhlig
Sep 17 2018 17:56
echo 'export PATH=$PATH:~/.cargo/bin' >> ~/.bashrc
hopefully your run command obeys .bashrc
Denis Lisov
@tanriol
Sep 17 2018 18:14
@omni-viral Does your no_std environment actually support unwinding? It may just force you to abort on panic...
Zakarum
@omni-viral
Sep 17 2018 20:27
@tanriol It is tiny no_std crate. Run actually in std environment
Maybe I need to make std feature for the crate and just use std::thread::paniking when feature is enabled