Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/third_party/rust/rusqlite/src/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  load_extension_guard.rs

  Sprache: Rust
 

use crate::{Connection, Result};

/// RAII guard temporarily enabling SQLite extensions to be loaded.
///
/// ## Example
///
/// ```rust,no_run
/// # use rusqlite::{Connection, Result, LoadExtensionGuard};
/// # use std::path::{Path};
/// fn load_my_extension(conn: &Connection) -> Result<()> {
///     unsafe {
///         let _guard = LoadExtensionGuard::new(conn)?;
///         conn.load_extension("trusted/sqlite/extension", None)
///     }
/// }
/// ```
#[cfg_attr(docsrs, doc(cfg(feature = "load_extension")))]
pub struct LoadExtensionGuard<'conn> {
    conn: &'conn Connection,
}

impl LoadExtensionGuard<'_> {
    /// Attempt to enable loading extensions. Loading extensions will be
    /// disabled when this guard goes out of scope. Cannot be meaningfully
    /// nested.
    ///
    /// # Safety
    ///
    /// You must not run untrusted queries while extension loading is enabled.
    ///
    /// See the safety comment on [`Connection::load_extension_enable`] for more
    /// details.
    #[inline]
    pub unsafe fn new(conn: &Connection) -> Result<LoadExtensionGuard<'_>> {
        conn.load_extension_enable()
            .map(|_| LoadExtensionGuard { conn })
    }
}

#[allow(unused_must_use)]
impl Drop for LoadExtensionGuard<'_> {
    #[inline]
    fn drop(&mut self) {
        self.conn.load_extension_disable();
    }
}

Messung V0.5 in Prozent
C=48 H=86 G=69

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-06-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.