Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  cork_state.rs

  Sprache: Rust
 

// Copyright © 2017-2018 Mozilla Foundation
//
// This program is made available under an ISC-style license.  See the
// accompanying file LICENSE for details.

use std::ops;

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct CorkState(u32);

const UNCORK: u32 = 0b00;
const CORK: u32 = 0b01;
const NOTIFY: u32 = 0b10;
const ALL: u32 = 0b11;

impl CorkState {
    #[inline]
    pub fn uncork() -> Self {
        CorkState(UNCORK)
    }
    #[inline]
    pub fn cork() -> Self {
        CorkState(CORK)
    }
    #[inline]
    pub fn notify() -> Self {
        CorkState(NOTIFY)
    }

    #[inline]
    pub fn is_cork(&self) -> bool {
        self.contains(CorkState::cork())
    }
    #[inline]
    pub fn is_notify(&self) -> bool {
        self.contains(CorkState::notify())
    }

    #[inline]
    pub fn contains(&self, other: Self) -> bool {
        (*self & other) == other
    }
}

impl ops::BitOr for CorkState {
    type Output = CorkState;

    #[inline]
    fn bitor(self, other: Self) -> Self {
        CorkState(self.0 | other.0)
    }
}

impl ops::BitXor for CorkState {
    type Output = CorkState;

    #[inline]
    fn bitxor(self, other: Self) -> Self {
        CorkState(self.0 ^ other.0)
    }
}

impl ops::BitAnd for CorkState {
    type Output = CorkState;

    #[inline]
    fn bitand(self, other: Self) -> Self {
        CorkState(self.0 & other.0)
    }
}

impl ops::Sub for CorkState {
    type Output = CorkState;

    #[inline]
    fn sub(self, other: Self) -> Self {
        CorkState(self.0 & !other.0)
    }
}

impl ops::Not for CorkState {
    type Output = CorkState;

    #[inline]
    fn not(self) -> Self {
        CorkState(!self.0 & ALL)
    }
}

Messung V0.5 in Prozent
C=91 H=97 G=93

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-22) ¤

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

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik