Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  settings.rs

  Sprache: Rust
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */


//! Persistent settings of the application.

#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct Settings {
    /// Whether a crash report should be sent.
    #[serde(default = "default_true")]
    pub submit_report: bool,
    /// Whether the URL that was open should be included in a sent report.
    #[serde(default = "default_true")]
    pub include_url: bool,
    /// Whether hardware tests (such as memory tests) are enabled
    #[serde(default = "default_true")]
    pub test_hardware: bool,
}

impl Default for Settings {
    fn default() -> Self {
        Settings {
            submit_report: true,
            include_url: true,
            test_hardware: true,
        }
    }
}

impl Settings {
    /// Write the settings to the given writer.
    pub fn to_writer<W: std::io::Write>(&self, writer: W) -> anyhow::Result<()> {
        Ok(serde_json::to_writer_pretty(writer, self)?)
    }

    /// Read the settings from the given reader.
    pub fn from_reader<R: std::io::Read>(reader: R) -> anyhow::Result<Self> {
        Ok(serde_json::from_reader(reader)?)
    }

    #[cfg(test)]
    pub fn to_string(&self) -> String {
        serde_json::to_string_pretty(self).unwrap()
    }
}

fn default_true() -> bool {
    true
}

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

¤ 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=277311
#Domains=752002