Два года в /fg/. Войти !bnw Сегодня Клубы
Привет, TbI — HRWKA! 1243.0 пользователей не могут ошибаться!
?6954
прекрасное6446
говно5911
говнорашка5512
хуита4724
anime3068
linux2656
music2638
bnw2606
рашка2570
log2364
ололо2202
дунч1852
pic1816
сталирасты1491
украина1439
быдло1438
bnw_ppl1428
дыбр1238
гімно1158

Я получаю ссылку на мутабельный экземпляр структуры. У структуры есть внутри три вектора — `prev`, `next` и `curr`. На каждой итерации алгоритма `next` рассчитывается по `prev` и `curr`. Это интегрирование Верле, если что, но не важно. Хочется не выделять память много раз, а просто держать их постоянно, циклически переставляя **ссылки** (а не данные, которых много, естественно) после каждой итерации: `prev <- curr <- next`, а `prev -> next`, чтобы не болтался. Единственное, что я осилил сделать с ними, вот: std::mem::swap(&mut self.curr, &mut self.next); std::mem::swap(&mut self.prev, &mut self.next); При попытке юзать `std::mem::replace` или рисваивать как-то руками, я жестоко обламываюсь. Т.е. взять эти самые три ссылки разом, запиать в три идентификатора и потом присвоить трём полям структуры — это уже я не осилил. Как бороть?..
#GRUN3I (3+2) / @dluciv / 2966 дней назад
https://www.reddit.com/r/rust_gamedev/comments/5vqlln/shar_one_year_with_rust/ "Hi, Reddit! I posted here for a few times, and now our team has reached the important stage of development - we are launching our Greenlight campaign on Steam. Game idea Our idea is quite simple - we found [an article](gafferongames.com/networking-for-game-programmers/) about network physics synchronization and realized, that there are very few games that use physics extensively as the core part of gameplay. We have very big plans on this idea, but as a first step - we want to launch our first game with this technology. We found the simplest game mechanics exposing this physics idea and started to work. Feedback on the language First of all - Rust is an amazing language for game development, maybe it is the best one. We have Rust stable on build machine and nightly for development. Nightly is used only for compiler intrinsics for a profiler. There were problems with nightly one or two times, but simple downgrades to previous nightly solved the problem. The main issue was compilation time - our biggest crate compiled for about 3 minutes. But with incremental compilation, it&#39;s almost fixed. It still takes minutes sometimes, but often - only a few seconds. I am using incremental compilation from very early testing versions - and I had only one time when it generated invalid code. During this year I had only one (ONE!!) bug in the code that was really hard to find. The entire program behaved really strange, crashing sometimes with strange backtrace inside a hashmap implementation. This bug was found within a day, I just double-triple-etc checked all usages of "unsafe" keyword in the codebase (there were 3 times). And yes, the bug was in one of those unsafes. Most of the time I was the only programmer, and basically, we were a 3-person team - me, 3d and 2d artists. Recently, my friend joined us as the second programmer. He works on the particle system now. He had no experience with Rust at all, so I watched how fast or painful learning of Rust is for a newbie. And he was completely satisfied! I found that Rust is absolutely good as a mentor. I mean - when you write good code, it compiles smoothly, but when you made a bad decision (like to store pointers to dynamic data everywhere or building over complicated structures) Rust tells you - please, stop, think more on design. And it actually works! I’ve seen how Rust teach you how to code. The biggest question, when we started our game with Rust, was about the libraries and an infrastructure. How to build a GUI? How to work with 3d party data? And, yes, we had some problems with libraries. After all, the only big library we are using - is glium. I can&#39;t say that glium is perfect, but it works. Our rendering is quite simple, and it works well for our needs. The best part of glium - you don&#39;t go too far from OpenGL, so, theoretically, it may be replaced or changed when it will be really needed. On the other hand, glium just works at the beginning and is simple and useful. It’s sad that it&#39;s almost not supported anymore, but I absolutely understand reasons behind that. Maybe we will do our own glium-compatible (at least the part we use) OpenGL wrapper, maybe we&#39;ll try to add needed features to glium. "
#VVYYEN (2+2) / @o01eg / 2966 дней назад
>у C++ скоро повиснет указатель
#JIYZS5 (0) / @anonymous / 2972 дня назад

https://polyfractal.com/post/rustl8710/
раст прикрученный изолентой к freertos на аналоге esp8266 с cortex-m3 вместо цугундерного xtensa.

#10D3EK (7+3) / @lexszero / 2975 дней назад
https://blog.rust-lang.org/2017/02/02/Rust-1.15.html "The build system for Rust has been re-written in Rust, using Cargo. It is now the default. This process has been long, but has finally borne fruit. Given that all Rust development happens on the master branch, we’ve been using it since December of last year, and it’s working well. There is an open PR to remove the Makefiles entirely, landing in Rust 1.17. This will pave the way for rustc to use packages from crates.io in the compiler like any other Rust project, and is a further demonstration of the maturity of Cargo. Rust has gained Tier 3 support for i686-unknown-openbsd, MSP430, and ARMv5TE."
#3VVGRP (0+1) / @o01eg / 2988 дней назад
У - удобно: `cargo install cargo-tree`
#LPUU6Z (0) / @o01eg / 2994 дня назад
Rust обгоняет Go: https://medium.com/@robertgrosse/parallelizing-enjarify-in-go-and-rust-21055d64af7e#.ofup3wz68 Hashtests time: Rust 135 seconds, Go 290 seconds Rust: 82.5 seconds, Go 165 seconds, Pypy 310 seconds
#9XFX53 (5+1) / @o01eg / 2996 дней назад
Новый вид гриппа, заразившийся им переписывает ПО на Rust: http://www.wilfred.me.uk/blog/2017/01/11/announcing-remacs-porting-emacs-to-rust/
#2KZQ1E (3+1) / @o01eg / 3010 дней назад
Я так понимаю, что нет типажа, который бы определял, является ли переменная типа числом с плавующей точкой (f32, f64) или вообще даже числом? Т.е. мне хочется написать обощённую функцию, которая бы принимала число произвольного типа и возвращала число произвольного типа: fn f<T: Copy + Num>(x: T) -> T { ... }
#DLXMPC (7) / @corpse / 3075 дней назад
А как реализованы суммы типов в Rust на уровне памяти?
#23CR58 (0+1) / @ndtimofeev / 3337 дней назад

Вот тут кто-то [наговнил] либу для параллелизма для Rust:

let total_price = stores.par_iter()
.map(|store| store.compute_price(&list))
.sum()

Конечно мало сделать параллелизм простым, его надо сделать ещё и безопасным. Rayon гарантирует, что использование его API никогда не приведёт к гонке данных.

Мне вот интересно, неужели в rust нет способа захватить ref на Weak Box и таким образом выстрелить себе в ногу (ну или организовать race condition).

Не слишком ли громкое заявление?

Олсо, реквестирую подобных либ для плюсцов.

#12REV0 (4) / @ninesigns / 3389 дней назад

Охуенно выразительно и красиво. Спасибо статической типизации.

struct Node<T> { 
    prev: Raw<T>, 
    next: Link<T>, 
    elem: T, 
} 

type Link<T> = Option<Box<Node<T>>>; 

struct Raw<T> { 
    ptr: *mut Node<T>, 
} 

pub struct LinkedList<T> { 
     len: usize, 
     head: Link<T>, 
     tail: Raw<T>, 
} 
#LEUCOH (52+1) / @ninesigns / 3410 дней назад
В продакшене
#P1120Q (1+1) / @plhk / 3449 дней назад
М-м-максисмум хипстота: https://www.youtube.com/watch?v=IqrwPVtSHZI
#TSCF9J (1) / @o01eg / 3481 день назад
http://tab.snarc.org/posts/haskell/2015-09-29-rust-with-haskell.html — Все мы знаем, что haskell — идеальный язык для любых задач и лишь недостаток библиотек не даёт использовать его в больших серьёзных проектах уровня национального поисковика. Но теперь ваши мольбы услышаны и решение есть: интероп с Rust! ТАДА!
#B8468X (13+4) / @ndtimofeev / 3482 дня назад
В GTK системный трэй считают устарешим, а в QML (сама Qt в rust не поддерживается) трэй просто не поддерживается.
#57QD7M (2) / @o01eg / 3491 день назад
#LICDN4 (1) / @o01eg / 3498 дней назад
--
ipv6 ready BnW для ведрофона BnW на Реформале Викивач Котятки

Цоперайт © 2010-2016 @stiletto.