« first day (1993 days earlier)      last day (1482 days later) » 

3:29 AM
let mut counter = 0;

let result = loop {
counter += 1;

if counter == 10 {
break counter * 2;
}
};

why we use a semicolon in the break statement line? whereas in other cases like `if` we wont use
 
 
8 hours later…
11:57 AM
@Sameer break is a statement, not an expression.
break counter * 2 does not evaluate to a value. It is a statement that breaks the loop and then causes the loop expression to evaluate to the value.
 
 
2 hours later…
2:03 PM
@Shepmaster What could cause this (when running ./build.sh in playground)?

Step 12/21 : RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal --default- toolchain "${channel}"
---> Running in a982fd73a4db
mktemp: too few X's in template 'rustup'
rustup: command failed: mktemp -d -t rustup
info: downloading installer
mkdir: cannot create directory '': No such file or directory
rustup: command failed: mkdir -p
 
@PeterHall I get some problem too with alpine
 
2:20 PM
@PeterHall very strange! Did you change the base image from Ubuntu? Did you check the rustup issue tracker?
 
@Shepmaster didn't change anything
Except that I got bored of waiting for it to build: ctrl+c'd it, removed a lot of stuff from Cargo.toml and tried again
@Shepmaster I only wanted to confirm this: github.com/tokio-rs/mio/pull/1290#issuecomment-605024240
Perhaps you could just comment and say it's correct :)
 
2:57 PM
@PeterHall it doesn’t look correct :-)
 
@Shepmaster :D
 
It needs to be in the [package.metadata.playground] section
And it looks like they you to use all features
 
Oh, there were conflicting methods presented there. Is one obsolete?
So the playground metadata replaced the playground feature?
 
Heh, yeah. I forgot about that old way.
It’s really all driven by dtolnay. As many things are.
 
Ah, it's what's linked at the top as "Here's how serde does it". I didn't actually check serde master, until now
 
3:02 PM
Yeah. The metadata matches docs.rs and it really is metadata
I edited that comment to be clearer
 
 
2 hours later…
5:29 PM
Good evening :)
How would I go about calling an async function (and waiting for its completion) inside a sync function. I am basically looking for something like .wait() which would block until the operation has completed. A lot of people seem to have issues with that (especially when coming from a C#-like language) but I was still unable to find a solution which does just that.
 
5:49 PM
I just found futures::executor::block_on. This seems to work :)
 
 
1 hour later…
7:07 PM
@NoelWidmer For the record, you lose the benefits of async functions if you just block on them. It would be more beneficial if you could convert that sync function into an async one.
 
 
1 hour later…
8:17 PM
@E_net4removesmeta-commentary But how would I do that on the main thread?
 
@NoelWidmer Perhaps with #[tokio::main]?
 
 
2 hours later…
10:49 PM
0
Q: How to block on an async function in Rust?

pdiffleyI am following Rust's async/await primer but am having trouble running the hello world program shown below. use futures::executor::block_on; async fn hello_world() { println!("hello, world!"); } fn main() { let future = hello_world(); // Nothing is printed block_on(future); // `fut...

 
11:00 PM
@NoelWidmer Oh yes, with the right async runtime, such as tokio.
 
11:34 PM
@Shepmaster best news ever
60
Q: The Follow Questions and Answers feature is now live across the Network

Yaakov EllisWe are happy to announce that the previously announced follow question and answer feature is now live across the Network, including Stack Overflow, all Stack Exchange sites, and all Meta sites. (International Stack Overflow sites will have it turned on in a day or two once we have translations al...

 

« first day (1993 days earlier)      last day (1482 days later) »