Search

Items tagged with: rust


🦀 It's not ready for an official announcement yet, but we're working on a small DB-backed worker queue in Rust.

github.com/mre/workers

It's a recurring ask from clients, and I couldn't find anything "production ready" out there.

It's built on top of crates.io's queue. We moved to sqlx (from diesel) as well.

Can we get some eyeballs on it? Feel free to comment here and/or create an issue. A retoot and a ⭐ would also help, of course... 😉

#rustlang #rust #workqueue


Who would like Rust in CPython 3.15?

@emmatyping and Kirill Podoprigora "propose introducing the Rust programming language to CPython. Rust will initially only be allowed for writing optional extension modules, but eventually will become a required dependency of CPython and allowed to be used throughout the CPython code base."

discuss.python.org/t/pre-pep-r…

#Python #Python315 #CPython #Rust




Here's a proof-of-concept example of a Delta.Chat bot for .NET

It's pretty basic, especially since I can't get #open-rpc-generator to generate #csharp code, seems to be limited to #rust and #typescript

To use it, follow the `import` instructions and provide your own implementation of `IMessageProcessor`.

#deltachat

github.com/timothyparez/deltac…



@Federico Mena Quintero I've figured it out finally. The issue was not parsing ipv4 addresses but using matches.from_os() on the socket argument.
I have changed it to use std::path::PathBuf and it's working fine for me now.
Huge thanks for friendly hint and looking at my code.


@Federico Mena Quintero Oh, huge thanks for taking a look. Yes it's clap 3. It's not my decision, I'm attempting to contribute to an existing project so if I can make it work without major changes that might be helpfull. As I don't feel qualified for making decisions when it comes to this. I'm novice when it comes to #rust.
--socket argument is required, other two arguments are supposed to be used together and this condition is tested at runtime.
So if I specify all three command line arguments, I am always getting that error.
I have attempted using os::str and casting but the issue remains. I am simply compiling the app with cargo build --release.
Have you been just adding stuff I may have overlooked when trying to simplify for posting or did you actually changed something please?


I'd like to parse ipv4 addresses given as command line argument values.
I have got two arguments accepting ipv4 address.
If I specify single such option all is fine.
If I specify both, I 'm getting error like this:

thread 'main' (624061) panicked at /home/peto/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/clap-3.2.25/src/parser/matches/arg_matches.rs:1879:13:
Must use `Arg::allow_invalid_utf8` with `_os` lookups at `[hash: A8F400C40154F09]`

This is simplified version of my code showcasing the issue:
```
use std::net::{IpAddr, Ipv4Addr};
use clap::{App, AppSettings, Arg, value_parser};

#[tokio::main]
async fn main() -> Result<(), Error> {
let mut app = App::new("Server APP")
.about("My super cool app")
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandsNegateReqs)
.arg(
Arg::with_name("socket")
.required(true)
.takes_value(true)
.long("socket")
.help("Unix socket path"),
)
.arg(
Arg::with_name("relayaddress")
.required(false)
.takes_value(true)
.long("relay-address")
.value_parser(value_parser!(Ipv4Addr))
.help("External relay ipv4 address used together with --listen-address to run behind a nat"),
)
.arg(
Arg::with_name("listenaddress")
.required(false)
.takes_value(true)
.long("listen-address")
.value_parser(value_parser!(Ipv4Addr))
.help("Local listen ipv4 address used together with --relay-address to run behind a nat"),
);
let matches = app.clone().get_matches();
if matches.is_present("relayaddress") & matches.is_present("listenaddress") {
let external_ip = IpAddr::V4(matches.get_one::<Ipv4Addr>("relayaddress").expect("Invalid address"));
let local_ip = IpAddr::V4(
matches.get_one::<Ipv4Addr>("listenaddress").expect("Invalid address"));
println!("Listening on local IP: {local_ip}");
println!("Relaying through external IP: {external_ip}");
}}
```

#rust #rustlang #programming #fedihelp


#rust


#rust



This weekend project (yes, another one instead of finishing the 100 others) is a #fastcgi handler to implement xep-0070, alnowing to use an #xmpp account to log in to a website. Writing it in #rust as a learning exercise.

I hope to replace "login with google" and the other things I had to add to my website ovwr the years in order to not store people's passwords. This should allow to do it in a decentralized way without forcing any specific provider.


Wanted: a #RustLang tool with 4 panes:
- desired generated code
- an in progress proc-macro being written
- input #Rust code where the proc-macro is being applied
- a live updating view of the actual generated code with diff annotations against what was desired

If you want to go fancier, tie things in the output to the input and provide suggestions on where things are missing pre-expansion for the output to march the expectation. I feel like 90% of this can be accomplished today with tmux+a file watcher+direct rustc invocations using -Zunpretty=expanded, but it'd be lovely to have an actual tool for this.


I used to use #OCaml quite a bit, though that was a number of years ago, and I use #Rust a lot now.

One of my main gripes about OCaml is how it wasn't very practical in some ways. There was no way to open a file read/write (very common for, say, databases), and because it lacked things like Haskel's typeclasses or Rust's traits, you'd use different functions to seek on a file opened for input vs. one for output.

Looks like it's still the same.


Les quería presumir mi tapete de #Rust hecho con telar de pedal.
#rust



I am slowly oxidizing my unix CLI. A lot of people have made rust based versions of common unix utilities and some of them are REALLY good.

Like fd-find for doing essentially find . -name blah. And rg (ripgrep) which does grep -R but it's aware of git, files like pyc or .bak files, and it excludes them by default.

Now I have sd which is hopefully replacing the last thing I used perl for. I write perl -pi -e s/x/y/g a lot. Just doing a quick string replace inside a file. So sd can start doing that.

I'm also trying to get used to zellij instead of tmux and starship for modern prompt decorations like the kids do.

These kids, my friends, are welcome on my lawn.

#rust #cli #linux







🦀 Flattening #Rust's Learning Curve | corrode

「 Your learning pace doesn’t have much to do with whether you’re smart or not or if you have a lot of programming experience. Instead, what matters more is your attitude toward the language.

I have seen junior devs excel at Rust with no prior training and senior engineers struggle for weeks/months or even give up entirely. Leave your hubris at home 」

corrode.dev/blog/flattening-ru…

#rust





new security milestone reached: #chatmail relay servers are hardened to only transfer end-to-end encrypted e-mail with metadata minimization. No cleartext message can enter or leave the secure chatmail network anymore.

We now talk about "chatmail relays" rather than servers as they only ephemerally store messages until delivery. Dirt cheap to run.

We opened up our #rust "chatmail core" infrastructure library and set up an overview of the community driven ecosystem ...

chatmail.at



Long shot but worth it. I think I may have found my blocker for using #NixOS on my laptop/dev machines and am looking for help.

In short, I have multiple #Rust projects that build on the CLI just fine but not in VS Code/Rust Analyzer. I didn't spot this until very recently when I realized problems in my own code weren't being highlighted but compiled crates worked just fine.

Seems RA can't find some libraries but to the best of my abilities I've made those libraries available to the shell. I also launch code . from the terminal so it should have the environment set up correctly without need for Nix-specific extensions.

It's been suggested I not use the code-fhs Nix package, but that means starting from scratch and fixing existing extensions which work.

Please don't suggest abandoning VS Code or substantially changing my accessible workflows unless you also have 12 extra hours per day for me. Also please don't suggest abandoning Linux entirely--this issue is NixOS, not Linux.

More context: discourse.nixos.org/t/rust-pro…


Wow. #Rust is an unserious language. Unless you bend over backwards to fight the compiler and avoid the standard library, you cannot write code that doesn't try to terminate the calling process on arbitrary error conditions. news.ycombinator.com/item?id=4…

Terminating the process is never an appropriate action in a library. The library has no way to know its caller's uptime constraints. Libraries should only return error codes to callers. Only applications can decide whether to bail out or not.

#rust