Module utils

Module utils 

Source
Expand description

Utility functions and types to help with creating custom VFS implementations. Low-level utilities, traits, and macros for implementing custom SQLite Virtual File Systems (VFS).

Modules§

x_methods_shim
A module containing shims for VFS methods that are implemented using JavaScript interoperability.

Macros§

bail
A macro to return a specific SQLite error code if a condition is true.
check_option
A macro to safely unwrap an Option<T>, returning a SQLite error code on None.
check_result
A macro to safely unwrap a Result<T, E>, returning a SQLite error code on Err.
unused
A macro to explicitly mark a parameter as unused, suppressing compiler warnings.

Structs§

LazyCell
A wrapper around once_cell::unsync::Lazy that provides Send and Sync trait implementations when the atomics target feature is not enabled, allowing for thread-local static initialization.
MemChunksFile
An in-memory file implementation that stores data in fixed-size chunks. Suitable for temporary files.
SQLiteVfsFile
The core file-handle structure for a custom VFS, designed to be compatible with SQLite’s C interface.
VfsAppData
A wrapper for the pAppData pointer in sqlite3_vfs, providing a safe way to manage VFS-specific application data and error states.
VfsError
A container for VFS-specific errors, holding both an error code and a descriptive message.

Enums§

ImportDbError
RegisterVfsError
Represents errors that can occur during the VFS registration process.

Constants§

SQLITE3_HEADER
The header of the SQLite file is used to determine whether the imported file is legal.

Traits§

SQLiteIoMethods
A trait that abstracts the sqlite3_io_methods struct, allowing for a more idiomatic Rust implementation.
SQLiteVfs
A trait that abstracts the sqlite3_vfs struct, allowing for a more idiomatic Rust implementation.
VfsFile
A trait defining the basic I/O capabilities required for a VFS file implementation.
VfsStore
Make changes to files

Functions§

check_db_and_page_size
Check db and page size, page size must be a power of two between 512 and 65536 inclusive, db size must be a multiple of page size.
check_import_db
Simple verification when importing db, and return page size;
random_name
Generates a random, temporary filename, typically used when SQLite requests a file with a NULL name.
register_vfs
A generic function to register a custom VFS implementation with SQLite.
registered_vfs
Checks if a VFS with the given name is already registered with SQLite and returns a pointer to it if found.

Type Aliases§

VfsResult
A specialized Result type for VFS operations.