Rust

thiserror & anyhow

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

thiserror krijon tipe gabimesh me pak kod (për librari); anyhow::Result lejon çdo gabim me ? dhe shton kontekst me .context("...") (për aplikacione). Kombinimi më i përdorur në Rust.

EnglishEN

thiserror creates error types with little code (for libraries); anyhow::Result accepts any error with ? and adds context with .context("...") (for applications). The most-used combination in Rust.

Si ta mendosh

Si formularë të gatshëm për të raportuar probleme.

Lexoje në anglisht

Like ready-made forms for reporting problems.

Shembull kodirust

use anyhow::{Context, Result};
fn lexo_konfig() -> Result<String> {
    std::fs::read_to_string("konfig.toml").context("S'u lexua konfigurimi")
}

Terma të lidhur