These are chat archives for rust-lang/rust

8th
Feb 2019
Ogulcan Erduran
@erduranogulcan
Feb 08 10:29
how can i return custom struct? like
pub fn test()  -> T
{
    { message: String::from("this is a message")  }
}
Denis Lisov
@tanriol
Feb 08 10:31
There's no unnamed struct type with named fields in Rust. You need to actually declare it and construct it normally
struct Message {
    message: String
}
Ogulcan Erduran
@erduranogulcan
Feb 08 10:33
@tanriol does it effect performance for big project? if every function returns custom values like this situation
Denis Lisov
@tanriol
Feb 08 10:34
Might affect compile times. Do you actually need a custom type for every function?
Ogulcan Erduran
@erduranogulcan
Feb 08 10:36
@tanriol mostly yes. for example i return some custom values in insert functions to client. there are many functions that send custom values. in C# i can send custom types but probably i will do that like you said
Ingvar Stepanyan
@RReverser
Feb 08 12:39
How many different types can you have? I'd imagine most of them are pretty uniform?
wegry
@wegry
Feb 08 12:56
I'm trying to get my hyper server to reachable over a local network with no luck so far
I think it's a (lack of) headers issue, but I could be wrong?
I posted this on reddit too, and someone mentioned range headers
wegry
@wegry
Feb 08 13:08
I just saw hyper has its own gitter. I'll ask over there too.
Zakarum
@omni-viral
Feb 08 13:09
@RReverser you can have as many types as you want, until compiler would run out of memory
It shouldn't affect executable size in release mode anyway
veruma
@veruma
Feb 08 13:37
can I use stable builds to develop embedded projects? they say nightly build needs to be used.
Denis Lisov
@tanriol
Feb 08 14:41
@veruma In some cases stable Rust 1.31 or higher is enough. Don't know the exact limitations at the moment.
veruma
@veruma
Feb 08 14:59
@tanriol thanks
Ingvar Stepanyan
@RReverser
Feb 08 18:40
@omni-viral That probably wasn't answer to me?
Rüdiger Klaehn
@rklaehn
Feb 08 20:34
Hi all. Is this the right place for rust noobs to ask questions about the build? I am porting a scala library to rust and want to run some benchmarks. But I can't get any of the benchmarking libraries to work.
Ichoran
@Ichoran
Feb 08 20:55
The example for Criterion.rs on https://github.com/bheisler/criterion.rs doesn't work for you? Or it does but not for any real code that you care about?
(Or you haven't tried Criterion?)
Rüdiger Klaehn
@rklaehn
Feb 08 21:59
Never mind. I figured it out. I was not able to import my stuff into the benchmark code because I had a binary project. Changing it to a library project (renaming main.rs to lib.rs) fixed it.
However, it seems that the stuff that I want to benchmark (runs in a few milliseconds) is too slow to be tested with these microbenchmarking frameworks.
Or is criterion better for this? (I am using bencher)