Forwarded from Deleted Account
Pin unsound в теории, а async await unsound вот почему https://github.com/rust-lang/rust/issues/63818
GitHub
Resolve unsound interaction between noalias and self-referential data (incl. generators, async fn) · Issue #63818 · rust-lang/rust
Self-referential generators violate LLVM's expectations for noalias due to the overlapping bounds of the interior references and the &mut self argument to the Generator::resume function. Or...
Forwarded from Stanislav Popov
моё творчество от безделья
def get_parents_list(clause) -> List[models.Category]:
beginning_getter = models.Category.query.filter(clause).cte(name="parent_for", recursive=True)
with_recursive = beginning_getter.union_all(
models.Category.query.filter(models.Category.id == beginning_getter.c.parent_id)
)
return DBSession.query(models.Category).select_entity_from(with_recursive).all()
Forwarded from Deleted Account
https://blog.zaletskyy.com/hierarchical-storage-of-data-in-databases вариантов много, надо выбирать под задачу, точнее вообще не делать так в реляционной базе
Forwarded from Stanislav Popov
насколько я помню я просто заюзал это https://gist.github.com/fritzy/10427e8032d77ded8e13
Gist
Fight the German Tank Problem in Postgresql with short, unique, url-safe ids.
Fight the German Tank Problem in Postgresql with short, unique, url-safe ids. - 1unique_short_id.sql
Forwarded from p0lunin
https://github.com/tokio-rs/tokio/blob/master/examples/hello_world.rs
вот хеловорд с сокетами
тебе нужно просто прослушивать сокет, и кидать данные в serde_json после прочтения
вот хеловорд с сокетами
тебе нужно просто прослушивать сокет, и кидать данные в serde_json после прочтения
GitHub
tokio/examples/hello_world.rs at master · tokio-rs/tokio
A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ... - tokio-rs/tokio
Forwarded from Αλεχ Zhukovsky
https://boats.gitlab.io/blog/post/why-ok-wrapping/ снова изобретаем монады
withoutblogs
A brief apology of Ok-Wrapping
I’ve long been a proponent of having some sort of syntax in Rust for writing functions which return results which “ok-wrap” the happy path. This is has also always been a feature …
Forwarded from dørk pit
как-то раньше не задумывался, но ведь можно юзать голый
и заодно дженерики с лайфтаймами попрактиковал.
https://gist.github.com/ratijas/c0122a7ec276966513f8f6e92bd080d0
Box<[T]> для многомерных массивов.и заодно дженерики с лайфтаймами попрактиковал.
https://gist.github.com/ratijas/c0122a7ec276966513f8f6e92bd080d0
Gist
Using Box<[T]> in Rust for multi-dimensional arrays
Using Box<[T]> in Rust for multi-dimensional arrays - playground.rs
Forwarded from Deleted Account
Дело в том, что C++ - язык свободных и ответственных людей, а не фанатиков, которые скоро будут воздвигать алтари компиляторам и приносить на них в жертву своих детей ради чуть большей безопасности. Поэтому выбор инструментария в нем не ограничен. Ну и как писал Франклин в своём последнем блоге про Rust: "Те, кто готов променять свою свободу на маленькую толику безопасности, не заслуживают ни свободы, ни безопасности!"
Forwarded from Ivan Boldyrev
Вот, кстати, задания с одного лондонского митапа для начинающих (точнее, это было dojo)
https://github.com/LukeMathWalker/build-your-own-jira-with-rust
https://github.com/LukeMathWalker/build-your-own-jira-with-rust
GitHub
GitHub - LukeMathWalker/build-your-own-jira-with-rust: A test-driven workshop to learn Rust building your own JIRA clone!
A test-driven workshop to learn Rust building your own JIRA clone! - LukeMathWalker/build-your-own-jira-with-rust
Forwarded from Deleted Account
Потому что функции это дескрипторы, биндящиеся при получении как поле объекта. Это делает возможным огромное количество магии.
Forwarded from Deleted Account
Например, позднюю привязку методов:
>>> def print_self(self):
... print(self)
...
>>>
>>> class C: pass
>>> a = C()
>>> C.print_self = print_self
>>> a.print_self()
<__main__.C object at 0x7f18dd744d60>
Forwarded from Deleted Account
Или даже хуже:
>>> def print_self(self):
... print(self)
...
>>>
>>> a = object()
>>> method = print_self.__get__(a)
>>> method()
<object object at 0x7f75edaf9e40>
Forwarded from Stanislav Popov
вот про это статья https://blog.danlew.net/2017/07/27/an-introduction-to-functional-reactive-programming/
Dan Lew Codes
An Introduction to Functional Reactive Programming
I gave a talk this year about functional reactive programming (FRP) that
attempted to break down what gives FRP its name and why you should care. Here's
a write-up of that talk.
--------------------------------------------------------------------------…
attempted to break down what gives FRP its name and why you should care. Here's
a write-up of that talk.
--------------------------------------------------------------------------…
Forwarded from Stanislav Popov
вот это у меня так и не заработало https://twitter.com/ChromeDevTools/status/1192803818024710145
Twitter
Chrome DevTools
Initial DWARF support has landed in Chrome DevTools! It means that you can resolve stack traces, set breakpoints and step-in/-over source code in C/C++/Rust natively, without generating source maps.