Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
Do you mean moonshine_save? Does it even provide an API for loading that doesn’t return a Result with a possible LoadError?
Rust doesn’t generally “throw” errors, it returns them; and generally, function APIs will guide you in the right direction. You generally should not use unwrap() or expect() in your finished code (though the unwrap_or... variants are fine), which means that you must handle all errors the API can return programmatically (possibly just by propagating with ?, if you will instead be handling the error in the caller).
Do you mean
moonshine_save
? Does it even provide an API for loading that doesn’t return aResult
with a possible LoadError?Rust doesn’t generally “throw” errors, it returns them; and generally, function APIs will guide you in the right direction. You generally should not use
unwrap()
orexpect()
in your finished code (though theunwrap_or...
variants are fine), which means that you must handle all errors the API can return programmatically (possibly just by propagating with?
, if you will instead be handling the error in the caller).