Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/tinystr/src/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  macros.rs

  Sprache: Rust
 

// This file is part of ICU4X. For terms of use, please see the file
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

#[macro_export]
macro_rules! tinystr {
    ($n:literal, $s:literal) => {{
        // Force it into a const context; otherwise it may get evaluated at runtime instead.
        const TINYSTR_MACRO_CONST: $crate::TinyAsciiStr<$n> = {
            match $crate::TinyAsciiStr::from_bytes($s.as_bytes()) {
                Ok(s) => s,
                // We are okay with panicking here because this is in a const context
                #[allow(clippy::panic)]
                // Cannot format the error since formatting isn't const yet
                Err(_) => panic!(concat!("Failed to construct tinystr from ", $s)),
            }
        };
        TINYSTR_MACRO_CONST
    }};
}

#[cfg(test)]
mod tests {
    #[test]
    fn test_macro_construction() {
        let s1 = tinystr!(8"foobar");
        assert_eq!(&*s1, "foobar");

        let s1 = tinystr!(12"foobarbaz");
        assert_eq!(&*s1, "foobarbaz");
    }
}

Messung V0.5 in Prozent
C=82 H=99 G=90

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-06-19) ¤

*© 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.