TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Elixir and Rust is a good mix

296 点作者 rio517大约 2 年前

14 条评论

mrmincent大约 2 年前
I made the ‘risky’ decision to learn Elixir & Phoenix for a 6 week University project that I delivered earlier this week. It could have turned out to be a terrible decision but honestly once I got my head around it, it’s probably some of the most productive coding sessions I’ve ever had. Deploying to Fly.io was also amazing, I think it was 3-5 commands from signup to deployed with a database. Very happy with it all.
评论 #35564994 未加载
satvikpendem大约 2 年前
I used to use Elixir, but the lack of static types got to me (especially since I prefer the type-driven development methodology). Using Rust afterwards was great, plus it was faster than the BEAM. I guess, why not use Rust entirely instead of as a FFI into Elixir or other backend language? I've been using Axum and it works pretty well. The only time I had to do FFI with Rust was with Flutter via flutter_rust_bridge, for running a CRDT library (automerge) that was implemented in Rust, for offline app functionality.
评论 #35561366 未加载
评论 #35560826 未加载
评论 #35560720 未加载
评论 #35561049 未加载
评论 #35561402 未加载
评论 #35567720 未加载
评论 #35560515 未加载
评论 #35560499 未加载
评论 #35560740 未加载
评论 #35560759 未加载
评论 #35560621 未加载
评论 #35561113 未加载
评论 #35563313 未加载
评论 #35565814 未加载
评论 #35560615 未加载
评论 #35566644 未加载
评论 #35566181 未加载
bglusman大约 2 年前
I admit for a long time this was my primary motivation to learn Rust, but, sadly, I haven&#x27;t come across problems in years that were CPU bound&#x2F;where I needed something like Rust... Rustler still looks like a great fit if needed, but, depending on the use case, if I were CPU bound and needed to write my own code&#x2F;not just use a Rust library, I&#x27;d be as or more likely to look at using Zig and Zigler[0], for much faster learning curve, and from what I&#x27;ve read, easier tighter integration into elixir, including I think language server integration. Some discussion here[1] though I forget if I listened to this one or not.<p>[0]<a href="https:&#x2F;&#x2F;github.com&#x2F;ityonemo&#x2F;zigler">https:&#x2F;&#x2F;github.com&#x2F;ityonemo&#x2F;zigler</a> [1]<a href="https:&#x2F;&#x2F;podcast.thinkingelixir.com&#x2F;83" rel="nofollow">https:&#x2F;&#x2F;podcast.thinkingelixir.com&#x2F;83</a>
评论 #35562135 未加载
评论 #35563212 未加载
peregrine大约 2 年前
Author here. The rustler team has really made a great developer experience using Rust in Elixir and I just had to share.
maciejgryka大约 2 年前
Shameless plug &amp; also a point of support for the article: I used that same stack to build <a href="https:&#x2F;&#x2F;regex.help&#x2F;" rel="nofollow">https:&#x2F;&#x2F;regex.help&#x2F;</a> (more details here <a href="https:&#x2F;&#x2F;maciej.gryka.net&#x2F;building-regex-help" rel="nofollow">https:&#x2F;&#x2F;maciej.gryka.net&#x2F;building-regex-help</a>)
评论 #35563253 未加载
Dowwie大约 2 年前
If you&#x27;re extending Elixir with Rust, familiarize yourself with precompiled rustler: <a href="https:&#x2F;&#x2F;dashbit.co&#x2F;blog&#x2F;rustler-precompiled" rel="nofollow">https:&#x2F;&#x2F;dashbit.co&#x2F;blog&#x2F;rustler-precompiled</a>
brightball大约 2 年前
This is essentially what has gotten me into Rust. Knowing how easy Elixir makes it to offload a piece of my system that would benefit from it without needing to write the entire thing in Rust.
pawelduda大约 2 年前
I used this in past, but there were a lot of people saying that NIFs&#x2F;ports are dangerous to use. Did any of this change or are there tried and tested practices that can be applied? What I used this for wasn&#x27;t critical app so I didn&#x27;t mind it going down.<p>IIRC one threat was Rust sharing memory with BEAM which could exhaust it and cause OOM crash?
评论 #35560485 未加载
评论 #35560211 未加载
评论 #35560562 未加载
mtremsal大约 2 年前
This is amazing! The Gods have sent me the perfect excuse to finally read all the rust ebooks I’ve been collecting! I have a toy project where certain functions are CPU-bound and would make for a perfect learning project. Very timely read!
victorbjorklund大约 2 年前
Elixir, rust and fly.io in the same post. HN bingo.
FpUser大约 2 年前
I remember MS reps coming to our offices in the 90s and &quot;Teaching&quot; us how to program and how it is cool to have one person writing GUI and the other &quot;guru&quot; writing high performance C++ to be used in critical parts.<p>I showed them a piece of software that was mighty fast, Internet enabled and GUI intensive. They liked the software but asked where did you get this particular screen control from. You&#x27;ve got to see their faces when told that the whole software was written by a single person in Delphi.
alberth大约 2 年前
Doesn&#x27;t the use of Rust have to be extremely minimal because ErlangVM has hard time limits on their preemptive scheduler and if your Rust code hasn&#x27;t finished when preempted, that causes lots of problems.<p>EDIT: thanks for pointing out where in the article this is talked about.
评论 #35560791 未加载
benatkin大约 2 年前
This makes me think of DotCloud, the precursor to Docker Inc. The idea that you can run anything has been around for a while. I don&#x27;t see how Fly.io is especially good for Elixir. It seems to be about delivering reliable resources for each service, and it works no matter the web framework, as long as you have a PaaS that&#x27;s geared towards running arbitrary OCI images. These posts seem a lot like the content on the DigitalOcean site, except they&#x27;re written by staffers instead of freelancers. <a href="https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;pages&#x2F;write-for-digitalocean" rel="nofollow">https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;pages&#x2F;write-for-digit...</a>
评论 #35562947 未加载
评论 #35562930 未加载
waynesonfire大约 2 年前
IO in erlang is slow, is Rustler a good candidate to improve IO intensive applications?
评论 #35560572 未加载
评论 #35560633 未加载
评论 #35562707 未加载
评论 #35561614 未加载