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

Quelle  shim.rs

  Sprache: Rust
 

//! Extension traits for things either not implemented or not yet stable in the MSRV.

/// Marker trait for integer types.
pub(cratetrait Integer: Sized {
    /// The maximum number of digits that this type can have.
    const MAX_NUM_DIGITS: u8;
    /// The zero value for this type.
    const ZERO: Self;

    /// Push a digit onto the end of this integer, assuming no overflow.
    ///
    /// This is equivalent to `self * 10 + digit`.
    fn push_digit(self, digit: u8) -> Self;

    /// Push a digit onto the end of this integer, returning `None` on overflow.
    ///
    /// This is equivalent to `self.checked_mul(10)?.checked_add(digit)`.
    fn checked_push_digit(self, digit: u8) -> Option<Self>;
}

/// Parse the given types from bytes.
macro_rules! impl_parse_bytes {
    ($($t:ty)*) => ($(
        impl Integer for $t {
            const MAX_NUM_DIGITS: u8 = match Self::MAX.checked_ilog10() {
                Some(digits) => digits as u8 + 1,
                None => 1,
            };

            const ZERO: Self = 0;

            #[allow(trivial_numeric_casts, reason = "macro-generated code")]
            #[inline]
            fn push_digit(self, digit: u8) -> Self {
                self * 10 + digit as Self
            }

            #[allow(trivial_numeric_casts, reason = "macro-generated code")]
            #[inline]
            fn checked_push_digit(self, digit: u8) -> Option<Self> {
                self.checked_mul(10)?.checked_add(digit as Self)
            }
        }
    )*)
}
impl_parse_bytes! { u8 u16 u32 u128 }

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

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

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