Αλεχ
Не вижу принципиальной разницы с Actix Web. 🤷‍♀️
unsafe в C# используется наверное еще в тыщу раз меньше чем в в расте, в котором даже он не частый гость
Pavel
Значит, мне так повезло, что у меня на всех проектах с 2005 года всегда был какой-то интероп, то с С++, то с жавой. Проекты от бизнес-диаграм до игр до баз данных
Pavel
много приходится какой-то перформанс-сенситив код писать, думать об аллокациях и гц, поэтому раст меня и привлёк
Αλεχ
Значит, мне так повезло, что у меня на всех проектах с 2005 года всегда был какой-то интероп, то с С++, то с жавой. Проекты от бизнес-диаграм до игр до баз данных
скорее поверю что тебе не повезло. Посмотри на любые либы не от майкрософта (то есть не связанные с ранатаймом и тп) - json.net/serilog/rabbitmq/...
Pavel
Да я не спорю с тобой, ансейф редко нужен, но говорить, что он не используется - тоже нельзя.
Pavel
Человеческий ансейф выгодно отличает C# от Java, например, где с ним беда
Αλεχ
если за 10 лет не приходится столкнуться с кейвордов в проде (в своих игрулях я кое-где юзал, да), то я считаю что не используется. Точнее используется, но на грани погрешности, поэтому можно спокойно округилть
Αλεχ
за это время я сменил ~6 компаний и в каждой ~1-5 проектов
Boris
ну я за то время пока писал на C# могу сказать что использовал unsafe 0 раз - а это примерно 2 года и очень крупный проект
Egor
ну вы и сравнили конечно: нативный код и код под виртуальной машиной
Αλεχ
сравнили кейворд
Boris
ну вы и сравнили конечно: нативный код и код под виртуальной машиной
хочешь статистику по нативному коду пожалуйтса - ни в одном драйвере написаном на расте мне не потребовался unsafe, также ни в одном коде за последние 1.5 года
Egor
хочешь статистику по нативному коду пожалуйтса - ни в одном драйвере написаном на расте мне не потребовался unsafe, также ни в одном коде за последние 1.5 года
интересно и какой вывод можно сделать? один говорит - в расте дофига ансейфов другой - а я вот без ансейфов пишу и все ок
Boris
интересно и какой вывод можно сделать? один говорит - в расте дофига ансейфов другой - а я вот без ансейфов пишу и все ок
значит что использование этого ключевого слова сверх нормы говорит о внутренних проблемах кода чем о их отсутствии
Matwey
Господа
Boris
это как игры с нативными указателями в ЯВУ, что-то действительно ненужное на высоком уровне и спокойно разрешаемое другими механизмами с минимальными или вообще без потерь в производительности
Matwey
Напомните мне по областям видимости пожалуйста. Вот я могу сделать свой типаж и реализовать его для чужого типа. А могу я сделать свой типаж и реализовать чужой типаж для моего типажа? А что будет с чужими типами для которых реализован мой типаж для которого реализован чужой типаж?
Сергей
К.О. намекает, что вывод: всё зависит от разработчика
Сергей
Напомните мне по областям видимости пожалуйста. Вот я могу сделать свой типаж и реализовать его для чужого типа. А могу я сделать свой типаж и реализовать чужой типаж для моего типажа? А что будет с чужими типами для которых реализован мой типаж для которого реализован чужой типаж?
Типаж не реализуется для типажа, только для типа, реализующего типаж. Если ты сделаешь одинаковые функции, будет конфликт и надо будет указывать, из какого именно типажа надо вызвать функцию. Переопределять методы своих или чужих типажей, даже для своих типов - нельзя. Это называется специализация, и её ещё не завезли.
folex
А есть какой-то комбинатор на Iterator, который работает как take, но не косьюмит итератор? По сути мне нужно вызвать next несколько раз, и собрать результат
ozkriff🇺🇦
peek?
folex
peek?
Peekable::peek?
folex
он один элемент отдает, а мне бы несколько
ozkriff🇺🇦
в itertools, кажется, был multipeek
folex
peeking_take_while есть
folex
и take_while_ref, он мне больше подходит спасибо :)
folex
А, он там клонит итератор чтобы вернуть его в оригинальное состояние. Придется видимо самому писать
ozkriff🇺🇦
в itertools, кажется, был multipeek
@folexeyy а multipeek тебе чем не нравится-то? вроде ровно то и делает, что ты хочешь
folex
@folexeyy а multipeek тебе чем не нравится-то? вроде ровно то и делает, что ты хочешь
у меня почему-то его не видно было 🤔 > without advancing the base iterator А мне нужно чтобы advancing
Αλεχ
поэтому мне кажется тут взаимоисклчающие параграфы. Неразрушающе можно только на текущее значение посмотреть
folex
take вот консюмит, а next просто мутирует
Αλεχ
take вот консюмит, а next просто мутирует
next переходит к ледующему элементу логически, и вернуться назад уже нельзя в общем случае
folex
мне и не нужно
Αλεχ
тогда чем take(n) не устраивает?
folex
take консюмит итератор, а не мутирует
Αλεχ
тебе нужен сплит что ли7 Получить n первых элементов и итератор хвоста?
folex
мне нужен take, который мутирует, а не консюмит take(&mut self) нужен
folex
чтобы возвращал n первых элементов, и продвигал итератор при этом
folex
iter.by_ref().take?
вау! Спасибо, сейчас буду пробовать
Αλεχ
А кто-нибудь видел рекомендации когда копи-типы лучше по ссылке передавать? Ну то есть x: &i32 это бред, все понимают, а вот x: &Foo начиная с какого размера Foo имеет смысл?
Hirrolot
Когда размер больше ссылки
Αλεχ
Когда размер больше ссылки
а можешь дать ссылку на линт7
ozkriff🇺🇦
я так понимаю, что в общем случае сложно точную грань назвать. видел, что в cgmath пришли к передаче [f32; 16] матриц по значению, но может это из-за того, что так всяким оптимизациям llvm'а проще работать с линалг кодом, а не просто про размер переменной.
Hirrolot
а можешь дать ссылку на линт7
Я попутал с https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
Социальная Шизофрения
порекомендуйте каналы с новостями о rust
Hirrolot
https://t.me/this_week_in_rust
ozkriff🇺🇦
https://t.me/this_week_in_rust
он помер давно еще
kitsu
https://t.me/this_week_in_rust
на него забили кажется
Αλεχ
Я попутал с https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
In many calling conventions instances of structs will be passed through registers if they fit into two or less general purpose registers. Думаю, мне подойдет, спасибо)
Egor
на него забили кажется
а есть алтернативы в телеге? а то даже в твиттере и в дискорде раста инфа поинтереснее
Sergey
займусь сейчас
Sergey
подниму
Egor
Egor
надо бота, который будет из /r/rust воровать посты)
:))) ну как минимум так а вроде кто то делал, не помню кто но опять же - умер очень быстро :)
Hirrolot
https://github.com/teloxide/community-bots/tree/master/subreddit_reader
Null
This week in Rust #335 — 21 apr 2020 https://this-week-in-rust.org/blog/2020/04/21/this-week-in-rust-335/
Null
Updates from core remove a stack frame from .await calls rust-lang/rust/pull/70831 improve async-await/generator obligation errors in some cases rust-lang/rust/pull/70679 make needs_drop less pessimistic on generators rust-lang/rust/pull/70015 provide better compiler output when using ? on Option in fn returning Result and vice-versa rust-lang/rust/pull/71141 suggest .into() over try_into() when it would work rust-lang/rust/pull/71051 maintain chain of derived obligations rust-lang/rust/pull/69793 chalk: recursive solver rust-lang/chalk/pull/372 chalk: recursive solver: Exit early on ambiguity rust-lang/chalk/pull/404 chalk: make it possible to cache the result of env elaboration rust-lang/chalk/pull/403 use query to determine whether function needs const checking rust-lang/rust/pull/69642 mir-opt: run SimplifyLocals to a fixedpoint and handle most rvalue rust-lang/rust/pull/70755 miri: add option to disable alignment check rust-lang/miri/pull/1332 miri: let machine hook dynamically decide about alignment checks rust-lang/rust/pull/71101 miri: expand frame hooks rust-lang/rust/pull/71100 miri: handle std::sync::atomic::spin_loop_hint() rust-lang/miri/pull/1342 ptr: introduce len() method on raw slices rust-lang/rust/pull/71082 miri: use pre-computed layouts some more rust-lang/miri/pull/1349 miri-unleashed: test that we detect heap allocations rust-lang/rust/pull/71276 deprecate the asm! macro in favor of llvm_asm! rust-lang/rust/pull/71007 backtrace: remove memmap dependency rust-lang/backtrace-rs/pull/311 cargo: several updates to token/index handling rust-lang/cargo/pull/7973 cargo: try to avoid panics on buggy (?) clocks rust-lang/cargo/pull/8114
Null
News Rust Survey 2019 results. blog.rust-lang.org Testing sync at Dropbox. dropbox.tech Write an OS for the Raspberry Pi in Rust. tc.gts3.org Wired Logic - a pixel-based digital circuit simulator running in a browser (Rust compiled into WASM). iostapyshyn.github.io Better stack fixing for Firefox. blog.mozilla.org Writing Python inside your Rust code — part 1. blog.m-ou.se wgpu-rs on the web. gfx-rs.github.io Building a Rust web browser from scratch. joshondesign.com From Pratt to Dijkstra. matklad.github.io Rust lang tips and tricks. mudit.blog An experiment with type-erased data structures. vgatherps.github.io How to write CRaP Rust code. blog.logrocket.com Intro to gfx-hal - part 3: Vertex buffers. www.falseidolfactory.com How I reverse engineered the LastPass CLI tool. adventures.michaelfbryan.com Open-sourcing dotenv-linter: lightning-fast tool to lint your .env files. evrone.com rust-analyzer changelog 21. rust-analyzer.github.io
Null
Crate of the week: regex2fat This week's crate is regex2fat, a program to convert a regular expression into a decidedly nonstandard FAT32 file system.
Null
This week in Rust #336 — 29 apr 2020 https://this-week-in-rust.org/blog/2020/04/29/this-week-in-rust-336/
Null
Updates from core don't run various MIR optimizations at mir-opt-level=0 rust-lang/rust/pull/70073 replace thread_local with generator resume arguments in box_region rust-lang/rust/pull/71554 fix -Zast-json to output correct JSON form rust-lang/rust/pull/71284 allow wasm32 compilation of librustc_data_structures/profiling.rs rust-lang/rust/pull/71369 proc_macro::is_available() rust-lang/rust/pull/71400 proc_macro: stabilize Span::resolved_at and Span::located_at rust-lang/rust/pull/69041 attempt to recover perf by removing exports_all_green rust-lang/rust/pull/71267 chalk: use FxHashMap/FxHashSet and add well-formed clause for tuples rust-lang/chalk/pull/411 ConstProp: use a BitSet<Local> instead of IndexVec<Local, bool> rust-lang/rust/pull/71312 fix span of while (let) expressions after lowering rust-lang/rust/pull/71494 Miri Frame: use mir::Location to represent position in function rust-lang/rust/pull/71475 add BinaryHeap::retain rust-lang/rust/pull/71485 add a function to turn Box<T> into Box<[T]> rust-lang/rust/pull/71421 add missing Send and Sync impls for linked list Cursor and CursorMut rust-lang/rust/pull/71548 implement BitOr and BitOrAssign for the NonZero integer types rust-lang/rust/pull/69813 stabilize most common subset of alloc_layout_extras rust-lang/rust/pull/69362 stabilize Span::mixed_site rust-lang/rust/pull/68716 stabilize BTreeMap::remove_entry rust-lang/rust/pull/70712 futures: introduce ready_chunks adaptor rust-lang/futures-rs/pull/2123 backport to 0.1: Avoid starvation from FuturesUnordered::poll_next rust-lang/futures-rs/pull/2122 futures: add AsyncWriteExt::write_all_vectored utility rust-lang/futures-rs/pull/1741 hashbrown: future-proof specialization code rust-lang/hashbrown/pull/147 hashbrown: remove unsound use of specialization rust-lang/hashbrown/pull/154 cargo: fix warning for resolve mismatch in workspace rust-lang/cargo/pull/8169 cargo: add resolver opt-in for new feature resolver rust-lang/cargo/pull/8129 rustdoc: replace big JS dict with JSON parsing rust-lang/rust/pull/71250
Null
News 🎈🎉 Announcing Rust 1.43.0. 🎉🎈 blog.rust-lang.org How to speed up the Rust compiler in 2020. blog.mozilla.org A taste of WebGPU in Firefox. hacks.mozilla.org Data ingestion with Rust and AWS Lambda. jamesmcm.github.io Embedded Rust pattern - zero sized references. ferrous-systems.com Implementing a linear quadtree in Rust. snorrwe.onrender.com Memory efficient serialization of tagged union. robinmoussu.gitlab.io Unpacking Serde. www.reddit.com [video] Rust stream: ownership, closures, and threads - oh my. www.youtube.com [video] Crust of Rust: lifetime annotations. www.youtube.com First impressions on Rust and WebAssembly. deedone.github.io From Rust to WebAssembly: Building an interactive note-taking web app with Actix & Yew. www.luu.io Rust’s future: internal execution. blog.knoldus.com Rust concurrency: five easy pieces. medium.com/@polyglot_factotum (Almost) lockless stream buffering. mcfelix.me Rust and Node.js: a match made in heaven. blog.logrocket.com Reducing the size of a Rust GStreamer plugin. www.collabora.com Writing Python inside your Rust code — Part 2. blog.m-ou.se
Null
Crate of the week: coercible_errors This week's crate is coercible_errors, a library that allows generic trait implementations to omit the size cost of Result::Err if errors never happen.
kitsu
поняслась
Null
This week in Rust #337 — 05 may 2020 https://this-week-in-rust.org/blog/2020/05/05/this-week-in-rust-337/
Null
Updates from core implement RFC #2523, #[cfg(version(..))] rust-lang.github.io have the per-query caches store the results on arenas rust-lang/rust/pull/70674 avoid duplicating code for each query rust-lang/rust/pull/69808 forbid dyn Trait in patterns rust-lang/rust/pull/71038 fix wrong argument in autoderef process rust-lang/rust/pull/71627 suggest into instead of try_into if possible with int types rust-lang/rust/pull/71617 tweak some suggestions in rustc_resolve rust-lang/rust/pull/71438 add message for resolution failure because wrong namespace rust-lang/rust/pull/71419 point at the return type on .into() failure caused by ? rust-lang/rust/pull/71409 suggest ; or assignment to drop borrows in tail exprs rust-lang/rust/pull/71217 on type mismatch involving associated type, suggest constraint rust-lang/rust/pull/71108 minimize parameter of coerce_borrowed_pointer rust-lang/rust/pull/71524 remove some Vec allocations to improve performance rust-lang/rust/pull/71268 allow Unreachable terminators unconditionally in const-checking rust-lang/rust/pull/71691 allow Downcast projections unconditionally in const-checking rust-lang/rust/pull/71688 added MIR constant propagation of Scalars into function call arguments rust-lang/rust/pull/71697 Miri: unleash all feature gates rust-lang/rust/pull/71631 use existing framework for backward dataflow analyses rust-lang/rust/pull/71006 add Read/Write::can_read/write_vectored rust-lang/rust/pull/67841 add RefCell::take rust-lang/rust/pull/71398 slice::fill: use T instead of generic arg rust-lang/rust/pull/71165 Vec drop and truncate: drop using raw slice *mut [T] rust-lang/rust/pull/71148 hashbrown: mark RawTable::par_iter unsafe rust-lang/hashbrown/pull/157
Null
News Async interviews: my take thus far smallcultfollowing.com Multi-threaded HTTP/WebSocket server in Rust. sergey-melnychuk.github.io Cheating Rank-n with Traits leshow.github.io Understanding Memory and Thread Safety Practices and Issues in Real-World Rust Programs cseweb.ucsd.edu A beginners guide to gRPC with Rust dev.to Setup Anaconda, Jupyter, and Rust shahinrostami.com Teleforking a process onto a different computer! thume.ca Stubbing out WASI manually in Rust www.jakubkonka.com Rust Analyzer - Changelog #22 rust-analyzer.github.io IntelliJ Rust changelog #121 intellij-rust.github.io Type-level programming in Rust willcrichton.net Rust at FullStory, Part 2: A Look Inside Our Mobile SDK bionic.fullstory.com Notes on Parsing in Rust blog.wesleyac.com Create a blazingly fast REST API in Rust (Part 1/2) docs.qovery.com The Safety Boat: Kubernetes and Rust msrc-blog.microsoft.com From Pratt to Dijkstra matklad.github.io Learning embedded Rust by building RISC-V-powered robot - Part 4 k155la3.blog How to write CRaP Rust Code blog.logrocket.com Rust concurrency: a streaming workflow, served with a side of back-pressure. medium.com/@polyglot_factotum Writing a Python module in Rust using PyO3 kushaldas.in Creating a Robust, Reusable Link-Checker adventures.michaelfbryan.com [video] Crust of Rust: Declarative Macros www.youtube.com [video] Rust Stream: String it All Together! www.youtube.com [video] Educational Rust live coding - Building a git CLI www.youtube.com [video] Maximum Sum of Subarrays (Leetcode) in Rust www.youtube.com [video] WASM + Rust www.youtube.com [video] Concurrency in Rust with Async/Await www.youtube.com [video] Rust and Tell Berlin Meetup - April 2020 [video] www.youtube.com [video] Rust Zürisee, April: cargo crev and cargo audit www.youtube.com