These are chat archives for rust-lang/rust

3rd
Oct 2018
Farzeen
@happycoder97
Oct 03 2018 02:46
Hi all, I developed the entire backend of a website for our college in Rust with Rocket framework. Turns out Hostgator, our hosting provider doesn't officially support Rust webservers.
Does anyone know anyway to get the Rust server working on a shared host like hostgator?
JurassicRobot
@JurassicRobot
Oct 03 2018 09:50
@happycoder97 I don't know, but I doubt it. In case it's of interest, my org is running ActixWeb in production on Heroku - it works like a dream. There's an unofficial Rust buildpack that makes it pretty much plug and play. Alternative would be a VPS I guess, but Heroku is so easy and you don't need to worry about server config and management.
H M
@HM64259860_twitter
Oct 03 2018 11:36
Is it possible to have file scoped variables in rust, like in c ?
cubetastic
@cubetastic33
Oct 03 2018 12:15
@HM64259860_twitter I think static and const are file scoped
H M
@HM64259860_twitter
Oct 03 2018 12:16
looks like it, thx
Michal 'vorner' Vaner
@vorner
Oct 03 2018 13:16
More correctly, they are module-scope, but that is usually the same thing.
samoylovfp
@samoylovfp
Oct 03 2018 15:34
Hello! I would really appreciate it if someone submits any tips to help me make this PR better. This is my first contribution to a rust crate and actually my first functional contribution to an open source project at all. https://github.com/sebcrozet/kiss3d/pull/132/files
Thiez
@Thiez
Oct 03 2018 16:10
What's up with the weird let mut r = window.add_rectangle(100.0, 100.0); on line 23? Was one space not enough? :D
Oh it seems that gitter eats the extra spaces, but y'all have to imagine there being 6 spaces between the r and the =.

I think stuff like the following is a bit weird:

        TextureManager::load_texture_into_context(image::open(path).unwrap())
        .map_err(|e|format!("{} path {}", e, path.to_str().unwrap())).unwrap()

Generally you don't want to just crash when you unwrap, but the map_err makes me suspect that you do expect this stuff to fail regularly?

samoylovfp
@samoylovfp
Oct 03 2018 17:31
Thanks for feedback!
I added spaces to try and follow the formatting principles of existing code, but with additional calls between cube and rectangle initializations this lost sense, you right, thanks for picking this up! The error handling got a little bit messier yes. I tried to save the error message from inside the function and add the bit about the path but sacrificed some eloquency. On the second look this tradeoff does not look worthy. To crash when the file format is not recognized was the intent of the library author and I don' think I should change that. This was helpful, thanks again!
D'Silva
@evnix
Oct 03 2018 20:37
I am implementing a simple queue, what would be the best return type to symbolize an empty queue. I know i can use the error, but an empty queue is not an error.
pub fn dequeue() -> Result<Record, Box<Error>> { }
Lyle Mantooth
@IslandUsurper
Oct 03 2018 20:45
Option<Record>
Some(record) or None
D'Silva
@evnix
Oct 03 2018 20:47
Ah Thanks!!
Lyle Mantooth
@IslandUsurper
Oct 03 2018 20:47
Or, if dequeue can have a real error too, then Result<Option<Record>, Box<Error>> . . . isn't very friendly. In that case, I would make your Error have an easily matched EmptyQueue variant or something.
D'Silva
@evnix
Oct 03 2018 20:48
I was just about to ask you the same! Thank you :)
D'Silva
@evnix
Oct 03 2018 20:57
return Ok(None); doesn't seem to work, is there a different way to express the same.
Lyle Mantooth
@IslandUsurper
Oct 03 2018 21:01
It ought to work with that return type.
D'Silva
@evnix
Oct 03 2018 21:03
oops sorry, My fault, I misinterpreted the compiler error
Ash
@ashthespy
Oct 03 2018 22:21
Not sure if the right place - but I am having issues cross compiling for i686-unknown-linux-gnu and arm-unknown-linux-gnueabihf on the same machine.
for i686 I use the compiler from gcc-multilib which doesn't play nice with crossbuild-essential-armhf that provides gcc-arm-linux-gnueabihf
Ash
@ashthespy
Oct 03 2018 22:27
is there a way to install only i686-unknown-linux-gnu-gcc on an debian machine?