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

Quellcode-Bibliothek mod.rs

  Sprache: Rust
 

//! Decode [raw][crate::Raw] TOML values into Rust native types
//!
//! See
//! - [`Raw::decode_key`][crate::Raw::decode_key]
//! - [`Raw::decode_scalar`][crate::Raw::decode_scalar]
//! - [`Raw::decode_whitespace`][crate::Raw::decode_whitespace]
//! - [`Raw::decode_comment`][crate::Raw::decode_comment]
//! - [`Raw::decode_newline`][crate::Raw::decode_newline]

#[cfg(feature = "alloc")]
use alloc::borrow::Cow;
#[cfg(feature = "alloc")]
use alloc::string::String;

pub(cratemod scalar;
pub(cratemod string;
pub(cratemod ws;

pub use scalar::IntegerRadix;
pub use scalar::ScalarKind;

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
#[repr(u8)]
pub enum Encoding {
    LiteralString = crate::lexer::APOSTROPHE,
    BasicString = crate::lexer::QUOTATION_MARK,
    MlLiteralString = 1,
    MlBasicString,
}

impl Encoding {
    pub const fn description(&self) -> &'static str {
        match self {
            Self::LiteralString => crate::lexer::TokenKind::LiteralString.description(),
            Self::BasicString => crate::lexer::TokenKind::BasicString.description(),
            Self::MlLiteralString => crate::lexer::TokenKind::MlLiteralString.description(),
            Self::MlBasicString => crate::lexer::TokenKind::MlBasicString.description(),
        }
    }
}

pub trait StringBuilder<'s> {
    fn clear(&mut self);
    #[must_use]
    fn push_str(&mut self, append: &'s str) -> bool;
    #[must_use]
    fn push_char(&mut self, append: char) -> bool;
}

impl<'s> StringBuilder<'s> for () {
    fn clear(&mut self) {}
    fn push_str(&mut self, _append: &'s str) -> bool {
        true
    }
    fn push_char(&mut self, _append: char) -> bool {
        true
    }
}

impl<'s> StringBuilder<'s> for &'s str {
    fn clear(&mut self) {
        *self = &self[0..0];
    }
    fn push_str(&mut self, append: &'s str) -> bool {
        if self.is_empty() {
            *self = append;
            true
        } else {
            false
        }
    }
    fn push_char(&mut self, _append: char) -> bool {
        false
    }
}

#[cfg(feature = "alloc")]
impl<'s> StringBuilder<'s> for Cow<'s, str> {
    fn clear(&mut self) {
        match self {
            Cow::Borrowed(s) => {
                s.clear();
            }
            Cow::Owned(s) => s.clear(),
        }
    }
    fn push_str(&mut self, append: &'s str) -> bool {
        match self {
            Cow::Borrowed(s) => {
                if !s.push_str(append) {
                    self.to_mut().push_str(append);
                }
            }
            Cow::Owned(s) => s.push_str(append),
        }
        true
    }
    fn push_char(&mut self, append: char) -> bool {
        self.to_mut().push(append);
        true
    }
}

#[cfg(feature = "alloc")]
impl<'s> StringBuilder<'s> for String {
    fn clear(&mut self) {
        self.clear();
    }
    fn push_str(&mut self, append: &'s str) -> bool {
        self.push_str(append);
        true
    }
    fn push_char(&mut self, append: char) -> bool {
        self.push(append);
        true
    }
}

Messung V0.5 in Prozent
C=91 H=90 G=90

¤ 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.0.49Bemerkung:  (vorverarbeitet am  2026-08-25) ¤

*Bot Zugriff






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.