These are chat archives for rust-lang/rust

30th
Jul 2018
Sam Johnson
@sam0x17
Jul 30 2018 05:43
hello all -- I'm learning rust so I can write a cross-platform nintendo joycon => keyboard/mouse adapter for my disabled husband
just thought I'd say hi -- I'm here instead of using crystal because rust windows support is actually done and there is a decent bluetooth library (seemingly)
Sylwester Rąpała
@xoac
Jul 30 2018 13:16
How to say that T should implement T * f32 with output T? T: Mul<Output = T> dosen't work?
Zakarum
@omni-viral
Jul 30 2018 13:17
T: Mul<f32, Output = T>
Mul have type parameter with default to Self.
That type parameter specifies by what type implementation can be multiplied
trsh
@trsh
Jul 30 2018 14:57
@tanriol yahuu.. fn aproach worked
10k lines, but it's fast
How can Ignore bad style for whole file?
trsh
@trsh
Jul 30 2018 15:02
When i put in top of func

[allow(bad_style)] fn ...

It doesnt work, why?
Dmitriy
@dpogretskiy
Jul 30 2018 15:02
#!
razuit
@razuit
Jul 30 2018 15:02
anyone using Rust with Visul Studio Code, willing to share his/her tasks.json ?
Dmitriy
@dpogretskiy
Jul 30 2018 15:02
@razuit i use defaults :laughing:
Zakarum
@omni-viral
Jul 30 2018 15:03
Same
Dmitriy
@dpogretskiy
Jul 30 2018 15:03
run/build, that's it
trsh
@trsh
Jul 30 2018 15:03
@dpogretskiy what?
Dmitriy
@dpogretskiy
Jul 30 2018 15:03
anything more complicated in console
@trsh use #![allow(bad_style)]
#! means global
# is for single expression/function
razuit
@razuit
Jul 30 2018 15:04
not sure how to configure VSCode to run the default build task
Dmitriy
@dpogretskiy
Jul 30 2018 15:04
i always existed for me, just task build
trsh
@trsh
Jul 30 2018 15:05
@dpogretskiy and if I want to allow only what inside a function?
Lyle Mantooth
@IslandUsurper
Jul 30 2018 15:05
@trsh, @dpogretskiy , not exactly. #[] is for the next item, #![] is for the item it's in.
razuit
@razuit
Jul 30 2018 15:05
I have F7 configured in “Keyboard Shortcuts” as keybinding for “Run Build Task”, but not sure how to make it run the default build task, without prompting me to pick between “Rust: cargo build” and “Rust: cargo check"
trsh
@trsh
Jul 30 2018 15:05
@IslandUsurper and if I want to allow only what inside a function?
Lyle Mantooth
@IslandUsurper
Jul 30 2018 15:06
Use #[] right before the fn.
trsh
@trsh
Jul 30 2018 15:06
@IslandUsurper doesnt work
Lyle Mantooth
@IslandUsurper
Jul 30 2018 15:07
@trsh, show me?
There
@IslandUsurper
Dmitriy
@dpogretskiy
Jul 30 2018 15:08
@razuit what i do is Ctrl+P -> task build
trsh
@trsh
Jul 30 2018 15:08
Oh no
It was unsuded var
So it's my macro problem
ghh
Lyle Mantooth
@IslandUsurper
Jul 30 2018 15:09
Ah, yeah.
razuit
@razuit
Jul 30 2018 15:10
@dpogretskiy what should Ctrl+P do?
Dmitriy
@dpogretskiy
Jul 30 2018 15:11
@razuit it's super duper command line prompt, where you can search file names || use > to look for actions, or use taskto run tasks
probably a lot more, but that i don't really do :)
razuit
@razuit
Jul 30 2018 15:12
@dpogretskiy got it, I was hoping to do it with one key
trsh
@trsh
Jul 30 2018 15:12
Turns out it's per scope
If I have a loop inside a fn
like for xx in ddd
I have to add #[allow(bad_style)] on top of the loop
razuit
@razuit
Jul 30 2018 15:17
@dpogretskiy managed to figure it out, so just wanted to contribute it back here. Solved it by editing tasks.json and adding the isDefault: true, like this:
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cargo",
            "label": "cargo build",
            "command": "cargo",
            "args": [
                "build"
            ],
            "problemMatcher": [
                "$rustc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
Ingvar Stepanyan
@RReverser
Jul 30 2018 15:19
@razuit FWIW VSCode can add it for you if you choose "configure default build task" in Command Palette
Same for tests
razuit
@razuit
Jul 30 2018 15:20
@RReverser awesome! great tip! thanks!
I am thinking of porting an HTTP client app (essentially it is talking to a server via a REST API and long polling) from C++ to Rust. Anyone here worked on such thing? I looked into hyper and also found out about reqwest. Any recommendations/experience or war stories?
trsh
@trsh
Jul 30 2018 18:13
A bit offtopic. If Want to make some code proprietary to me, do I need to include the License in every source File? Or I can only include license.txt in Root?
Ingvar Stepanyan
@RReverser
Jul 30 2018 18:14
By default if you don't include any license, all rights already belong to you
So I think you can add exact LICENSE in the root and it automatically covers every file unless otherwise stated
trsh
@trsh
Jul 30 2018 18:32
Ok
Ichoran
@Ichoran
Jul 30 2018 22:17
Am I right that there is no convenient way to get ISO-8601 durations into/out of serde? It serializes time::Duration as a standard derived struct, and it doesn't like chrono::Duration even with chrono's serde feature enabled.