Alyssa the Kate
banner
alyssa.codes
Alyssa the Kate
@alyssa.codes
Formerly Rust firmware security at the big G 🦀 | opinions are her own | makes code smol *and* sound | probably a parody account | 🏳️‍🌈🏳️‍⚧️

http://alyssa.codes
But a std::array does not keep track of how many elements have been initialized/pushed, which is what that legitimate technique of an extra counter int does. std::array is not a more efficient replacement for using vector here - what's needed is an array+length (which is how heapless::Vec works)
Vec in heapless::vec - Rust
A fixed capacity `Vec`.
docs.rs
November 18, 2025 at 4:49 PM
That's not true—an array will be located on the stack unless you specifically allocate in on the heap with `new`.

A vector will always be on the heap.

The array will always be faster for fixed small length— less bookkeeping's involved. A "SmallVector" can optimize for this.
https://llvm.org/doxygen/classllvm_1_1SmallVector.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> <head> <meta http-eq...
llvm.org
November 18, 2025 at 4:40 PM
maybe he subconsciously thought he was wearing headphones or the bus was empty until you pointed out his lack of situational awareness
November 18, 2025 at 4:27 PM
they say rust can't replace c++ and they'd be correct

nothing could truly replace such a frankenstein language
November 18, 2025 at 4:18 PM
it's also a bit advanced but you can use std::span to send both a pointer to the array and a number of elements in the same value
What is a "span" and when should I use one?
Recently I've gotten suggestions to use span&lt;T&gt;'s in my code, or have seen some answers here on the site which use span's - supposedly some kind of container. But - I can't find anything like...
stackoverflow.com
November 18, 2025 at 4:14 PM
oh awesome I hadn't seen there was progress in the last 6mo
November 18, 2025 at 5:54 AM
1. Struggling to see how that's relevant?
2. It'd be nice to have as a whole, yeah. It'd also be nice to implement the `Fn` traits directly or be generic on tuples or Fn trait/fn ptr arity.

I'm arguing that for most use cases, the unergonomic solution available in stable is sufficient:
Rust Playground
A browser interface to the Rust compiler to experiment with the language
play.rust-lang.org
November 18, 2025 at 2:04 AM
tbh that seems like less of an issue than what mem::size_of_val should do (a big reason `extern type` is still unstable). Wouldn't that just make the wide pointer bigger, or just the repr/register for certain pointees? pointer-to-!Sized = 2 words is not to be depended upon
November 18, 2025 at 2:01 AM
language syntax might be `fn() + 'a` (or `+ use<'a>`?)
November 17, 2025 at 11:40 PM
Is `struct FnWithLt<'a, F = fn()>(F, PhantomData<&'a ()>)` with invoke methods for various arities sufficient?
November 17, 2025 at 11:37 PM
have you considered One Big Trait
November 16, 2025 at 11:52 AM
the relevant utah law will ban trans women/men from using the bathroom in a government owned facility *only if there is a shower/locker room attached*

kubecon should move—the risk of arrest is too high—but the law doesn't enable it. it does still matter that we know what our legal rights are
November 16, 2025 at 12:32 AM