Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  deadline_support.rs

  Sprache: Rust
 

use std::time::Duration;

#[cfg(not(feature = "wasm32_web_time"))]
pub use std::time::Instant;

/// WASM (browser) specific instant type.
///
/// This type is only available when the `wasm32_web_time` feature is enabled.  In that
/// case this is an alias for [`web_time::Instant`].
#[cfg(feature = "wasm32_web_time")]
pub use web_time::Instant;

/// Checks if a deadline was exeeded.
pub fn deadline_exceeded(deadline: Option<Instant>) -> bool {
    #[allow(unreachable_code)]
    match deadline {
        Some(deadline) => {
            #[cfg(all(target_arch = "wasm32", not(feature = "wasm32_web_time")))]
            {
                return false;
            }
            Instant::now() > deadline
        }
        None => false,
    }
}

/// Converst a duration into a deadline.  This can be a noop on wasm
#[allow(unused)]
pub fn duration_to_deadline(add: Duration) -> Option<Instant> {
    #[allow(unreachable_code)]
    #[cfg(all(target_arch = "wasm32", not(feature = "wasm32_web_time")))]
    {
        return None;
    }
    Instant::now().checked_add(add)
}

Messung V0.5 in Prozent
C=92 H=93 G=92

¤ 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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=141584
#Domains=752002