@calebccff @migratory When starting Rust, it took me a while to understand how slices worked. As someone who worked a bit with C and C++ before, seeing the data layout on cheats.rs/#references-pointers helped - a "regular slice reference" shown there is just a ptr and a len. And lower down the page in "Standard Library Types", a Vec is just a ptr, capacity and len. And it reveals how a slice can be got easily from a Vec just by taking the Vec's ptr and len, and passing them to another function.

@calebccff @migratory What gets passed to poll() is a "slice", which consists of a pointer to some memory where a number of elements are stored sequentially, and a count of how many elements are there, and that's all poll() needs to work with.

A slice isn't quite the same as an array, slices don't own memory, they refer to memory "elsewhere" (in this case, memory owned by the Vec). IME arrays aren't used very much in Rust, due to the size-known-at-compile thing. Vec and slices are used instead.

@calebccff @migratory If referring to docs.rs/nix/0.23.0/nix/poll/fn looks like this does take a slice of PollFds, so it should be possible to have a Vec<PollFd> and pass a slice of it by e.g. `poll(&mut my_vec, my_timeout)`. Here's a similar example: play.rust-lang.org/?version=st

hughcb boosted

I can't help reading this internally with Mark from Peep Show's voice.

hughcb boosted
Actually pretty good comment about HN mod efforts to thwart the vast array of evil shill forces gathered against them. Turns out a lot of the people you find on the internet aren't shills, but just the kind of people you find on the internet.


hughcb boosted

i am so in awe of everybody who keeps maintaining the FLOSS code I rely on every day. Sometimes I just read their changelogs and marvel

hughcb boosted
hughcb boosted

@friend haha yeah I did suspect this was against at least the spirit of the law, and it seems against the letter of the law too

So, GDPR says you have to get positive consent from people before using their data for marketing? Just force them to check the box before being able to order pizza - simple!

Slightly unnerved by this van that parked outside my house today

hughcb boosted
if you're new to this encryption stuff, i think 'the code book' by simon singh is an amazing introduction to the topic and very fun to read.

@sir @jordan31 The RK3399 SoC in the Pinebook Pro is fortunately bootable without any blobs - stikonas.eu/wordpress/2019/09/
Unfortunately suspend isn't working with this open source firmware, but that should be fixable in software.

Weirdest / most tenuous Valentine's-Day-commercialisation thing I've seen so far: I bought some salmon from Tesco and it had a sticker on it saying Be My Valentine and two salmon in a heart-shape 😂

Show older

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