trying something a little more adventurous with Rust: yet another version of my dns-trie adventurous because it will need a little bit of unsafe{} to be competitive with the C version
2
5
currently trying to work out how to do this in stable rust: there is Vec::from_raw_parts() BUT NOT Vec::into_raw_parts() 😭
2
1
hmm actually i want slice::from_raw_parts which avoids having to worry about the compiler implicitly dropping the vec when i don’t want it to
1
ugh, having moaned at length about if{}else{} being so much more bulky than ?: i will now moan at length about how a missing ; is so much more tricky than a return keyword
2
1
actually when to ; and when not to ; in Rust is still in that category of annoying trivia where i understand the rules but i have not yet programmed my fingers to play along irritating πŸ€“
1
2
ugh i want my std::ops::Index::index() method to return Option<&T> not &Option<T> my data structure either stores T or not, the option is implicit, and i can’t return a ref to something that doesn’ exist
1
it’s a data structure so it needs a fuzzer and a test oracle i’ve written a BmpVec for small bitmap-compressed vectors now i’m writing a BlimpVec which is not compressed and doesn’t have unsafe code
1
1
while i’m getting this fuzzer going, i would be very grateful if any rustaceans could express an opinion on my unsafe code - the important functions are from_cooked_parts() and as_cooked_parts() dotat.at/cgi/git/dnstrie.git…
4
Replying to @fanf
I would worry that as_cooked_parts could explode if I construct a bmpvec from raw parts which are not heap allocated. You need to document the invariants which the unsafe methods rely on

May 13, 2021 Β· 5:16 PM UTC

1
Replying to @dsilverstone
yep, if you from_raw_parts() wrong, you lose, which seems fairly conventional for things with that name :-) gonna try to make it explode before writing docs