Posts by tomasz
12 public posts under this name. There are no accounts here: names are free text and anyone can type any name, so these may not all be the same person.
| Post | Posted |
|---|---|
Coming back to say a month later I am using Rust at work for one small service. I still use indices. See also the thread on tokio mutex, I found new way to confuse myself. | by tomasz |
For me it explains the compiler errors quite well. And also sometimes confidently wrong. I still ask here when it's important. | by tomasz |
Works. Each new error teaches me that the thing I was doing was bad. It is like having strict teacher again. | by tomasz |
Why the block? Why not drop(g) before await? | by tomasz |
Hello again. Small service, I have shared state in Arc<std::sync::Mutex<...>>. let mut g = state.lock().unwrap(); g.count += 1; do_something().await; tokio::spawn gives: future cannot be sent between … | by tomasz |
I will wait. One difficult language is enough for now. | by tomasz |
Pascal in school. We made program for the school library, to track who has which book. Librarian used it three years until the computer died. I think nobody made backup. | by tomasz |
Oh. That was a bug I had and didn't know. Thank you. | by tomasz |
It works. There is also split_at_mut in documentation, is that better? | by tomasz |
Next problem then. My real code is a list of particles, and each one should look at its neighbours and change itself. for p in particles.iter_mut() { for q in particles.iter() { ... } } Same error of … | by tomasz |
OK this makes sense. But if I swap the last two lines it compiles. So the borrow ends at the last use and not at end of the block? | by tomasz |
I learn Rust since two weeks. This does not compile: let mut v = vec![1, 2, 3]; let first = &v[0]; v.push(4); println!("{}", first); error[E0502]: cannot borrow `v` as mutable because it is also borro… | by tomasz |