Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quelle  blas.rs

  Sprache: Rust
 

use crate::{
    resource::{Blas, Trackable},
    track::metadata::ResourceMetadata,
};
use alloc::sync::Arc;

/// A tracker that holds tracks BLASes.
///
/// This is mostly a safe shell around [`ResourceMetadata`]
#[derive(Debug)]
pub(cratestruct BlasTracker {
    metadata: ResourceMetadata<Arc<Blas>>,
    size: usize,
}

impl BlasTracker {
    pub fn new() -> Self {
        Self {
            metadata: ResourceMetadata::new(),
            size: 0,
        }
    }

    /// Inserts a single resource into the resource tracker.
    ///
    /// Returns a reference to the newly inserted resource.
    /// (This allows avoiding a clone/reference count increase in many cases.)
    pub fn insert_single(&mut self, resource: Arc<Blas>) -> &Arc<Blas> {
        let index = resource.tracker_index().as_usize();
        self.allow_index(index);

        unsafe {
            // # SAFETY: we just allowed this resource, which makes the metadata object larger if
            // it's not in bounds
            self.metadata.insert(index, resource)
        }
    }

    /// Sets the size of all the vectors inside the tracker.
    ///
    /// Must be called with the highest possible Texture ID before
    /// all unsafe functions are called.
    pub fn set_size(&mut self, size: usize) {
        self.size = size;
        self.metadata.set_size(size)
    }

    /// Extend the vectors to let the given index be valid.
    fn allow_index(&mut self, index: usize) {
        if index >= self.size {
            self.set_size(index + 1);
        }
    }

    /// Returns true if the tracker owns the given texture.
    pub fn contains(&self, blas: &Blas) -> bool {
        self.metadata.contains(blas.tracker_index().as_usize())
    }
}

Messung V0.5 in Prozent
C=75 H=95 G=85

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






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=434850
#Domains=661743