showing posts tagged #rust — clear

0

Announcing Rust 1.100.0 | Rust Blog

Announcing Rust 1.100.0 | Rust Blog blog.rust-lang.org
preview

What’s in 1.100.0 stable

  • Never type
  • Allocator API
  • DropGuard API
  • Conjuring zero-sized types
  • Reporting unused dependencies in Cargo
  • Reducing Cargo cache collisions
  • Cargo min-publish-age
  • Stabilized APIs

What’s in 1.100.0 stable

  • Never type
  • Allocator API
  • DropGuard API
  • Conjuring zero-sized types
  • Reporting unused dependencies in Cargo
  • Reducing Cargo cache collisions
  • Cargo min-publish-age
  • Stabilized APIs
0

TIL a single rust crate is truly a single rust crate in the crates repository as well.

preview

The title seems obvious. I’ve been developing a tool that I intended to publish as a single crate at crates.io. Internally, the repository had a few crates and I had assumed this is just an implementation detail, and that I would still be able to deploy it as a single crate, where the internal dependencies are bundled.

When I had trouble packaging the thing, I asked someone on discord and they explained to me (thanks!) that actually I needed to merge my crates into one 💀

I wish I knew this earlier, now I think that adding cargo package to Ci in early stages of development really is a good idea.

The title seems obvious. I’ve been developing a tool that I intended to publish as a single crate at crates.io. Internally, the repository had a few crates and I had assumed this is just an implementation detail, and that I would still be able to deploy it as a single crate, where the internal dependencies are bundled.

When I had trouble packaging the thing, I asked someone on discord and they explained to me (thanks!) that actually I needed to merge my crates into one 💀

I wish I knew this earlier, now I think that adding cargo package to Ci in early stages of development really is a good idea.

0

mpris-lyrics a simple Linux CLI that displays synced lyrics from the MPRIS xesam:asText property

mpris-lyrics a simple Linux CLI that displays synced lyrics from the MPRIS xesam:asText property
preview

cross-posted from: piefed.zip/…/mpris-lyrics-a-simple-linux-cli-that…

So yeah, as the probably unnecessarily long title says, this is a CLI that displays the current playing lyrics, but instead of trying to go online and fetch a match it just uses the already there xesam:asText property in MPRIS.

Sadly a lot of popular players that implement the MPRIS2 standard still don’t implement that specific one, so it wont work with them. Even the one used in the showcase had to be modified, tho I am hopefully gonna upstream it soon.

I am very strict about AI usage, so for this project the only hint of AI that was used was for tab auto completion that is just used for boilerplate like, idk, implementing the Default trait for PlayerState (not including the actual tricky metadata_last_updated part). Safe to say it was only one notch above no AI at all.

So yeah, here you go give it a try and feel free to roast me, after all this is my first cli and cargo publish ;)

cross-posted from: piefed.zip/…/mpris-lyrics-a-simple-linux-cli-that…

So yeah, as the probably unnecessarily long title says, this is a CLI that displays the current playing lyrics, but instead of trying to go online and fetch a match it just uses the already there xesam:asText property in MPRIS.

Sadly a lot of popular players that implement the MPRIS2 standard still don’t implement that specific one, so it wont work with them. Even the one used in the showcase had to be modified, tho I am hopefully gonna upstream it soon.

I am very strict about AI usage, so for this project the only hint of AI that was used was for tab auto completion that is just used for boilerplate like, idk, implementing the Default trait for PlayerState (not including the actual tricky metadata_last_updated part). Safe to say it was only one notch above no AI at all.

So yeah, here you go give it a try and feel free to roast me, after all this is my first cli and cargo publish ;)

0

Managarr (an *arr CLI and TUI) now supports Readarr + compatible forks

GitHub GitHub - Dark-Alex-17/managarr: A TUI and CLI for managing *arr servers. Built with 🤎 in Rust github.com
preview

Managarr is a CLI (command-line) and TUI (Text-based User Interface) tool for managing all of your Servarr’s in one place.

This most recent release adds support for Readarr and several compatible forks.

I know that Readarr has sadly been retired, however there’s still community support in keeping the dream of Readarr alive. As such, extra time was put into this release to test out Managarr with four of those forks to ensure that in addition to the final release of Readarr, Managarr works with these other forks as well.

So now, as long as a fork of Readarr still is compatible with the v1 Readarr API, Managarr can work with it too.

I tested the following forks and made changes in Managarr to ensure support:

In addition to Readarr (and forks), Managarr supports Radarr, Sonarr, and Lidarr.

You can try it out for yourself without installing it by visiting the demo site if you’d like!

This is a passion project of mine so I’d love to hear any and all feedback! And thanks to all who contributed to this release!

Managarr is a CLI (command-line) and TUI (Text-based User Interface) tool for managing all of your Servarr’s in one place.

This most recent release adds support for Readarr and several compatible forks.

I know that Readarr has sadly been retired, however there’s still community support in keeping the dream of Readarr alive. As such, extra time was put into this release to test out Managarr with four of those forks to ensure that in addition to the final release of Readarr, Managarr works with these other forks as well.

So now, as long as a fork of Readarr still is compatible with the v1 Readarr API, Managarr can work with it too.

I tested the following forks and made changes in Managarr to ensure support:

In addition to Readarr (and forks), Managarr supports Radarr, Sonarr, and Lidarr.

You can try it out for yourself without installing it by visiting the demo site if you’d like!

This is a passion project of mine so I’d love to hear any and all feedback! And thanks to all who contributed to this release!

0

Small and secure Docker images for Rust: Alpine vs Debian vs Scratch

Sylvain Kerkour Small and secure Docker images for Rust: Alpine vs Debian vs Scratch kerkour.com
preview

Was recently somewhat surprised that you can’t just copy a Rust executable into a ´scratch´ container and have it work, so this is a cool blog post to find in my RSS feed.

I’m guessing, if you’re doing something less complex, then you just need the ´musl´ target and the allocator…

Was recently somewhat surprised that you can’t just copy a Rust executable into a ´scratch´ container and have it work, so this is a cool blog post to find in my RSS feed.

I’m guessing, if you’re doing something less complex, then you just need the ´musl´ target and the allocator…

0

GitHub - dessalines/qbit-pause: A library for qBittorrent to pause popular torrents

GitHub GitHub - dessalines/qbit-pause: A library for qBittorrent to pause popular torrents github.com
preview

From the README:

Pausing popular torrents isn’t something that qBittorrent handles well. This library uses 2 criteria to pause / stop torrents.

They are stopped if they are:

  • Popular (IE have a lot of total seeds), and
  • You’ve given back more than what you’ve taken (IE a seed ratio > 1)

Requirements

  • Rust
  • A qBittorrent server.
  • An API key generated through the web UI.
  • A crontab where this script can be periodically run.

Usage

This will pause torrents with a ratio >= 2, and more than 10 total seeds.

cargo run -- \
--api-key API_KEY \
--endpoint ENDPOINT \
--ratio 2 \
--total-seeds 10

From the README:

Pausing popular torrents isn’t something that qBittorrent handles well. This library uses 2 criteria to pause / stop torrents.

They are stopped if they are:

  • Popular (IE have a lot of total seeds), and
  • You’ve given back more than what you’ve taken (IE a seed ratio > 1)

Requirements

  • Rust
  • A qBittorrent server.
  • An API key generated through the web UI.
  • A crontab where this script can be periodically run.

Usage

This will pause torrents with a ratio >= 2, and more than 10 total seeds.

cargo run -- \
--api-key API_KEY \
--endpoint ENDPOINT \
--ratio 2 \
--total-seeds 10
0

Goish: A Rust runtime for Go people

Goish: A Rust runtime for Go people goish.cogentica.ai
preview

cross-posted from: lemmy.ml/post/51402479

I guess Goish might be hated by many Rust fans and Go fans. Anyway, below is the example taken from its website.

use goish::{go, KB};
use goish::sync::WaitGroup;

#[goish::main]
fn main() {
    let wg = &WaitGroup::new();
    wg.Add(1_000_000);

    for i in 0..1_000_000 {
        // Explicit 2 KiB stack, sub-page allocated from the chunked
        // stackpool - the opt-in for extreme spawn density. Everyday
        // code just writes go!(move || ...) and never sizes a stack.
        go!(stack(2 * KB), move || {
            do_work(i);
            wg.Done();
        });
    }

    wg.Wait();
}

cross-posted from: lemmy.ml/post/51402479

I guess Goish might be hated by many Rust fans and Go fans. Anyway, below is the example taken from its website.

use goish::{go, KB};
use goish::sync::WaitGroup;

#[goish::main]
fn main() {
    let wg = &WaitGroup::new();
    wg.Add(1_000_000);

    for i in 0..1_000_000 {
        // Explicit 2 KiB stack, sub-page allocated from the chunked
        // stackpool - the opt-in for extreme spawn density. Everyday
        // code just writes go!(move || ...) and never sizes a stack.
        go!(stack(2 * KB), move || {
            do_work(i);
            wg.Done();
        });
    }

    wg.Wait();
}
0

New to Dioxus and Rust. Any tips about getting started?

preview

Hey, I’m a webdev. I previously approached my project with JavaScript. I’m familiar with the js ecosystem.

I put a fair bit of consideration and in contrast to my JavaScript-approach, I’d like to investigate Dioxus.

I’m not completely new. I’ve dabbled in Rust before. I have read a lot of the docs and I’m sure there is much more to learn and practice.

What advice would you give to getting started with the Rust ecosystem approach?

Similar to a lot of languages there are considerations for things like tests. So it would be useful to see the options there. As well as any other best-practices and nuances.

In relation to my project, I’m particularly interested in the tooling available in rust for formal verification.


Just to be clear, im not here to waste your time on my slop, but if you want to see what I’ve got so far (practically nothing):

Hey, I’m a webdev. I previously approached my project with JavaScript. I’m familiar with the js ecosystem.

I put a fair bit of consideration and in contrast to my JavaScript-approach, I’d like to investigate Dioxus.

I’m not completely new. I’ve dabbled in Rust before. I have read a lot of the docs and I’m sure there is much more to learn and practice.

What advice would you give to getting started with the Rust ecosystem approach?

Similar to a lot of languages there are considerations for things like tests. So it would be useful to see the options there. As well as any other best-practices and nuances.

In relation to my project, I’m particularly interested in the tooling available in rust for formal verification.


Just to be clear, im not here to waste your time on my slop, but if you want to see what I’ve got so far (practically nothing):

0

Rust sort_unstable_by with more complex closure unexpectedly shrunk binary

preview

Crossposted from lemmy.ml/post/49521856

Thing I stumbled upon:

I added boolean argument & if statement inside sort_unstable_by closure:

//from
|&a, &b| compare(a, b) 

//to
|&a, &b| if is_reverse { compare(b, a) } else { compare(a, b) }

I expected binary to grow slightly, but actually ca 1KB smaller.

I dug into & found that the reason is: quicksort fn became 980 bytes smaller.

Why? Not sure. Inlining looks same, quicksort just has fewer instructions.

target: arm-unknown-linux-gnueabihf

commit: github.com/…/a87a98be77cc1972a53e6399716a227d1135…

details: pastebin.com/qJdTw49n

Crossposted from lemmy.ml/post/49521856

Thing I stumbled upon:

I added boolean argument & if statement inside sort_unstable_by closure:

//from
|&a, &b| compare(a, b) 

//to
|&a, &b| if is_reverse { compare(b, a) } else { compare(a, b) }

I expected binary to grow slightly, but actually ca 1KB smaller.

I dug into & found that the reason is: quicksort fn became 980 bytes smaller.

Why? Not sure. Inlining looks same, quicksort just has fewer instructions.

target: arm-unknown-linux-gnueabihf

commit: github.com/…/a87a98be77cc1972a53e6399716a227d1135…

details: pastebin.com/qJdTw49n

0

18KB file listing tool in no_std Rust and libc

preview

Crossposted from lemmy.ml/post/48563577

Initial release of FLI - really tiny and fast (like a 🪰) directory listing tool.

Initial Why: need some easy readable ls like tool for rpi to use via ssh.

Current Why: check if with Rust one can build core utils like tools faster and smaller.

  • Size:

18K - RPI ZERO W

51KB - Mac

  • Default mode streams readdir() => stdout with zero heap allocation.

  • Nice readabilty thx to (📄 and 🗂️) instead of text coloring

  • Written in no_std #rust + libc.

https:// github.com/tracyspacy/fli

Crossposted from lemmy.ml/post/48563577

Initial release of FLI - really tiny and fast (like a 🪰) directory listing tool.

Initial Why: need some easy readable ls like tool for rpi to use via ssh.

Current Why: check if with Rust one can build core utils like tools faster and smaller.

  • Size:

18K - RPI ZERO W

51KB - Mac

  • Default mode streams readdir() => stdout with zero heap allocation.

  • Nice readabilty thx to (📄 and 🗂️) instead of text coloring

  • Written in no_std #rust + libc.

https:// github.com/tracyspacy/fli

0

JavaScript data visulization tools in Tauri

preview

I am creating an app that will have some data visulization features. I have no experience in tauri or web dev, so I want to know whether it is possible to render D3.js, plotty, etc. and use them as a part of the tauri frontend

I am creating an app that will have some data visulization features. I have no experience in tauri or web dev, so I want to know whether it is possible to render D3.js, plotty, etc. and use them as a part of the tauri frontend

0

A tiny menu bar app that shows Lemmy posts.

preview

Finally I can stay forever on lemmy even not opening the browser! 😂

Thinking of using it as a mod tool to see new posts in communities I moderate.

Sharing it early, maybe get some ideas on how to make it better.

github.com/tracyspacy/lemmy-tray

Finally I can stay forever on lemmy even not opening the browser! 😂

Thinking of using it as a mod tool to see new posts in communities I moderate.

Sharing it early, maybe get some ideas on how to make it better.

github.com/tracyspacy/lemmy-tray