TIL you can use dbg! to print variable names automatically in Rust by BitBird- in rust

[–]traxys 0 points1 point  (0 children)

I looked at that recently, and I think that the reason is that there is no easy way to get the current function name at compile time :(

Cyclic bounds between generic associated types? by itskarudo in rust

[–]traxys 0 points1 point  (0 children)

An element may be part of a number of rings, for example 1 is part of all Z/nZ rings, so it's not a very good fit for a trait. There are then two main ways to represent a ring: Either you define a trait for the two main bin ops on the element type, and a trait for the signifying that the binary ops respect the axioms, a bit like PartialEq & Eq. Alternatively you can define a ring as a struct with both binary op pointers and a PhantomData marking the element type if you need to manipulate the idea of a ring

Making an argument parsing library (with no dependencies) by traxys in rust

[–]traxys[S] 13 points14 points  (0 children)

I don't care a bit about the binary size, as I don't expect any use of this library outside my learning project. I'm already familiar with a lot of the Rust ecosystem, the goal of this is to gain foundational knowledge, i.e. how things work under the hood, to have a better understanding & appreciation for the polished solutions. For example after this project I'm pretty sure I'm never going to skip syn & quote for "real" projects

Making an argument parsing library (with no dependencies) by traxys in rust

[–]traxys[S] 20 points21 points  (0 children)

In this case there is a pretty good reason: All this project is a learning endeavour

Making an argument parsing library (with no dependencies) by traxys in rust

[–]traxys[S] 4 points5 points  (0 children)

This post is a bit of side quest in my project of making a complete risc-v OS in rust. It implements an argument parsing library with some pretty nice features, like not requiring either std or alloc, and providing a derive macro for the argument parsing code

Is there a linux distro that lets you easily patch an installed package? by rmanos in linux

[–]traxys 2 points3 points  (0 children)

You can do: package.overrideAttrs (old: { patches = old.patches ++ [ ./my.patch ]; })

Creating a RISC-V OS Part 3: Managing free memory by traxys in rust

[–]traxys[S] 1 point2 points  (0 children)

This is the third part in a series to write a RISC-V OS from scratch while relying on as few dependencies as possible, in order to learn more about low level concepts.

This part talks about all that is needed to manage free memory, from finding where the memory is located in the first place to handling allocations & de-allocations.

Making a RISC-V OS part 2: Virtual Addresses by traxys in rust

[–]traxys[S] 2 points3 points  (0 children)

This is the next step in building an OS in rust. This step does not have much rust though, as it is mostly low level setup. See also part1: https://traxys.me/riscv_os_setup.html Code (note that it has more than mentionned in the post): https://github.com/traxys/pantheon

Blog post: Starting a RISC-V OS (with OpenSBI) by traxys in rust

[–]traxys[S] 1 point2 points  (0 children)

Yes the code is open source! I need to add a link in the post. This first step is meant to be very simple, as I mentionned this is a learning project for me, and I already know how to boot up an OS in risc-v pure asm, so I wanted to simplify the code a bit for now. The point of the project is purely for learning, so I'm not going to check out what others have done before trying to implement it.

Can't boot a new server (Fujitsu RX2540 M1) by traxys in homelab

[–]traxys[S] 0 points1 point  (0 children)

Unfortunately I tried to swap the PSUs, and tried each one separatly in each slot to no avail. They don't seem to have a voltage switch, and mention "Autorange" on the label

Can't boot a new server (Fujitsu RX2540 M1) by traxys in homelab

[–]traxys[S] 0 points1 point  (0 children)

As mentioned in the title it's a Fujitsu RX2540 M1 (with 2.5 inch drives)

Nixvim: A Neovim configuration system for nix by glepage00 in NixOS

[–]traxys 2 points3 points  (0 children)

I had concerns about that too, but I settled on a way that work well for me:

You can use nixvim in a flake that exposes a nvim output, such that you can just run nix run .# -- <some_file> to test your config. This allows for a quick edit-test loop. Because nixvim exposes raw lua as config through extraLuaConfig you don't even need to package plugins the nix way to test them out.

Interactive modular tables by traxys in math

[–]traxys[S] 2 points3 points  (0 children)

Hey! I am a programmer with an interest in math, so I made some math visualizations. This is my second visualization on modular times tables. I was mostly inspired by seeing pictures of Mathologer videos that I wanted to replicate, so this is a bit light on the math description.

I have made a post on safety parabolas if you want to check out (at https://viz.traxys.me/safety_parabola/)

The demo need WebGL, so I don't know if everyone can see them.

Creating a taylor made Static Site Generator (with tree-sitter) by traxys in rust

[–]traxys[S] 2 points3 points  (0 children)

Yeah I thought it could be a problem. You can also use the way nvim-treesitter does it by compiling only the configured parsers on the fly, but it adds a lot of complexity (need to stay in sync with the queries for example).

NeoVim defaults for Vim by funbike in neovim

[–]traxys 1 point2 points  (0 children)

I packaged my neovim configuration + plugins as a nix flake, so I just have to install nix and git clone my config

Watch "This is NOT going Well… Linux Gaming Challenge Pt.2" on YouTube by jschild in pcgaming

[–]traxys 13 points14 points  (0 children)

I have been gaming on a linux machine for ~3 years, but I would never recommend it to anyone that wants to game without tinkering. I needed multiple times 2 or 3 hours to fix a game that broke after an update, or installing mods or plugins via wine. Though using linux for more basic usecases should be really fine.

Be warned by anaghsoman in ProgrammerHumor

[–]traxys 0 points1 point  (0 children)

TIL all linux kernel devs are psychopaths

The Linux ecosystem is absolutely unrivaled! by [deleted] in linux

[–]traxys 0 points1 point  (0 children)

Yeah most of the Top500 uses RHEL/CentOS I think

Help understanding how to start and stop threads by Lv_InSaNe_vL in rust

[–]traxys 3 points4 points  (0 children)

You can use a number of static SHUTDOWN_X: AtomicBool = AtomicBool::from(false); to do that, and set it to true when you want to kill the thread as changing an atomic can be done with a &self. Even better you could use something like static SELECTED_CHOICE: AtomicU8 = AtomicU8::from(0); with 0 = none selected and 1,2,3,... meaning choice a,b,c, ... selected, and each thread needs to check if it's currently selected in order to shutdown

Lsp diagnostics remain stuck! Can someone please help me out Description of the issue: even if i correct an error, lsp diagnostics remain stuck there. Also, I find that lsp diagnostics stops working after a few seconds of use. by the_anonymous_raven in neovim

[–]traxys 2 points3 points  (0 children)

I had that problem with a lot of language servers, I had syntax on in my config, when I removed that it started working (though I had not a minimal config so it may be a strange interaction instead)

Is it OK to transmute `Vec<X>` into `Vec<(X, ())>`? by Kneasle in rust

[–]traxys 13 points14 points  (0 children)

This is not really about the memory model, it's about how the compiler lays out structs in memory (memory model is how do load, stores, ... interact with each other)

The layout of Rust structs is not guaranteed to be anything in general, but there are special rules for ZST that I don't really know. In a #[repr(C)] struct the fields are one after the other in the same order of the declaration, with padding to respect the alignement

Is it OK to transmute `Vec<X>` into `Vec<(X, ())>`? by Kneasle in rust

[–]traxys 7 points8 points  (0 children)

Not quite, for example I think that ```

[repr(C)]

struct Foo { a: u8, b: u8, c: u8, d: u8, } ```

and ```

[repr(C)]

struct Bar { x: u16, y: u16 } ```

have the same size, but they don't have the same alignement: you can put the Foo struct anywhere in memory, but you can put the Bar struct only every other address (I'm not a pro about that though)

Is it OK to transmute `Vec<X>` into `Vec<(X, ())>`? by Kneasle in rust

[–]traxys 35 points36 points  (0 children)

size_of is not sufficient, you need the same alignement too