squire_sqlite3_sys/lib.rs
1//! # squire-sqlite3-sys
2//!
3//! [Squire][] is a crate for embedding [SQLite][] in Rust. This crate links
4//! SQLite into the application, exposing the [C API][] of SQLite to Rust.
5//!
6//! Users of Squire don't need to interact with this crate directly, and can
7//! treat it as an implementation detail.
8//!
9//! [Squire]: https://lib.rs/squire
10//! [SQLite]: https://sqlite.org/
11//! [C API]: https://sqlite.org/cintro.html
12
13#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
14
15/// Generated `unsafe extern "C"` bindings from [bindgen][].
16///
17/// [bindgen]: https://rust-lang.github.io/rust-bindgen/
18mod bindings {
19 include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
20}
21
22pub use bindings::*;
23
24/// Use `SQLITE_STATIC` as a SQLite [destructor](sqlite_destructor_type)
25/// argument to signal to SQLite that the memory allocation will outlive the
26/// (e.g.) prepared statement.
27///
28/// SQLite will not clone the provided data, nor will it run a destructor. To
29/// instead have SQLite clone a borrowed buffer, use [`SQLITE_TRANSIENT`].
30///
31/// (See the [SQLite reference][] for details.)
32///
33/// [SQLite reference]: https://sqlite.org/c3ref/c_static.html
34pub const SQLITE_STATIC: sqlite3_destructor_type = sqlite3_destructor_type::from_sentinel(0);
35
36/// Use `SQLITE_TRANSIENT` as a SQLite [destructor](sqlite_destructor_type)
37/// argument to instruct SQLite to clone the provided value before returning,
38/// and for SQLite to take responsibility to free the memory it allocated for
39/// the clone when it is no longer needed.
40///
41/// (See the [SQLite reference][] for details.)
42///
43/// [SQLite reference]: https://sqlite.org/c3ref/c_static.html
44pub const SQLITE_TRANSIENT: sqlite3_destructor_type = sqlite3_destructor_type::from_sentinel(-1);