Custom error types
Në shqip: Tipet e gabimeve në Rust
ShpjegimiSQ
Për librari, krijo një enum me të gjitha gabimet e mundshme dhe implemento std::error::Error dhe Display. Kështu përdoruesit mund t'i trajtojnë veç e veç me match.
EnglishEN
For libraries, create an enum of every possible error and implement std::error::Error and Display. That way users can handle each one separately with match.
Si ta mendosh
Si një listë kodesh gabimi në manualin e një pajisjeje.
Lexoje në anglisht
Like a list of error codes in a device's manual.
Shembull kodirust
#[derive(Debug)]
enum GabimNote { JashteKufijve(u8), Mungon }