Rust Lang

Welcome all Reddit refugees, rustaceans and everyone else. Let's keep it civil and check out the fediverse together!

56
9

JFC. When will open source projects like [@rustlang](https://lemmyrs.org/c/rustlang) learn that putting toxic people like this in positions of ANY authority is unacceptable. [https://github.com/marshallpierce/rust-base64/issues/213](https://github.com/marshallpierce/rust-base64/issues/213) . He's showing you who he is, and you're not listening.

-8
10
youtu.be

[Transcript](https://youtubetranscript.com/?v=sfFQrhajs6o) \ [Piped](https://piped.kavin.rocks/watch?v=sfFQrhajs6o?si=uQOMf7-pwKx6w6pu)

9
1

[https://crates.io/crates/syslog-ng-common/0.7.0](https://crates.io/crates/syslog-ng-common/0.7.0) The colleague, who added [@rustlang](https://lemmyrs.org/c/rustlang) support to [#syslog\_ng](https://fosstodon.org/tags/syslog_ng) left many years ago. Syslog-ng [#Rust](https://fosstodon.org/tags/Rust) support was last touched 7 years ago. Still, there are regular downloads. Just [#searchengines](https://fosstodon.org/tags/searchengines) or there are real users? Does it actually work?

2
0

I'm working on a cli for a service I've made that maintains a node edge graph (think neo4j type thing). I want to be able to display a graph in the terminal in a sort of ascii art text form kinda like git log -graph. I haven't found any third part libraries that can do that and am looking for help.

9
2
https://blog.erlend.sh/transitioning-r-rust-to-the-threadiverse

Cross-posted to Reddit: https://www.reddit.com/r/rust/comments/162keij/transitioning_rrust_to_the_threadiverse/

84
15
https://github.com/serde-rs/serde/releases/tag/v1.0.184

From the release notes > Restore from-source serde_derive build on all platforms — eventually we'd like to use a first-class precompiled macro if such a thing becomes supported by cargo / crates.io

72
1
https://github.com/serde-rs/serde/issues/2538

`serde_derive` now ships a precompiled binary. This made a lot of people angry. The crate maintainer finally locked the issue.

68
11

I recently ran into an issue where I wanted to use `Any` for slices. However, it only allows `'static` types (based on what I read, this is because you get the same `TypeId` regardless of lifetimes). I came up with this workaround which I _think_ is safe: ```rust use std::{ any::{Any, TypeId}, marker::PhantomData, }; #[derive(Clone, Debug)] pub struct AnySlice<'a> { tid: TypeId, len: usize, ptr: *const (), marker: PhantomData<&'a ()>, } impl<'a> AnySlice<'a> { pub fn from_slice(s: &'a [T]) -> Self { Self { len: s.len(), ptr: s.as_ptr() as *const (), tid: TypeId::of::(), marker: PhantomData, } } pub fn as_slice(&self) -> Option<&'a [T]> { if TypeId::of::() != self.tid { return None; } Some(unsafe { std::slice::from_raw_parts(self.ptr as *const T, self.len) }) } pub fn is(&self) -> bool { TypeId::of::() == self.tid } } ``` *edit: Unfortunately it seems like Lemmy insists on mangling the code block. See the playground link below.* `T: Any` ensures `T` is also `'static`. The lifetime is preserved with `PhantomData`. Here's a playground link with some simple tests and a mut version: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3116a404c28317c46dbba6ed6824c8a9 It seems to pass Miri, including the mut version (which requires a bit more care to ensure there can only be one mutable reference). Any problems with doing this?

19
8
https://users.rust-lang.org/t/new-features-on-lib-rs/98560

cross-posted from: https://programming.dev/post/1825728 > Lots of new features! > > Thought I should share this with those who don't use users.rust-lang.org. Note: I'm not affiliated with lib.rs, I'm only reposting to lemmy.

17
6
https://github.com/davidlattimore/cackle

> Cackle is a tool to analyse the transitive dependencies of your crate to see what kinds of APIs each crate uses. > The idea is look for crates that are using APIs that you don't think they should be using. For example a crate that from its description should just be doing some data processing, but is actually using network APIs.

17
5
https://github.com/Mubelotix/admarus

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

14
3
https://gitlab.com/lib.rs/main/-/tree/main

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.

51
36

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?

1
2

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.

7
7
https://archive.org/details/softwarelibrary_flash

[Ruffle](https://ruffle.rs/), a Flash Player emulator built in Rust, is being used on archive.org to allow modern browsers access to classics like [n](https://archive.org/details/nv-12), [All Your Base](https://archive.org/details/flash_allyourbase), [Weebl and Bob](https://archive.org/details/softwarelibrary_flash_weebl), [Strong Bag Emails](https://archive.org/details/softwarelibrary_flash_strongbad), [Happy Tree Friends](https://archive.org/details/softwarelibrary_flash_htf) and many more. [Jason Scott writes](https://defcon.social/@textfiles@mastodon.archive.org/110697897061396294): > 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.

15
0
https://blog.rust-lang.org/2023/07/13/Rust-1.71.0.html

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

50
0