Aggregate git blame stats across any git repository. Find out top contributors by Lines of Code. - martinn/repoblame
I've always been curious about this. If I were to take a snapshot of a git repo at a particular point in time, who would be the top contributors by active lines of code? And then, what type of files have they contributed the most? So I built this little tool.
I've been wanting to learn rust for quite some time now and this was one of my first projects in it. It was a lot of fun!
It uses git under the hood to obtain the information and it's nothing fancy, but keen to hear what you think.
I want to develop a plugin system within my program, and I have a trait that functions defined by plugins should implement.
Currently, my code gets all the functions in a HashMap and then calls them by their name. Problem is, I have to create that hashmap myself by inserting every function myself.
I would really appreciate it if there was a way to say, suppose, all pub members of mod functions:: that implement this trait PluginFunction call register(hashmap) function. So as I add more functions as mod in functions it'll be automatically added on compile.
Hey all, just sharing a small, single-page site I built using Leptos + TailwindCSS, mainly intended as a demo for an API I built using Axum. Hope someone also finds it interesting!
I'm sharing this site and not the API itself cause I figure it's easier to look at and understand, but if you want to roast some code I would appreciate any feedback you have on the API itself (repo here). Trying to leave the front end developer scene so this is the first API I've tried building, fairly basic but it was fun (I am a big Civ V fan - I hear it's inspired by some niche thing called human history?).
Edit: whoops, looks like the link didn't get set cause I put an image - the site is available here, and the repo for it is here. The live API is available here
In case you haven't seen it, here's a talk regarding Rust's integration into the Linux filesystem that gets completely derailed at The Linux Storage, Filesystem, Memory Management and BPF Summit.
After reading Drew's pitch to the rust community to write our own kernel,
I've searched for "linux abi compatible rust kernel" and found "Asterinas". Surprised that it is not mentioned here
Async Rust is powerful. And it can be a pain to work with (and learn). Async Rust can be a pleasure to work with, though, if we can do it without `Send + Sync + 'static`.
So I'm trying to parse school's website for some info. I'm trying to get some values using xpath. So I found a html 5 parser and it can't properly parse the first line. Then I figure you it's actually XHTML and not HTML. After quick Google search I found out XHTML can be properly parsed using any XML parser and so I found one and... It can't parse the first line. So I ask LLama3.1 (like a real programmer) why I can't parse the first line with any parser. It explained so nicely that I did not destroy my keyboard when I was told that this document is "XHTML 1.0 Transitional" and it's a mix of HTML 4 and XHTML and can't be parsed with HTML nor XML parser. I hate the guy that invented that so much...
So I can't find a crate to parse XHTML 1.0 transitional? Or a crate to convert xhtml to something else? Any advice?
Cutting the 0.12.0 release as-is!
You may need to:
rearrange some imports
sed some types to use pg_sys::EnumName::Type (only the typedef, not the constants)
bump heapless to 0.8
impl ArgAbi and im...
I'd like to know if anyone has succesfully flashed a board using their own FTDI chip and not a commercial debug probe.
I want to get into using Rust and I have these STM-based boards where I put an FTDI chip on them so I get a convenient USB-port for power and debug and flashing. I'd really like to get some Rust-software running but I've just hit walls so far with flashing the boards. They work fine when using platformio/openocd and C++ but nothing has worked so far for using "cargo embed" even though it seems to find the FTDI chip correctly and start flashing but then times out.
I'd love to know if anyone has a similar setup working or can give tips on what I could try.
We’re excited to announce wildcard support across our Ruleset Engine-based products and our open-source wildcard crate in Rust. Configuring rules has never been easier, with powerful pattern matching enabling simple and flexible URL redirects and beyond for users on all plans
A local-first, encrypted, note taking application organized in tree-like structures
cross-posted from: https://programming.dev/post/18265389
>Hello again everyone, Dihar here. It's been a while since the last release of treedome, but here you go! This release is all about UI update, emojis, and bug fixes. Please consult this git diff for a more detailed changelog https://codeberg.org/solver-orgz/treedome/compare/0.4.5...0.5.0. These are the highlight of the release.
>
> !
>
> * Add emoji picker for title, will show up in tree!
> * Text Editor toolbar is back, now with option to toggle both toolbar and floating menu independently!
> * Checkbox is here! Thanks Mantine UI!
> * You can check the size of each notes by navigating to Escape Menu -> Configure -> Show Note Sizes!
> * Add created/last modified date in notes. Note created before this will not have this field and will set as today's date!
> * Create child note can now be done through dropdown instead of only from shortcuts!
> * Fix bugs of saving empty tree
> * General UI update and more stability for auto scrolling in tree view
> * Documentation update
I wrote a quick blog post about a pattern I discovered while building TUI applications in Rust. It's a bit unrefined, and I'm working on package to help make the pattern easier. Let me know what you think!
I was developing a game and an engine in Rust, so I was reading many articles, most of which criticize the 'borrow checker'.
I know that Rust is a big agenda language, and the extreme 'borrow checker' shows that, but if it weren't for the checker, Rust would be a straight-up better C++ for Game development, so I thought: "Why not just use unsafe?", but the truth is: unsafe is not ergonomic, and so is Refcell<T> so after thinking for a bit, I came up with this pattern:
let mut enemies = if cfg!(debug_assertions) { // We use `expect()` in debug mode as a layer of safety in order // to detect any possibility of undefined bahavior. enemies.expect("*message*"); } else { // SAFETY: The `if` statement (if self.body.overlaps...) must // run only once, and it is the only thing that can make // `self.enemies == None`. unsafe { enemies.unwrap_unchecked() } };
You can also use the same pattern to create a RefCell<T> clone that only does its checks in 'debug' mode, but I didn't test that; it's too much of an investment until I get feedback for the idea.
This has several benefits:
1 - No performance drawbacks, the compiler optimizes away the if statement if opt-level is 1 or more. (source: Compiler Explorer)
2 - It's as safe as expect() for all practical use cases, since you'll run the game in debug mode 1000s of times, and you'll know it doesn't produce Undefined Behavior If it doesn't crash.
You can also wrap it in a "safe" API for convenience:
```
// The 'U' stands for 'unsafe'.
pub trait UnwrapUExt {
type Target;
fn unwrap_u(self) -> Self::Target;
}
impl<T> UnwrapUExt for Option<T> {
type Target = T;
I imagine you can do many cool things with these probably-safe APIs, an example of which is macroquad's possibly unsound usage of get_context() to acquire a static mut variable.
Game development is a risky business, and while borrow-checking by default is nice, just like immutability-by-default, we shouldn't feel bad about disabling it, as forcing it upon ourselves is like forcing immutability, just like Haskell does, and while it has 100% side-effect safety, you don't use much software that's written in Haskell, do you?
Conclusion: we shouldn't fear unsafe even when it's probably unsafe, and we must remember that we're programming a computer, a machine built upon chaotic mutable state, and that our languages are but an abstraction around assembly.
historical archive of rust pre-publication development - graydon/rust-prehistory
Excerpt:
> This is a reconstruction -- extracted and very lightly edited -- of the "prehistory" of Rust development, when it was a personal project between 2006-2009 and, after late 2009, a Mozilla project conducted in private.
>
> The purposes of publishing this now are:
>
> - It might encourage someone with a hobby project to persevere
> - It might be of interest to language or CS researchers someday
> - It might settle some arguments / disputed historical claims
Rust started being developed 18 years ago. This is how it looked until 14 years ago, where I believe the rest of development is on rust-lang/rust. The first Rust program looks completely different than the Rust we know today.
Sometimes you just really need an arena. Sometimes for performance reasons, other times for lifetime-related reasons.
In their most basic forms, they're just a vec with some extra guarantees. However, it's those extra guarantees that matter.
I've found myself looking for the right kind of arena too ...
Fixes #75341.
Take 2 at #123974. It should now be much simpler to review since it's based on #125798.
I split the changes as much as possible to make it as easy as possible to review (even thou...
Hey there, I'm currently learning Rust (coming from object-oriented and also to some degree functional languages like Kotlin) and have some trouble how to design my software in a Rust-like way. I'm hoping someone could help me out with an explanation here :-)
I just started reading the book in order to get an overview of the language as well.
In OOP languages, I frequently use design patterns such as the Strategy pattern to model interchangeable pieces of logic.
How do I model this in Rust?
My current approach would be to define a trait and write different implementations of it. I would then pass around a boxed trait object (Box<dyn MyTrait>). I often find myself trying to combine this with some poor man's manual dependency injection.
This approach feels very object oriented and not native to the language. Would this be the recommended way of doing things or is there a better approach to take in Rust?
Discover how the Rust compiler optimizes dynamically dispatched tail calls and manages memory when using trait objects in this in-depth tutorial. Gain a deeper understanding of how vtables and the Rust memory model work together to improve the performance of your code.
EventHelix writes:
> This article will investigate how Rust handles dynamic dispatch using trait objects and vtables. We will also explore how the Rust compiler can sometimes optimize tail calls in the context of dynamic dispatch. Finally, we will examine how the vtable facilitates freeing memory when using trait objects wrapped in a Box.
Maybe a little weird question but do you maybe know a smart watch that can run rust? I got running Egui on my Galaxy Watch 4 with WearOS and I'm thinking if any other watch (other than Galaxy and Pixel) can do that?