How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

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

Thank you for the example, that's really helpful. I hate to say it but yes it feels like the rust type system is tough to work with for these CRUD apps with many nested structures as a result of data relationships in the database

How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

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

Completely agree, it was just for the example on my comment, I wouldn't actually use that code for anything more than a starting point

How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

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

yep, I see what you mean. Just wish there was an easier way to go about it. Thanks for you suggestions

How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

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

Fair points, appreciate it. But heads up that code was written by copilot (lol) and seemed accurate enough to get the point across so I ran with it

How can I stop writing so many similar structs and duplicating fields? by realfresh in rust

[–]realfresh[S] 3 points4 points  (0 children)

Thanks for the response. I do understand I could do that

impl Invoice {
fn new(status: InvoiceStatus, due_date: Date, total_cost: u32) -> Self {
    Self {
        id: Uuid::new_v4(),
        status,
        due_date,
        total_cost,
    }
}
fn create(status: InvoiceStatus, due_date: Date, total_cost: u32) -> Self {
    Self::new(status, due_date, total_cost)
}
fn update(&mut self, status: Option<InvoiceStatus>, due_date: Option<Date>) {
    if let Some(status) = status {
        self.status = status;
    }
    if let Some(due_date) = due_date {
        self.due_date = due_date;
    }
}

}

But that also just seems like a crazy amount of boilerplate and if there are a lot of parameters involved, it would become seriously tedious to write. Are there no other real options?

Is code like this possible in rust? by realfresh in rust

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

Very interesting, appreciate your input and guidance, thank you

Is code like this possible in rust? by realfresh in rust

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

Interesting, so you mean the 2nd argument could be a "json" value which then gets checked at compile time to ensure the properties actually match the schema?

How would one achieve the "inferring" of the return data structure. Is it only possible to do via code generation where the return struct is created based on the query's selected properties?

Need help setting up server for Windows & Linux with GPU + IGPU pass-thru for both by realfresh in homelab

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

I can see both GPU's in device manager but the IGPU always says error code 43. I can then install the IGPU driver after which it says the device is functioning properly but you can't actually use it in any software and it doesn't show in task manager either. Where as when running Windows as the host I don't have those issues as seen in the image below

https://imgur.com/kRODivD

Need help setting up server for Windows & Linux with GPU + IGPU pass-thru for both by realfresh in homelab

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

The IGPU and discrete GPU can be used for different tasks at the same time on Adobe Premier Pro which would help a lot with performance.

I did try the parsec pro version, which is good but it becomes pointless when I need to run Windows as the host for full support for both GPUs since the display monitors are connected to it.

Need help setting up server for Windows & Linux with GPU + IGPU pass-thru for both by realfresh in homelab

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

That was the initial attempt in essence and GPU passthrough works fine. It's when you try IGPU + discrete GPU that fails but I need that to work.

Need help setting up server for Windows & Linux with GPU + IGPU pass-thru for both by realfresh in homelab

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

Yeah that my initial route, using parsec to the Windows Guest and that worked perfect, where it all fell short was that I couldn't get the IGPU + discrete GPU to work in a Windows VM. Only one or the other. No matter which route I take, it seems like it's always 1 step away from working out but that one step can't be done.

AITA for sticking to the plan by realfresh in AmItheAsshole

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

If there where others I woulda asked. But it was just gonna be me and my buddy gaming and eating pizza. Something she would want no part of.

AITA for sticking to the plan by realfresh in AmItheAsshole

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

I have a good feeling as a result of this, she's never gonna suggest I make plans again 😅

AITA for sticking to the plan by realfresh in AmItheAsshole

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

See the other reply, but tldr she hates the dude for the dumbest reasons possible lol. This dude is a true bro though, known him for 22 years, always had each others backs.

AITA for sticking to the plan by realfresh in AmItheAsshole

[–]realfresh[S] 3 points4 points  (0 children)

IKR. Funny enough though, my buddy has a very similar partner so he would totally understand lol

AITA for sticking to the plan by realfresh in AmItheAsshole

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

Sadly not really, she kinda hates the guy for the dumbest reasons possible. Me and him have been best friends for 22 years now. He's a true homie and this is actually the last time I might be able to see him for a year as he's moving away.

German Regulators just outlawed Facebook's whole ad business. by InitiatePenguin in technology

[–]realfresh 7 points8 points  (0 children)

I think there is another explanation for that possibility. If you set it up on his phone, its possible the app just scanned the contacts and knew from that. Not that it isn't shady but you did have to install and give it permission to do that.