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

Quelle  test_utils.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 ).

/// Take a VarULE type and serialize it both in human and machine readable contexts,
/// and ensure it roundtrips correctly
///
/// Note that the concrete type may need to be explicitly specified to prevent issues with
/// https://github.com/rust-lang/rust/issues/130180
#[cfg(feature = "serde")]
pub(cratefn assert_serde_roundtrips<T>(var: &T)
where
    T: crate::ule::VarULE + ?Sized + serde::Serialize,
    for<'a> Box<T>: serde::Deserialize<'a>,
    for<'a> &'a T: serde::Deserialize<'a>,
    T: core::fmt::Debug + PartialEq,
{
    let bincode = bincode::serialize(var).unwrap();
    let deserialized: &T = bincode::deserialize(&bincode).unwrap();
    let deserialized_box: Box<T> = bincode::deserialize(&bincode).unwrap();
    assert_eq!(var, deserialized, "Single element roundtrips with bincode");
    assert_eq!(
        var, &*deserialized_box,
        "Single element roundtrips with bincode"
    );

    let json = serde_json::to_string(var).unwrap();
    let deserialized: Box<T> = serde_json::from_str(&json).unwrap();
    assert_eq!(var, &*deserialized, "Single element roundtrips with serde");
}

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

¤ Dauer der Verarbeitung: 0.15 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.