Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/intl/l10n/rust/l10nregistry-rs/src/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 2 kB image not shown  

Quelle  errors.rs

  Sprache: Rust
 

use fluent_bundle::FluentError;
use fluent_fallback::types::ResourceId;
use std::error::Error;
use unic_langid::LanguageIdentifier;

#[derive(Debug, Clone, PartialEq)]
pub enum L10nRegistryError {
    FluentError {
        resource_id: ResourceId,
        loc: Option<(usize, usize)>,
        error: FluentError,
    },
    MissingResource {
        locale: LanguageIdentifier,
        resource_id: ResourceId,
    },
}

impl std::fmt::Display for L10nRegistryError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::MissingResource {
                locale,
                resource_id,
            } => {
                write!(
                    f,
                    "Missing resource in locale {}: {}",
                    locale, resource_id.value
                )
            }
            Self::FluentError {
                resource_id,
                loc,
                error,
            } => {
                if let Some(loc) = loc {
                    write!(
                        f,
                        "Fluent Error in {}[line: {}, col: {}]: {}",
                        resource_id.value, loc.0, loc.1, error
                    )
                } else {
                    write!(f, "Fluent Error in {}: {}", resource_id.value, error)
                }
            }
        }
    }
}

impl Error for L10nRegistryError {}

#[derive(Debug, Clone, PartialEq)]
pub enum L10nRegistrySetupError {
    RegistryLocked,
    DuplicatedSource { name: String },
    MissingSource { name: String },
}

impl std::fmt::Display for L10nRegistrySetupError {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::RegistryLocked => write!(f, "Can't modify a registry when locked."),
            Self::DuplicatedSource { name } => {
                write!(f, "Source with a name {} is already registered.", &name)
            }
            Self::MissingSource { name } => {
                write!(f, "Cannot find a source with a name {}.", &name)
            }
        }
    }
}

impl Error for L10nRegistrySetupError {}

Messung V0.5 in Prozent
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.