[-] silva@sopuli.xyz 5 points 1 month ago

Each piece moves one square up, wrapping around to the start it they are at the end of the board.

28
submitted 2 months ago* (last edited 2 months ago) by silva@sopuli.xyz to c/rust@programming.dev

Hey,

Is there any way to create a macro that allows a Some<T> or T as input?

It's for creating a Span struct that I'm using:

struct Span {
    line: usize,
    column: usize,
    file_path: Option<String>,
}

...and I have the following macro:

macro_rules! span {
    ($line:expr, $column:expr) => {
        Span {
            line: $line,
            column: $column
            file_path: None,
        }
    };

    ($line:expr, $column:expr, $file_path: expr) => {
        Span {
            line: $line,
            column: $column
            file_path: Some($file_path.to_string()),
        }
    };
}

...which allows me to do this:

let foo = span!(1, 1);
let bar = span!(1, 1, "file.txt");

However, sometimes I don't want to pass in the file path directly but through a variable that is Option. To do this, I always have to match the variable:

let file_path = Some("file.txt");

let foo = match file_path {
    Some(file_path) => span!(1, 1, file_path),
    None => span!(1, 1),
}

Is there a way which allows me to directly use span!(1, 1, file_path) where file_path could be "file.txt", Some("file.txt") or None?

Thanks in advance!

[-] silva@sopuli.xyz 12 points 2 months ago
Segmentation fault (core dumped)
12
Free Kiosk App (sopuli.xyz)
submitted 2 months ago by silva@sopuli.xyz to c/android@lemmy.world

Hey, Do you know any free kiosk apps (an app that only allow you to use one app) like Fully Single Kiosk App?

92
submitted 2 months ago by silva@sopuli.xyz to c/piracy@lemmy.dbzer0.com

I recently set up Sonarr and Radarr on my home server and I'm loving it.

However, I don't get why you would ever use Lidarr. Why would you ever download music using torrents? You can use tools like spotdl and yt-dlp to download songs from YouTube music and Spotify, it's faster and more reliable; I have had some issues finding torrents of music from less-known artists.

To me it seems like it would be much better to have a tool like Lidarr or have support in Jellyseerr to download music from common streaming services.

What are your views on this?

[-] silva@sopuli.xyz 11 points 2 months ago

comment for the algorithm

[-] silva@sopuli.xyz 28 points 2 months ago* (last edited 2 months ago)

*All politicians behind closed doors

[-] silva@sopuli.xyz 5 points 2 months ago

I know, it was exactly the same for me. I hated it when people didn't tell me anything about the game and just said 'Play It'.

Then I bought it anyway during a sale, and now I'm one of those people: Play It. Without any spoilers.

[-] silva@sopuli.xyz 105 points 2 months ago

But it's true. Play Outer Wilds. Don't look anything up!

[-] silva@sopuli.xyz 54 points 3 months ago

uBlock Origin + Firefox is the same tho if not better? What do you mean by "it's insane"?

[-] silva@sopuli.xyz 7 points 3 months ago

That's not just UK rappers tho, at least that's also a perfect summary for german rap.

183
Impossible (sopuli.xyz)
submitted 4 months ago by silva@sopuli.xyz to c/memes@sopuli.xyz
[-] silva@sopuli.xyz 6 points 4 months ago* (last edited 4 months ago)

Can you explain it? I don't get it.

[-] silva@sopuli.xyz 8 points 4 months ago

Every fucking time.

[-] silva@sopuli.xyz 5 points 5 months ago

I don't know about where you live, but in Switzerland there are still stores where you can buy computers. In fact, all computers my parents ever bought are from computer stores.

[-] silva@sopuli.xyz 12 points 5 months ago

Yes, non-linux users

view more: next ›

silva

joined 9 months ago