Kitlith boosted
Kitlith boosted

Apparently I *was* out of date, so maybe that had something to do with it.

Show thread

Anyone else who uses Fedilab get weird notification behavior?

I got 40 notifications for a single reply to a toot a few minutes ago. :/

Kitlith boosted

Summary of Stein's Gate (in ttrpg terms):

Player: "Okabe tries to create a Phone controlled Microwave!"

DM: "Alright, roll for it."

Player: *rolls a one* "uhhh"

DM: "Well, roll and hope you don't confirm a critical failure."

Player: *rolls a one* "shit"

DM: "Alright. Everything it microwaves turns into goop. As a side-note, it's now a time machine."

Player: "wait, what? That sounds cool!"

DM: *grins evilly*

Why'd I decide to type this all out on my phone? >_>

Show thread

Note: this is an example based on, but not equal to the case I actually developed it for. The focus is the technique, not the specific trait implemented.

Also: I like markdown, it's a shame that it doesn't actually work here.

Show thread

and then I could implement TryFrom roughly like thus using the byteorder crate:

```rust
impl<'a, Endian> TryFrom<&'a [u8]> for Wrappedu16<Endian>
where Endian: byteorder::ByteOrder {
fn try_from(src: &'a [u8]) -> Result<Self, !> {
Ok(Endian::read_u16(src)) // panics, unfortunately
}
}
```

It's not perfect by any means, but I think it's pretty neat!

Show thread

What about newtype wrappers? I could create `LEu16` and `BEu16` and implement for these separately. However, this is mildly annoying.

However, what if we tied some extra data to a single wrapper? e.g. you deserialized a Wrappedu16<BigEndian>.

Of course Rust doesn't like unused template parameters, so PhantomData comes to the rescue:

```rust
struct Wrappedu16<Endian>(u16, PhantomData<Endian>)
```

Show thread

Been playing around with PhantomData in rust. Example usage in Rust's documentation deals with unsafe code and referemces, but what follows is an example in deserialization that doesn't touch unsafe code at all.

Say I wanted to implement something like `TryFrom<&[u8]>` for u16. There's an issue here: is the u16 in little endian or in big endian order? The obvious (but dirty) answer is to pick an endian and swap when necessary.

Kitlith boosted
Kitlith boosted
Kitlith boosted

those four words she wants to hear

that’s right, “all prices include tax”

Kitlith boosted

Friendly reminder: In a world where so many people are cruel for the sake of it, the most punk thing you can do is to be kind without expecting anything in return.

So, yeah.

(Should I be putting this kind-of stuff under a CW? Still new to this.)

Show thread

Second off, we have another power input.

mastodon.technology/media/AjHG

I've never seen this *on* a motherboard before. No idea what it's for. Wasn't even plugged in whe n I did the motherboard swap.

Show thread

First things first, the CPU power connector. I've seen stuff like this before, but not on a motherboard. Guess they decided to only go with 4pin even though the design allowedthe 8 pin power?

mastodon.technology/media/b1jc

Show thread

Did a motherboard swap today, noticed a couple of things that seemed odd on the old motherboard.

mastodon.technology/media/6n_r

@fosstodon
Are your email verification emails actually going out? I tried to sign up with your instance first, but never received the confirmation email. Could also have something to do with my different email receiving setup (forwardemail.net so I can use my domain), but I got the email from this instance successfully.

Show more
Mastodon for Tech Folks

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!