Today's challenge is figuring out how to panic in Roto. As in, I will have multiple types where the constructor returns a Result, and I want to construct them at const-time, and don't want to deal with Result at runtime. I want to panic if they fail.
I have a few options here...
- I can create a new variant of these constructors that
.expect()with a message before returning. I could call these methodsunsafe_newor something. - I can add an
.expect()call toSafeWord, which allows the Roto side to unwrap. This is essentially the same as the previous, but more verbose on the Roto side. - I can provide a
panic()function for Roto, which, well... panics on the Rust side.
I think I'll go with the third, because that's the most explicit.
Oof. I've seen this before when I was trying to match on an
Optionas if it was aResult, but this time I'm matching aResultwithOkandErrarms.