These are chat archives for rust-lang/rust

2nd
Nov 2018
trsh
@trsh
Nov 02 2018 12:49
Anybody has exp auto-running rust project (for ex web server) on unix system?
Denis Lisov
@tanriol
Nov 02 2018 13:55
What do you mean by auto-running?
trsh
@trsh
Nov 02 2018 14:12
@tanriol when the OS starts, web app starts
Standard thing.. for ngix or apache it's by default
Denis Lisov
@tanriol
Nov 02 2018 14:13
For modern Linux distributions you should write a systemd unit file that the local admin can enable after installing your server.
For older and/or non-Linux systems the answer may vary depending on the OS/distribution/version.
trsh
@trsh
Nov 02 2018 14:15
I think I will go for systemd. It second time suggested
This tut is for node, but should be useful anyway https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/
trsh
@trsh
Nov 02 2018 14:22
Thanks @tanriol
Bruno Garcia
@bruno-garcia
Nov 02 2018 14:39
image.png
Anyone knows why this fails? the trait is in scope and yet I can’t use it
Denis Lisov
@tanriol
Nov 02 2018 14:40
Did you mean Cursor<Vec<u8>> or Cursor<&[u8]>?
Bruno Garcia
@bruno-garcia
Nov 02 2018 14:41
@tanriol thanks! :)
laurent bernabé
@loloof64
Nov 02 2018 14:51
Hi everyone ! Is it the right place to get advices about GUI developement ?
Because I can't get all of what I want with Gtk-Rs
Finally: found the Gtk-Rs room
Sylwester Rąpała
@xoac
Nov 02 2018 20:46

I have in map function

                    let se = err.into_inner().se;
                    SendError(se)

and rust give me error:

    |
268 |                     SendError(se)
    |                     ^^^^^^^^^ constructor is not visible here due to private fields

SendError is here https://docs.rs/futures/0.1.21/futures/sync/mpsc/struct.SendError.html

the first err is also SendError. I just want map_err to return less information.
Denis Lisov
@tanriol
Nov 02 2018 20:51
Well, it's not public. Use a custom error.
Sylwester Rąpała
@xoac
Nov 02 2018 20:53
It's public I can use it. But a T in SendError<T>(T) is private and there is no constructor so I can't create instance of this :(
Denis Lisov
@tanriol
Nov 02 2018 20:54
Exactly.
Oak Thielbar
@oakhorn_gitlab
Nov 02 2018 22:01
Hayo! Kind of a silly question, but does anyone know why Result<T, E> doesn't have a constraint on E even though (as far as I can tell) it's supposed to implement Error?
Denis Lisov
@tanriol
Nov 02 2018 22:03
Not in all cases... there are uses of Result that do not use Err for an error.
Oak Thielbar
@oakhorn_gitlab
Nov 02 2018 22:04
Is there an example of that anywhere in std?
Denis Lisov
@tanriol
Nov 02 2018 22:06
For example, there's [T]::binary_search. This does not look idiomatic today, so I wouldn't be surprised if this kind of usage were phased out, but it is stable in the standard library at the moment.
Oak Thielbar
@oakhorn_gitlab
Nov 02 2018 22:07
Awesome! That's exactly what I was wondering about. Thank you. <3
Denis Lisov
@tanriol
Nov 02 2018 22:07
But it's too late to add that bound as external crates may already depend on this.
Oak Thielbar
@oakhorn_gitlab
Nov 02 2018 22:09
Right, since it's been in stable for so long, it could cause a lot of breaking changes to add that in at this point. Makes perfect sense.