@migratory@jorts.horse cover
@migratory@jorts.horse avatar

migratory

@migratory@jorts.horse

what's a bird but a word

This profile is from a federated server and may be incomplete. For a complete list of posts, browse on the original instance.

saddestrobots , to random
@saddestrobots@jorts.horse avatar

"actually i was just trying to change the cabinet some" is the peak failed-coup guy excuse of this decade, huh

migratory ,
@migratory@jorts.horse avatar

@saddestrobots me when the landlord asks why I've removed a wall in the kitchen

became_fish , to random
@became_fish@jorts.horse avatar

alright, a much meatier problem i've been stumped on for an hour or two.

i've got a whole serde deserializer implemented that works for every use case but duplicate keys - which serde seems to explicitly object to.

i'm looking to map

val = 1  
val = 2  
val = 3  

into something like Values { val: vec![1, 2, 3] }.

anyone know of some combo of Deserializer, DeserializerSeed, Visitor i can use to make this happen? or do i gotta give up and make every struct just a Vec<(String, T)>

migratory ,
@migratory@jorts.horse avatar

@became_fish this is sadly something of a doozy, I think the serde_with crate may be able to help but none of its features look exactly right: https://docs.rs/serde_with/

migratory , to random Spanish
@migratory@jorts.horse avatar

(to the tune of "I read playboy for the articles") I read quanta magazine to keep up with postdoc fashion trends

migratory OP ,
@migratory@jorts.horse avatar

if keeps happening. I keep getting distracted by the fits

migratory OP ,
@migratory@jorts.horse avatar
became_fish , to random
@became_fish@jorts.horse avatar

people say "C++ isn't any closer to the metal than is" but what is the memory footprint of returning a Result? in C++ i can pass an out parameter by reference to avoid allocating anything on the stack - how do i do that in rust? is it with a &mut ptr? is it done automatically by the compiler when returning?

migratory ,
@migratory@jorts.horse avatar

@became_fish you do need to copy into a String in this case because Vec&lt;char&gt; is a very uncommon type to encounter as it's roughly equivalent to a UTF-32 string, while &str is a slice of a UTF-8 string

migratory ,
@migratory@jorts.horse avatar

@became_fish that said the code you have is going to crash because it promises that the Vec<char> data is UTF-8, which it isn't. you want to do chars.iter().collect::&lt;String&gt;() instead of this unsafe block, and then you'll get a String with no Result wrapper

migratory ,
@migratory@jorts.horse avatar

@became_fish it's more idiomatic to accumulate characters into a String than store them in a Vec<char>; iterating over String by character is just the .chars() method

migratory ,
@migratory@jorts.horse avatar

@became_fish I don't know quite how your code looks, but I would expect that to look something like (assuming a string s):

if s[byte_index..].starts_with("&gt;=") { ... }

migratory ,
@migratory@jorts.horse avatar

@became_fish String implements Deref<Target=str> which means it has all the methods str does, including the implementation of the Slice operators, and then str has a bunch of handy query methods like starts_with/find/etc. as well

futurebird , to random
@futurebird@sauropods.win avatar

yeah moss is great but how about a vascular plant that has basically ... gone back to the way of the moss...

Azorella compacta

It's... it's a carrot that has given up on having leaves...

Imagine a hostile planet with plants like this... could you tell that they once grew in less cold and arid climates? What if flora of the twilight days of a planet look like the earliest life... but when you look closer there are abilities, and structures that tell their history....

It looks exactly like a tuft of green moss.

migratory ,
@migratory@jorts.horse avatar

@futurebird yeah structure is knowledge bird up

loren , to random
@loren@flipping.rocks avatar

I don’t know how to deal with the big problems but if we can learn anything from cicadas it’s that the little problems can be solved by screaming

migratory ,
@migratory@jorts.horse avatar

@loren to say nothing of sleeping for a prime number of years

saddestrobots , to random
@saddestrobots@jorts.horse avatar

there's a firefox "translate" feature now and when you click "what is this?" it reassures you that it does not run in the cloud

honestly, i love that for them

anything to fight the big-data "AI is when we eat your entire life and spit it back out as warm little nuggets" hype-train

migratory ,
@migratory@jorts.horse avatar

@saddestrobots daily driving postmarketos gives me a sense of superiority that honestly drugs never could

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • test
  • worldmews
  • mews
  • All magazines