« first day (956 days earlier)      last day (2532 days later) » 

12:34 AM
@E_net4 OP appears to not be able to state what behaviour they want
@E_net4 NameRef("Jake");
It's strange to see ones name
even if its not on purpose
Anywho
the answer to "how do i handle null json values" is "use Option"
what they probably are trying to ask is closer to what you answered
a field "color" with the value null is not equivalent to no field at all. is spot-on
I think that's the missing part of OPs knowledge
fn null_as_default<'de, D, T>(d: D) -> Result<T, D::Error>
    where D: Deserializer<'de>,
    T: Default + serde::Deserialize<'de>
{
    Deserialize::deserialize(d).map(|x: Option<_>| x.unwrap_or_else(T::default))
}
that's cool that works
 
12:51 AM
@Shepmaster Riiight... <_< ... >_>
Ah, that code's nice too.
 
 
1 hour later…
2:07 AM
> I know there are a million of these, but I've checked a few other answers and still cannot figure it out.
I really don't know how to handle these
especially when removing the Rust: tag in the title ends up with a duplicate name
 
2:59 AM
It's been a while since I did some Java
1
Q: What's the Rust equivalent return value of a Java function that returns multiple exceptions?

アレックスWhat's the appropriate return value of a function in Rust which in Java looks like this? void verify(String input) { if (!checkInput(input)) return Exception1("...."); if (!checkInput2(input)) return Exception2("...."); if (!checkInput3(input)) return Exception3("...."); } I figure it sh...

but... returning an Exception?
 
 
8 hours later…
11:28 AM
@Shepmaster Totally a typo. That should have been throw new, not return.
 
 
2 hours later…
1:52 PM
@E_net4, the trouble is described in my question. Consider learning to read questions. — Jodarim255 56 mins ago
?v=OIoMfVNVx4g
I... don't know how to reply to that.
 
2:08 PM
@E_net4 hehe
 
Halp
 
@E_net4 looks like things are taking care of themselves
 
That'll do.
 
On the other foot, one of my SO nemesis seems to have woken up - stackoverflow.com/posts/26739691/revisions
I'm OK getting into a revert war every so often
 
@Shepmaster Well, you did nudge one of their questions. It's almost like an annoying poke in the shoulder. :P
 
2:11 PM
@E_net4 IIRC you only get a notification if you edit the code
i guess the language tag does that?
 
TBH I don't know. But speaking of that, haven't you fixed the Java code?
 
@E_net4 fixed in which sense? I added <!-- language: java -->
But I don't mess with formatting or anything like that in general for non-Rust code
 
@Shepmaster I meant the wrong return Exception part.
 
@E_net4 nah; that's the original post; don't wanna touch that
 
Oh well.
@MaartenBodewes Please post where you are stuck implementing it in Rust. -- in finding out how to implement that in Rust. — Jodarim255 1 min ago
</thug-life>
Wow, this newbie is rustling my jimmies.
 
2:18 PM
Yep
rolledback my edits too
conspiracy hat
2
Q: Calculating HMAC in Rust

アレックスIn Java I can do this to calculate HMAC: import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; //....... Mac hmac = Mac.getInstance("some algorithm"); hmac.init(new SecretKeySpec("some secret", "some algorithm")); byte[] res = hmac.doFinal(("some str").getBytes()); How can I do the...

My nemesis also posted Java crypto code and said make this for me
 
Heck.
@Shepmaster it's too old for more than a downboat now. :[
 
@E_net4 ah, it's fine.
2014 was a different time
> std::marker::PhantomData field which in turn consumes a falsely unused lifetime
I reallllllly don't like that people use PhantomData for that
like, variance is a tricky thing
 
That's a tricky one. :|
 
> The general architecture is a loose amalgamation of specs and calx-ecs.
I don't even know what that means
what are those things
i guess other crates
pub type UUID = u32;
debug_assert!(entity.uuid > 0);
SMH
well, i guess 0
nevermind
debug_assert means it's OK for your code to be incorrect in production
 
2:59 PM
I'd say you'd use them to check invariants, isn't it?
 
3:10 PM
@E_net4 I'm being tongue-in-cheek
debug_assert is removed when compiling in release mode
so it can't catch anything there
the traditional mindset is "I don't want anything slowing down my production code"
but many times the assert isn't a bottleneck
so it's better to use assert! instead
 
3:30 PM
@MaartenBodewes, welcome to SO! — Jodarim255 21 mins ago
 
I wonder how many rollbacks it takes to trigger the lock
 
Oh wow.
Keep it rolling to see what happens!
 
Morning @MatthieuM.!
 
It's nearly evening here actually (Amsterdam) :)
But I do appreciate the greeting ^^ Morning to you :)
 
3:58 PM
Universal internet greeting time FTW. :>
So yeah, good morning! :P
 
4:10 PM
@MatthieuM. Amsterdam! Insert drug-related joke here
 
Yeah :/ Not really my cup of tea, but it does point that the people here are rather open-minded and the city is really cool to live in: lots of parks, canals, plenty of bike lanes and public transportation, and welcoming people.
 

« first day (956 days earlier)      last day (2532 days later) »