#prog #rust
issue, fix
mod my {
pub struct Foo(&'static str);
}
impl AsRef<str> for my::Foo {
fn as_ref(&self) -> &str {
let Self(s) = self;
s
}
}
Это компилируется, хотя единственное поле структуры Foo
— приватное. Но на nightly не прокатит, там уже пофиксили.issue, fix
GitHub
Tuple struct's private field can be accessed outside the defining module · Issue #111220 · rust-lang/rust
I tried this code: mod my { pub struct Foo(&'static str); } impl AsRef<str> for my::Foo { fn as_ref(&self) -> &str { let Self(s) = self; s } } I expected to see this happen...
😱5👌1🖕1
Блог*
Внизу размер массива, слева — число сравнений. 🟠 Rust 🔵 std::sort (LLVM) ⚫️ std::sort (GCC) А вот тут ситуация уже похуже. Квадратичная асимптотика в полный рост, и quickselect из Rust std явно уязвим к эксплоиту. При всём этом версия на Rust делает примерно…
#prog #rust
В реализации select_nth_unstable добавили переход к median of medians для патологических входных данных. Теперь она действительно имеет линейную сложность. 🎉
https://github.com/rust-lang/rust/pull/107522
В реализации select_nth_unstable добавили переход к median of medians для патологических входных данных. Теперь она действительно имеет линейную сложность. 🎉
https://github.com/rust-lang/rust/pull/107522
GitHub
Add Median of Medians fallback to introselect by Sp00ph · Pull Request #107522 · rust-lang/rust
Fixes #102451.
This PR is a follow up to #106997. It adds a Fast Deterministic Selection implementation as a fallback to the introselect algorithm used by select_nth_unstable. This allows it to gua...
This PR is a follow up to #106997. It adds a Fast Deterministic Selection implementation as a fallback to the introselect algorithm used by select_nth_unstable. This allows it to gua...
❤🔥2🔥1🍌1🖕1
Блог*
#prog #rust В реализации select_nth_unstable добавили переход к median of medians для патологических входных данных. Теперь она действительно имеет линейную сложность. 🎉 https://github.com/rust-lang/rust/pull/107522
Reddit
From the rustjerk community on Reddit
Explore this post and more from the rustjerk community
😁15🖕1
#rust
The RustConf Keynote Fiasco, explained
Вы, вероятно, слышали про недавнюю связанную с RustConf драму в раст-сообществе (если нет, то в тексте есть необходимый контекст). Амос взял на себя труд собрать воедино публичные заявления причастных лиц (со ссылками, разумеется) и расположить их в хронологическом порядке. После того, как я изучил этот текст (вместе со всеми упомянутыми, разумеется), я сформулировал своё мнение на эту ситуацию:
Судя по всему, случившаяся драма не была вызвана чьим-то конкретным злонамеренным умыслом — только множеством актов сломанных коммуникаций.
Разумеется, YMMV, но текст Амоса — это как минимум максимально подробный таймлайн произошедших событий на данный момент.
The RustConf Keynote Fiasco, explained
Вы, вероятно, слышали про недавнюю связанную с RustConf драму в раст-сообществе (если нет, то в тексте есть необходимый контекст). Амос взял на себя труд собрать воедино публичные заявления причастных лиц (со ссылками, разумеется) и расположить их в хронологическом порядке. После того, как я изучил этот текст (вместе со всеми упомянутыми, разумеется), я сформулировал своё мнение на эту ситуацию:
Судя по всему, случившаяся драма не была вызвана чьим-то конкретным злонамеренным умыслом — только множеством актов сломанных коммуникаций.
Разумеется, YMMV, но текст Амоса — это как минимум максимально подробный таймлайн произошедших событий на данный момент.
fasterthanli.me
The RustConf Keynote Fiasco, explained
Disclaimer: At some point in this article, I discuss The Rust Foundation. I have received a $ 5000 grant from them in 2023 for making educational articles and videos about Rust. I have NOT signed a...
👍5😢1👌1😐1🖕1
#game #article
Marvel Snap - The Definitive Deconstruction
Подробный разбор Marvel Snap — f2p PvP ККИ в сеттинге мультивселенной Marvel с покероподобной системой ставок, быстрыми матчами и колодами всего по 10 карт.
Disclaimer: я в это не играл и про игру узнал лишь из этой статьи.
Marvel Snap - The Definitive Deconstruction
Подробный разбор Marvel Snap — f2p PvP ККИ в сеттинге мультивселенной Marvel с покероподобной системой ставок, быстрыми матчами и колодами всего по 10 карт.
Disclaimer: я в это не играл и про игру узнал лишь из этой статьи.
Deconstructor of Fun
Dive into our most in depth deconstruction ever!
💩3👍2😐1🖕1
Блог*
@ozkriff: — ...Я не просто бесполезный, я вредный. #quotes
Не слушайте Андрея, он на себя наговаривает. Так-то он хороший и симпатичный человек, и уж точно весьма полезный.
👍8👎2🖕1
Современная фронтенд-разработка — это лучшее от всех миров: надёжность PHP, скорость Python и время компиляции C++.
😁40😐7🤡6😭4👍1👎1👌1🖕1
#prog #rust #article
Volatile
So the other day on Twitter a person posted a perfectly innocent question.
does Rust’s Cell type have volatile semantics. is Cell
the appropriate type for describing memory that is
modified by peripheral hardware.
do i have to write a volatile cell crate. i do not wish
to write volcel at my job but i will do it if i have to
To which I replied
(1) Cell does not have volatile semantics (2) do not
write a volcel crate there are several crate for a VolatileCell
type already (3) do not use any VolatileCell crate
they literally are all incorrect.
Now before we begin, full disclosure: I have my own volatile handling crate, which could be seen as a “competing” crate with the rest of the “VolatileCell” style crates. It offers an alternate style of abstraction, which is slightly more annoying to use in some cases, but has the main benefit that it’s at least not incorrect.
Volatile
So the other day on Twitter a person posted a perfectly innocent question.
does Rust’s Cell type have volatile semantics. is Cell
the appropriate type for describing memory that is
modified by peripheral hardware.
do i have to write a volatile cell crate. i do not wish
to write volcel at my job but i will do it if i have to
To which I replied
(1) Cell does not have volatile semantics (2) do not
write a volcel crate there are several crate for a VolatileCell
type already (3) do not use any VolatileCell crate
they literally are all incorrect.
Now before we begin, full disclosure: I have my own volatile handling crate, which could be seen as a “competing” crate with the rest of the “VolatileCell” style crates. It offers an alternate style of abstraction, which is slightly more annoying to use in some cases, but has the main benefit that it’s at least not incorrect.
lokathor.github.io
Volatile
github pages
👍3😐1🖕1
Forwarded from Type Driven Thoughts 🦀
And another slide by Graydon Hoare explaining the move semantics from way back, when Rust was only incubating. I like how from beginning they decided to make the terminology not too academic.
❤8😁1🖕1
🌚17🥰2😱2😁1🖕1