
Can someone report? This should not compile
I knew I should have just learned C

I knew I should have just learned C
It's not:
It's "serde" as in merde. Please for the love of god pronounce it with a proper french accent.
You begin to build something, and the analyzer starts yelling at you. „A field never read here! A missing match arm there! Stupid idiot!“
The whole file is one big squiggly accusation, aimed at your very existence. How dare you write any code at all? You try to guard yourself with todo!()s, you do everything to not provoke its wrath. You never succeed.
But then, you build a little more, things fall in place, and suddenly, Rust calms down. Stops yelling at you. And you get these happy feels inside, knowing you did something right! Rust still loves you, see how nice and warning-free it can compile!
Until you start with the next feature, and the vicious cycle repeats.
Edit: This post is not written by an LLM. It was hand-crafted, inspired by the muse of sleep deprivation. When we can‘t jerk anymore, are we still human? Whatever. I‘m logging off.
Hello everyone, LuigiPlayz here. You may remember me from my last post showcasing my new esoteric programming language, Krust. (If you haven't seen it, here's the post: https://www.reddit.com/r/rustjerk/comments/1u7oow0/my\_new\_totally\_not\_esoteric\_language\_based\_off\_of/). 8 hours ago, my repo got forked. However, literally nothing was different from mine. So, please do not visit the unofficial repository. The original one is https://github.com/LuigiPlayzG/krust. The same user also steals other repos and forks them. Thank you for your understanding. Goodbye.
namespace CSharpAoc.Common;
public abstract record Result
{
public sealed record Ok(TValue Value) : Result;
public sealed record Err(TError Error) : Result;
public TValue Unwrap()
{
return this switch
{
Ok ok => ok.Value,
Err err => throw new InvalidOperationException(
$"Cannot Unwrap an Err. TError: {err.Error}"
),
_ => throw new InvalidOperationException("Unknown Result state"),
};
}
public TError UnwrapErr()
{
return this switch
{
Ok ok => throw new InvalidOperationException(
$"Cannot UnwrapErr an Ok. TValue: {ok.Value}"
),
Err err => err.Error,
_ => throw new InvalidOperationException("Unknown Result state"),
};
}
public bool IsOk() => this is Ok;
public bool IsErr() => this is Err;
public Result AndThen(Func> func)
{
return this switch
{
Ok ok => func(ok.Value),
Err err => new Result.Err(err.Error),
_ => throw new InvalidOperationException("Unknown Result state"),
};
}
public Result Map(Func func)
{
return this switch
{
Ok ok => new Result.Ok(func(ok.Value)),
Err err => new Result.Err(err.Error),
_ => throw new InvalidOperationException("Unknown Result state"),
};
}
}