26
18
This Week in Rust 505 (this-week-in-rust.org)
submitted 11 months ago by Mr_Figtree@kbin.social to c/rustlang@lemmyrs.org
27
25
submitted 11 months ago by runiq@feddit.de to c/rustlang@lemmyrs.org
28
16
submitted 11 months ago by kornel@lemmyrs.org to c/rustlang@lemmyrs.org
29
14
submitted 11 months ago by Mubelotix@jlai.lu to c/rustlang@lemmyrs.org

I’ve been working on a new search engine system that’s fully peer-to-peer, with no trusted third party.

The goal is the index IPFS, a torrent-like file sharing system for all kinds of media

It's written in Rust using libp2p. There is a daemon but it will eventually run in the browser with wasm

30
52
submitted 11 months ago by manpacket@lemmyrs.org to c/rustlang@lemmyrs.org

Previously: https://lemmyrs.org/post/175672

I originally had sources and data of the site public, hoping they would be interesting to study, aid in bug reporting, bring contributions, and make site's algorithms transparent.

Instead, I got knee-jerk reactions about lines of code taken out of context. I got angry dogpiles from the Rust community, including rust-lang org members. I don't need to endure such mudslinging. Therefore, the sources are no longer available.

As of right now bitcoin crate is not deprecated, instead libs.rs responds with error 502.

31
3
submitted 11 months ago by djtech@lemmy.world to c/rustlang@lemmyrs.org

crosspostato da: https://lemmy.world/post/1916287

Hi everybody, I'm new to Rust.

So, I have a struct Panel which contains a data widget which implements the trait Widget I have to implement a function for Panel that uses another function that requires a type that implements Widget.

I tried Box<T>, Rc<T>, Box<dyn Widget, &T, but nothing, always compiler errors.

How can I fix this?

32
23
This Week in Rust 504 (this-week-in-rust.org)
submitted 11 months ago by Deebster@lemmyrs.org to c/rustlang@lemmyrs.org
33
19
34
16
Rust’s Runtime (blog.mgattozzi.dev)
35
9
submitted 11 months ago by djtech@lemmy.world to c/rustlang@lemmyrs.org

Hi, I Just started working on a Emacs-inspired text editor in Rust.

Being insipred by Emacs, the most important part Is the possibiliy to implement new components.

My ideas were:

  • Rust-based scripting language, like Rhai
  • RustPython (slower, but more compatible and lots of people know Python)
  • PyO3 (Bigger executable and not that fast)
  • Wasm/Wasi (Cross-platform, but I don't know if the compatibility with Rust's hosted functions and structs is good)
  • Other binded language, like V8, Lua or SpiderMonkey
  • Compiled plugins, like .so or .DLL (Fast, but not compatible; there should be Rust plugin frameworks for implementing this, but I don't remember the name)

The elements to analyze are: speednees (consider it's a text editor, so...), easy-to-develop and Cross-platform (if possible, not that important), but the possibility to execute functions in the host Rust program is EXTREMELY important.

Thoughts?

Thanks in Advance.

36
7
How Functions Function (www.youtube.com)
submitted 11 months ago by barsoap@lemm.ee to c/rustlang@lemmyrs.org
37
15
submitted 11 months ago by Deebster@lemmyrs.org to c/rustlang@lemmyrs.org

Ruffle, a Flash Player emulator built in Rust, is being used on archive.org to allow modern browsers access to classics like n, All Your Base, Weebl and Bob, Strong Bag Emails, Happy Tree Friends and many more.

Jason Scott writes:

Thanks to efforts by volunteers Nosamu and bai0, the Internet Archive's flash emulation just jumped generations ahead.

Mute/Unmute works. The screen resizes based on the actual animation's information. And for a certain group who will flip their lid:

We can do multi-swf flash now!

A pile of previously "broken" flashes will join the collection this week.

38
11
submitted 11 months ago by tomtau@lemmyrs.org to c/rustlang@lemmyrs.org
39
53
submitted 11 months ago by Mr_Figtree@kbin.social to c/rustlang@lemmyrs.org

The Rust team is happy to announce a new version of Rust, 1.71.0. Rust is a programming language empowering everyone to build reliable and efficient software.

What's in 1.71.0 stable

  • C-unwind ABI
  • Debugger visualization attributes
  • raw-dylib linking
  • Upgrade to musl 1.2
  • Const-initialized thread locals
40
7
submitted 11 months ago by manpacket@lemmyrs.org to c/rustlang@lemmyrs.org

If you have a workspace with dependencies you probably noticed that sometimes cargo seemingly unnecessary recompile external dependencies as you switch between different members of your workspace.

This is caused by something called feature unification ([1]). Since features by design should be additive only cargo tries to avoid redundant work by using a superset of all required features. Problem comes when there are multiple crates in the workspace require external dependencies with different set of features. When you are working with the workspace as a whole - unified features include all the dependencies, when you target a single crate - unified features will include only features of that crate's dependencies.

What's worse - if you are using nix with crate2nix to manage dependencies - you'll get no feature unification at all and every dependency with each unique combination of features is considered a separate dependency so the same crate can be compiled (and linked in) multiple times - I've seen 20+ copies of a single crate.

Unless there are special requirements it is better to make sure that all the external dependencies have exact same set of features enabled across the workspace. One option is to do it by hand manually editing Cargo.toml files for individual dependencies or with inherited workspace dependencies. As with anything manual - it would be error prone.

That's where cargo-hackerman comes in. It can check if there are feature unification issues in the workspace so you can run it in CI if you want to do it manually or it can apply the smallest possible hack by itself (and remove it later).

This is not a new crate, we've been using it in production with a large workspace for over a year now.

In addition to feature unification it can help with some other compilation time things giving easy answers to questions like :

  • are there any duplicate dependencies in my workspace?
  • why is this dependency or feature on dependency is required?
  • what are all the dependencies of this crate?
  • where is the repository of this crate?

With updated bpaf documentation on https://crates.io/crates/cargo-hackerman should be always up to date and cli - a bit more user friendly

41
10
This Week in Rust 503 (this-week-in-rust.org)
submitted 11 months ago by Deebster@lemmyrs.org to c/rustlang@lemmyrs.org
42
19

Rust offers advantages in reliability and security over traditional programs written in C/C++. This preview shipped with an early implementation of critical kernel features in safe Rust. Specifically, win32kbase_rs.sys contains a new implementation of GDI region. While this is a small trial, we will continue to increase the usage of Rust in the kernel. Stay tuned!

43
6
submitted 11 months ago* (last edited 11 months ago) by RoundSparrow@lemmy.ml to c/rustlang@lemmyrs.org

I need some help here trying to add a second logging subscriber for a specific target to the Lemmy server Rust code.

Here is the default logging in the app: https://github.com/LemmyNet/lemmy/blob/main/src/lib.rs

Step 1 ==============
I know I have to add another library to log to a file.
cargo add tracing-appender

Step 2 ===============
I know I have to specify how I want the files to work, I found this pile of code:

  let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
  let formatting_layer = fmt::layer().pretty().with_writer(std::io::stderr);
  let log_file_name = Local::now().format("%Y-%m-%d").to_string() + "-apub.log";
  let file_appender = rolling::daily("/home/lemmy/logs", log_file_name);
  let (non_blocking_appender, _guard) = non_blocking(file_appender);
  let file_layer = fmt::layer()
      .with_ansi(false)
      .with_writer(non_blocking_appender);

  Registry::default()
      .with(env_filter)
      .with(ErrorLayer::default())
      .with(formatting_layer)
      .with(file_layer)
      .init();

Now this isn't right, because it registers itself as "default", and I want it to be a Target - and I still want the normal Lemmy logging behavior to exist.

I want the macros to work like:

warn!("this is how normal Lemmy server log entries are created in the current code");  
warn!(target: "apubfile", "this logging entry only goes to the apub file logging using tracing-appender);

Can someone work this out? How to have two subscribers, not just the single default, and how to specify the target: string on the subscriber?

Thank you.

EDIT: ok, I found an example of how to have two logs at the same time, one to file and one to console: https://stackoverflow.com/questions/76042603/how-to-unify-the-time-in-the-console-and-the-file-when-using-tracing-appender -- I still need to figure out how to get this into Lemmy's structure and attach to a "target".

44
20
45
27
Bevy 0.11 (bevyengine.org)
submitted 11 months ago by HeavyRust@lemm.ee to c/rustlang@lemmyrs.org
46
9
submitted 1 year ago* (last edited 1 year ago) by RoundSparrow@lemmy.ml to c/rustlang@lemmyrs.org

I don't know Rust, but trying to hack on Lemmy 0.18.1 enough to get a better error message out.

error: data did not match any variant of untagged enum AnnouncableActivities

where: crates/apub/src/activities/community/announce.rs, line: 46

https://github.com/LemmyNet/lemmy/blob/0c82f4e66065b5772fede010a879d327135dbb1e/crates/apub/src/activities/community/announce.rs#L46

That seems to be the function parameters themselves?

Is the error caused by RawAnnouncableActivities not matching the enum AnnouncableActivities and the try_into?

  warn!("zebratrace receive {:?}", self);

Works for adding logging, but I'd like the code to log self only when the enum does not match (errors). Thank you.

47
16
submitted 1 year ago by njaard@lemmy.world to c/rustlang@lemmyrs.org
48
4

What do you think about this kind of indication for conflicting or otherwise invalid arguments?

With command line arguments being 1D and line length valid up to hundreds of kilobytes only inline indication seems to work.

Would you change anything?

49
4
This Week in Rust 502 (this-week-in-rust.org)
50
3
submitted 1 year ago by xhci@lemmy.world to c/rustlang@lemmyrs.org

I’m just starting to learn Rust, and was wondering if there is a good way to do coroutines/channels. I’ve grown fond of languages based around CSP, but am not sure that maps well to idiomatic Rust.

Thanks in advance!

view more: ‹ prev next ›

Rust Lang

3 readers
1 users here now

Rules [Developing]

Observe our code of conduct

Constructive criticism only

No endless relitigation

No low-effort content

No memes or image macros

No NSFW Content

founded 1 year ago
MODERATORS